(function($){$.tools=$.tools||{version:'1.2.5'};$.tools.tabs={conf:{tabs:'a',current:'current',onBeforeClick:null,onClick:null,effect:'default',initialIndex:0,event:'click',rotate:false,history:false},addEffect:function(name,fn){effects[name]=fn;}};var effects={'default':function(i,done){this.getPanes().hide().eq(i).show();done.call();},fade:function(i,done){var conf=this.getConf(),speed=conf.fadeOutSpeed,panes=this.getPanes();if(speed){panes.fadeOut(speed);}else{panes.hide();}
panes.eq(i).fadeIn(conf.fadeInSpeed,done);},slide:function(i,done){this.getPanes().slideUp(200);this.getPanes().eq(i).slideDown(400,done);},ajax:function(i,done){this.getPanes().eq(0).load(this.getTabs().eq(i).attr("href"),done);}};var w;$.tools.tabs.addEffect("horizontal",function(i,done){if(!w){w=this.getPanes().eq(0).width();}
this.getCurrentPane().animate({width:0},function(){$(this).hide();});this.getPanes().eq(i).animate({width:w},function(){$(this).show();done.call();});});function Tabs(root,paneSelector,conf){var self=this,trigger=root.add(this),tabs=root.find(conf.tabs),panes=paneSelector.jquery?paneSelector:root.children(paneSelector),current;if(!tabs.length){tabs=root.children();}
if(!panes.length){panes=root.parent().find(paneSelector);}
if(!panes.length){panes=$(paneSelector);}
$.extend(this,{click:function(i,e){var tab=tabs.eq(i);if(typeof i=='string'&&i.replace("#","")){tab=tabs.filter("[href*="+i.replace("#","")+"]");i=Math.max(tabs.index(tab),0);}
if(conf.rotate){var last=tabs.length-1;if(i<0){return self.click(last,e);}
if(i>last){return self.click(0,e);}}
if(!tab.length){if(current>=0){return self;}
i=conf.initialIndex;tab=tabs.eq(i);}
if(i===current){return self;}
e=e||$.Event();e.type="onBeforeClick";trigger.trigger(e,[i]);if(e.isDefaultPrevented()){return;}
effects[conf.effect].call(self,i,function(){e.type="onClick";trigger.trigger(e,[i]);});current=i;tabs.removeClass(conf.current);tab.addClass(conf.current);return self;},getConf:function(){return conf;},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);},destroy:function(){tabs.unbind(conf.event).removeClass(conf.current);panes.find("a[href^=#]").unbind("click.T");return self;}});$.each("onBeforeClick,onClick".split(","),function(i,name){if($.isFunction(conf[name])){$(self).bind(name,conf[name]);}
self[name]=function(fn){if(fn){$(self).bind(name,fn);}
return self;};});if(conf.history&&$.fn.history){$.tools.history.init(tabs);conf.event='history';}
tabs.each(function(i){$(this).bind(conf.event,function(e){self.click(i,e);return e.preventDefault();});});panes.find("a[href^=#]").bind("click.T",function(e){self.click($(this).attr("href"),e);});if(location.hash&&conf.tabs=="a"&&root.find("[href="+location.hash+"]").length){self.click(location.hash);}else{if(conf.initialIndex===0||conf.initialIndex>0){self.click(conf.initialIndex);}}}
$.fn.tabs=function(paneSelector,conf){var el=this.data("tabs");if(el){el.destroy();this.removeData("tabs");}
if($.isFunction(conf)){conf={onBeforeClick:conf};}
conf=$.extend({},$.tools.tabs.conf,conf);this.each(function(){el=new Tabs($(this),paneSelector,conf);$(this).data("tabs",el);});return conf.api?el:this;};})(jQuery);(function($){var tool;tool=$.tools.tabs.slideshow={conf:{next:'.forward',prev:'.backward',disabledClass:'disabled',autoplay:false,autopause:true,interval:3000,clickable:true,api:false}};function Slideshow(root,conf){var self=this,fire=root.add(this),tabs=root.data("tabs"),timer,stopped=true;function find(query){var el=$(query);return el.length<2?el:root.parent().find(query);}
var nextButton=find(conf.next).click(function(){tabs.next();});var prevButton=find(conf.prev).click(function(){tabs.prev();});$.extend(self,{getTabs:function(){return tabs;},getConf:function(){return conf;},play:function(){if(timer){return self;}
var e=$.Event("onBeforePlay");fire.trigger(e);if(e.isDefaultPrevented()){return self;}
timer=setInterval(tabs.next,conf.interval);stopped=false;fire.trigger("onPlay");return self;},pause:function(){if(!timer){return self;}
var e=$.Event("onBeforePause");fire.trigger(e);if(e.isDefaultPrevented()){return self;}
timer=clearInterval(timer);fire.trigger("onPause");return self;},stop:function(){self.pause();stopped=true;}});$.each("onBeforePlay,onPlay,onBeforePause,onPause".split(","),function(i,name){if($.isFunction(conf[name])){$(self).bind(name,conf[name]);}
self[name]=function(fn){return $(self).bind(name,fn);};});if(conf.autopause){tabs.getTabs().add(nextButton).add(prevButton).add(tabs.getPanes()).hover(self.pause,function(){$('.feature_pane_menu li').removeClass('current');if(!stopped){self.play();}});}
if(conf.autoplay){self.play();}
if(conf.clickable){tabs.getPanes().click(function(){tabs.next();});}
if(!tabs.getConf().rotate){var disabled=conf.disabledClass;if(!tabs.getIndex()){prevButton.addClass(disabled);}
tabs.onBeforeClick(function(e,i){prevButton.toggleClass(disabled,!i);nextButton.toggleClass(disabled,i==tabs.getTabs().length-1);});}}
$.fn.slideshow=function(conf){var el=this.data("slideshow");if(el){return el;}
conf=$.extend({},tool.conf,conf);this.each(function(){el=new Slideshow($(this),conf);$(this).data("slideshow",el);});return conf.api?el:this;};})(jQuery);
