/**
 * tools.tabs 1.0.1E - Tabs done rigth.
 * 
 * Copyright (c) 2009 Tero Piirainen
 * http://flowplayer.org/tools/tabs.html
 * 
 * Edited:
 * Copyright (c) 2009 Ivan Vovnenko, Corporate Voice
 * http://www.corporatevoice.com
 *
 * Dual licensed under MIT and GPL 2+ licenses
 * http://www.opensource.org/licenses
 *
 * Launch  : November 2008
 * Date: 2009-06-12 11:02:45 +0000 (Fri, 12 Jun 2009)
 * Revision: 1911 
 */
(function($){$.tools=$.tools||{version:{}};$.tools.version.tabs='1.0.1E';$.tools.addTabEffect=function(name,fn){effects[name]=fn};var effects={'default':function(i){this.getPanes().hide().eq(i).show()},fade:function(i){this.getPanes().hide().eq(i).fadeIn(this.getConf().fadeInSpeed)},slide:function(i){this.getCurrentPane().slideUp("fast");this.getPanes().eq(i).slideDown()},horizontal:function(i){if(!$._hW){$._hW=this.getPanes().eq(0).width()}this.getCurrentPane().animate({width:0},function(){$(this).hide()});this.getPanes().eq(i).animate({width:$._hW},function(){$(this).show()})}};function Tabs(tabs,panes,opts){var self=this;var current;function bind(name,fn){$(self).bind(name,function(e,args){if(fn&&fn.call(this,args.index)===false&&args){args.proceed=false}});return self}$.each(opts,function(name,fn){if($.isFunction(fn)){bind(name,fn)}});$.extend(this,{click:function(i){if(i===current){return self}var pane=self.getCurrentPane();var tab=tabs.eq(i);if(typeof i=='string'){tab=tabs.filter("[href="+i+"]");i=tabs.index(tab)}if(!tab.length){if(current>=0){return self}i=opts.initialIndex;tab=tabs.eq(i)}var args={index:i,proceed:true};$(self).triggerHandler("onBeforeClick",args);if(!args.proceed){return self}tab.addClass(opts.current);effects[opts.effect].call(self,i);$(self).triggerHandler("onClick",args);tabs.removeClass(opts.current);tab.addClass(opts.current);current=i;return self},getConf:function(){return opts},getTabs:function(){return tabs},getPanes:function(){return panes},getCurrentPane:function(){return panes.eq(current)},getCurrentTab:function(){return tabs.eq(current)},getIndex:function(){return current},next:function(){return self.click(current+1)},prev:function(){return self.click(current-1)},onBeforeClick:function(fn){return bind("onBeforeClick",fn)},onClick:function(fn){return bind("onClick",fn)}});tabs.each(function(i){$(this).bind(opts.event,function(e){self.click(i);if(!opts.history){return e.preventDefault()}})});if(opts.history){tabs.history(function(evt,hash){if(hash){self.click(hash)}})}if(location.hash){self.click(location.hash)}else{self.click(opts.initialIndex)}panes.find("a[href^=#]").click(function(){self.click($(this).attr("href"))})}$.fn.tabs=function(query,arg){var el=this.eq(typeof conf=='number'?conf:0).data("tabs");if(el){return el}var opts={tabs:'a',current:'current',onBeforeClick:null,onClick:null,effect:'default',history:false,initialIndex:0,event:'click',api:false};if($.isFunction(arg)){arg={onBeforeClick:arg}}$.extend(opts,arg);this.each(function(i){var els=$(this).find(opts.tabs);if(!els.length){els=$(this).children()}var panes=null;if(query.jquery){panes=query}else{var obj=$(query,this);if(obj.size()>0){panes=obj}else{panes=$(this).siblings(query)}}el=new Tabs(els,panes,opts);$(this).data("tabs",el)});return opts.api?el:this}})(jQuery);(function($){var hash,iframe;$.prototype.history=function(fn){var el=this;if($.browser.msie){if(!iframe){iframe=$("<iframe />").attr('tabIndex','-1').attr('style','position: absolute; width: 0; height: 0; border: 0').get(0);$("body").append(iframe);setInterval(function(){var idoc=iframe.contentWindow.document;var h=idoc.location.hash;if(hash!==h){$.event.trigger("hash",h);hash=h}var localHash=document.location.hash;if(localHash!=h){idoc.open().close();idoc.location.hash=localHash}},100)}el.bind("click.hash",function(e){var doc=iframe.contentWindow.document;doc.open().close();doc.location.hash=$(this).attr("href")});}else{setInterval(function(){var h=location.hash;if(el.filter("[href*="+h+"]").length&&h!==hash){hash=h;$.event.trigger("hash",h)}},100)}$(window).bind("hash",fn);return this}})(jQuery);