(function($){$.tools=$.tools||{version:'1.2.5'};$.tools.tooltip={conf:{effect:'toggle',fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:['top','center'],offset:[0,0],relative:false,cancelDefault:true,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:'<div/>',tipClass:'tooltip'},addEffect:function(name,loadFn,hideFn){effects[name]=[loadFn,hideFn];}};var effects={toggle:[function(done){var conf=this.getConf(),tip=this.getTip(),o=conf.opacity;if(o<1){tip.css({opacity:o});}
tip.show();done.call();},function(done){this.getTip().hide();done.call();}],fade:[function(done){var conf=this.getConf();this.getTip().fadeTo(conf.fadeInSpeed,conf.opacity,done);},function(done){this.getTip().fadeOut(this.getConf().fadeOutSpeed,done);}]};function getPosition(trigger,tip,conf){var top=conf.relative?trigger.position().top:trigger.offset().top,left=conf.relative?trigger.position().left:trigger.offset().left,pos=conf.position[0];top-=tip.outerHeight()-conf.offset[0];left+=trigger.outerWidth()+conf.offset[1];if(/iPad/i.test(navigator.userAgent)){top-=$(window).scrollTop();}
var height=tip.outerHeight()+trigger.outerHeight();if(pos=='center'){top+=height/2;}
if(pos=='bottom'){top+=height;}
pos=conf.position[1];var width=tip.outerWidth()+trigger.outerWidth();if(pos=='center'){left-=width/2;}
if(pos=='left'){left-=width;}
return{top:top,left:left};}
function Tooltip(trigger,conf){var self=this,fire=trigger.add(self),tip,timer=0,pretimer=0,title=trigger.attr("title"),tipAttr=trigger.attr("data-tooltip"),effect=effects[conf.effect],shown,isInput=trigger.is(":input"),isWidget=isInput&&trigger.is(":checkbox, :radio, select, :button, :submit"),type=trigger.attr("type"),evt=conf.events[type]||conf.events[isInput?(isWidget?'widget':'input'):'def'];if(!effect){throw"Nonexistent effect \""+conf.effect+"\"";}
evt=evt.split(/,\s*/);if(evt.length!=2){throw"Tooltip: bad events configuration for "+type;}
trigger.bind(evt[0],function(e){clearTimeout(timer);if(conf.predelay){pretimer=setTimeout(function(){self.show(e);},conf.predelay);}else{self.show(e);}}).bind(evt[1],function(e){clearTimeout(pretimer);if(conf.delay){timer=setTimeout(function(){self.hide(e);},conf.delay);}else{self.hide(e);}});if(title&&conf.cancelDefault){trigger.removeAttr("title");trigger.data("title",title);}
$.extend(self,{show:function(e){if(!tip){if(tipAttr){tip=$(tipAttr);}else if(conf.tip){tip=$(conf.tip).eq(0);}else if(title){tip=$(conf.layout).addClass(conf.tipClass).appendTo(document.body).hide().append(title);}else{tip=trigger.next();if(!tip.length){tip=trigger.parent().next();}}
if(!tip.length){throw"Cannot find tooltip for "+trigger;}}
if(self.isShown()){return self;}
tip.stop(true,true);var pos=getPosition(trigger,tip,conf);if(conf.tip){tip.html(trigger.data("title"));}
e=e||$.Event();e.type="onBeforeShow";fire.trigger(e,[pos]);if(e.isDefaultPrevented()){return self;}
pos=getPosition(trigger,tip,conf);tip.css({position:'absolute',top:pos.top,left:pos.left});shown=true;effect[0].call(self,function(){e.type="onShow";shown='full';fire.trigger(e);});var event=conf.events.tooltip.split(/,\s*/);if(!tip.data("__set")){tip.bind(event[0],function(){clearTimeout(timer);clearTimeout(pretimer);});if(event[1]&&!trigger.is("input:not(:checkbox, :radio), textarea")){tip.bind(event[1],function(e){if(e.relatedTarget!=trigger[0]){trigger.trigger(evt[1].split(" ")[0]);}});}
tip.data("__set",true);}
return self;},hide:function(e){if(!tip||!self.isShown()){return self;}
e=e||$.Event();e.type="onBeforeHide";fire.trigger(e);if(e.isDefaultPrevented()){return;}
shown=false;effects[conf.effect][1].call(self,function(){e.type="onHide";fire.trigger(e);});return self;},isShown:function(fully){return fully?shown=='full':shown;},getConf:function(){return conf;},getTip:function(){return tip;},getTrigger:function(){return trigger;}});$.each("onHide,onBeforeShow,onShow,onBeforeHide".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;};});}
$.fn.tooltip=function(conf){var api=this.data("tooltip");if(api){return api;}
conf=$.extend(true,{},$.tools.tooltip.conf,conf);if(typeof conf.position=='string'){conf.position=conf.position.split(/,?\s/);}
this.each(function(){api=new Tooltip($(this),conf);$(this).data("tooltip",api);});return conf.api?api:this;};})(jQuery);(function($){var t=$.tools.tooltip;t.dynamic={conf:{classNames:"top right bottom left"}};function getCropping(el){var w=$(window);var right=w.width()+w.scrollLeft();var bottom=w.height()+w.scrollTop();return[el.offset().top<=w.scrollTop(),right<=el.offset().left+el.width(),bottom<=el.offset().top+el.height(),w.scrollLeft()>=el.offset().left];}
function isVisible(crop){var i=crop.length;while(i--){if(crop[i]){return false;}}
return true;}
$.fn.dynamic=function(conf){if(typeof conf=='number'){conf={speed:conf};}
conf=$.extend({},t.dynamic.conf,conf);var cls=conf.classNames.split(/\s/),orig;this.each(function(){var api=$(this).tooltip().onBeforeShow(function(e,pos){var tip=this.getTip(),tipConf=this.getConf();if(!orig){orig=[tipConf.position[0],tipConf.position[1],tipConf.offset[0],tipConf.offset[1],$.extend({},tipConf)];}
$.extend(tipConf,orig[4]);tipConf.position=[orig[0],orig[1]];tipConf.offset=[orig[2],orig[3]];tip.css({visibility:'hidden',position:'absolute',top:pos.top,left:pos.left}).show();var crop=getCropping(tip);if(!isVisible(crop)){if(crop[2]){$.extend(tipConf,conf.top);tipConf.position[0]='top';tip.addClass(cls[0]);}
if(crop[3]){$.extend(tipConf,conf.right);tipConf.position[1]='right';tip.addClass(cls[1]);}
if(crop[0]){$.extend(tipConf,conf.bottom);tipConf.position[0]='bottom';tip.addClass(cls[2]);}
if(crop[1]){$.extend(tipConf,conf.left);tipConf.position[1]='left';tip.addClass(cls[3]);}
if(crop[0]||crop[2]){tipConf.offset[0]*=-1;}
if(crop[1]||crop[3]){tipConf.offset[1]*=-1;}}
tip.css({visibility:'visible'}).hide();});api.onBeforeShow(function(){var c=this.getConf(),tip=this.getTip();setTimeout(function(){c.position=[orig[0],orig[1]];c.offset=[orig[2],orig[3]];},0);});api.onHide(function(){var tip=this.getTip();tip.removeClass(conf.classNames);});ret=api;});return conf.api?ret:this;};})(jQuery);(function($){var t=$.tools.tooltip;$.extend(t.conf,{direction:'up',bounce:false,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!$.browser.msie});var dirs={up:['-','top'],down:['+','top'],left:['-','left'],right:['+','left']};t.addEffect("slide",function(done){var conf=this.getConf(),tip=this.getTip(),params=conf.slideFade?{opacity:conf.opacity}:{},dir=dirs[conf.direction]||dirs.up;params[dir[1]]=dir[0]+'='+conf.slideOffset;if(conf.slideFade){tip.css({opacity:0});}
tip.show().animate(params,conf.slideInSpeed,done);},function(done){var conf=this.getConf(),offset=conf.slideOffset,params=conf.slideFade?{opacity:0}:{},dir=dirs[conf.direction]||dirs.up;var sign=""+dir[0];if(conf.bounce){sign=sign=='+'?'-':'+';}
params[dir[1]]=sign+'='+offset;this.getTip().animate(params,conf.slideOutSpeed,function(){$(this).hide();done.call();});});})(jQuery);(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(){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);(function($){$.tools=$.tools||{version:'1.2.5'};$.tools.scrollable={conf:{activeClass:'active',circular:false,clonedClass:'cloned',disabledClass:'disabled',easing:'swing',initialIndex:0,item:null,items:'.items',keyboard:true,mousewheel:false,next:'.next',prev:'.prev',speed:400,vertical:false,touch:true,wheelSpeed:0}};function dim(el,key){var v=parseInt(el.css(key),10);if(v){return v;}
var s=el[0].currentStyle;return s&&s.width&&parseInt(s.width,10);}
function find(root,query){var el=$(query);return el.length<2?el:root.parent().find(query);}
var current;function Scrollable(root,conf){var self=this,fire=root.add(self),itemWrap=root.children(),index=0,vertical=conf.vertical;if(!current){current=self;}
if(itemWrap.length>1){itemWrap=$(conf.items,root);}
$.extend(self,{getConf:function(){return conf;},getIndex:function(){return index;},getSize:function(){return self.getItems().size();},getNaviButtons:function(){return prev.add(next);},getRoot:function(){return root;},getItemWrap:function(){return itemWrap;},getItems:function(){return itemWrap.children(conf.item).not("."+conf.clonedClass);},move:function(offset,time){return self.seekTo(index+offset,time);},next:function(time){return self.move(1,time);},prev:function(time){return self.move(-1,time);},begin:function(time){return self.seekTo(0,time);},end:function(time){return self.seekTo(self.getSize()-1,time);},focus:function(){current=self;return self;},addItem:function(item){item=$(item);if(!conf.circular){itemWrap.append(item);}else{itemWrap.children("."+conf.clonedClass+":last").before(item);itemWrap.children("."+conf.clonedClass+":first").replaceWith(item.clone().addClass(conf.clonedClass));}
fire.trigger("onAddItem",[item]);return self;},seekTo:function(i,time,fn){if(!i.jquery){i*=1;}
if(conf.circular&&i===0&&index==-1&&time!==0){return self;}
if(!conf.circular&&i<0||i>self.getSize()||i<-1){return self;}
var item=i;if(i.jquery){i=self.getItems().index(i);}else{item=self.getItems().eq(i);}
var e=$.Event("onBeforeSeek");if(!fn){fire.trigger(e,[i,time]);if(e.isDefaultPrevented()||!item.length){return self;}}
var props=vertical?{top:-item.position().top}:{left:-item.position().left};index=i;current=self;if(time===undefined){time=conf.speed;}
itemWrap.animate(props,time,conf.easing,fn||function(){fire.trigger("onSeek",[i]);});return self;}});$.each(['onBeforeSeek','onSeek','onAddItem'],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.circular){var cloned1=self.getItems().slice(-1).clone().prependTo(itemWrap),cloned2=self.getItems().eq(1).clone().appendTo(itemWrap);cloned1.add(cloned2).addClass(conf.clonedClass);self.onBeforeSeek(function(e,i,time){if(e.isDefaultPrevented()){return;}
if(i==-1){self.seekTo(cloned1,time,function(){self.end(0);});return e.preventDefault();}else if(i==self.getSize()){self.seekTo(cloned2,time,function(){self.begin(0);});}});self.seekTo(0,0,function(){});}
var prev=find(root,conf.prev).click(function(){self.prev();}),next=find(root,conf.next).click(function(){self.next();});if(!conf.circular&&self.getSize()>1){self.onBeforeSeek(function(e,i){setTimeout(function(){if(!e.isDefaultPrevented()){prev.toggleClass(conf.disabledClass,i<=0);next.toggleClass(conf.disabledClass,i>=self.getSize()-1);}},1);});if(!conf.initialIndex){prev.addClass(conf.disabledClass);}}
if(conf.mousewheel&&$.fn.mousewheel){root.mousewheel(function(e,delta){if(conf.mousewheel){self.move(delta<0?1:-1,conf.wheelSpeed||50);return false;}});}
if(conf.touch){var touch={};itemWrap[0].ontouchstart=function(e){var t=e.touches[0];touch.x=t.clientX;touch.y=t.clientY;};itemWrap[0].ontouchmove=function(e){if(e.touches.length==1&&!itemWrap.is(":animated")){var t=e.touches[0],deltaX=touch.x-t.clientX,deltaY=touch.y-t.clientY;self[vertical&&deltaY>0||!vertical&&deltaX>0?'next':'prev']();e.preventDefault();}};}
if(conf.keyboard){$(document).bind("keydown.scrollable",function(evt){if(!conf.keyboard||evt.altKey||evt.ctrlKey||$(evt.target).is(":input")){return;}
if(conf.keyboard!='static'&&current!=self){return;}
var key=evt.keyCode;if(vertical&&(key==38||key==40)){self.move(key==38?-1:1);return evt.preventDefault();}
if(!vertical&&(key==37||key==39)){self.move(key==37?-1:1);return evt.preventDefault();}});}
if(conf.initialIndex){self.seekTo(conf.initialIndex,0,function(){});}}
$.fn.scrollable=function(conf){var el=this.data("scrollable");if(el){return el;}
conf=$.extend({},$.tools.scrollable.conf,conf);this.each(function(){el=new Scrollable($(this),conf);$(this).data("scrollable",el);});return conf.api?el:this;};})(jQuery);(function($){var t=$.tools.scrollable;t.navigator={conf:{navi:'.navi',naviItem:null,activeClass:'active',indexed:false,idPrefix:null,history:false}};function find(root,query){var el=$(query);return el.length<2?el:root.parent().find(query);}
$.fn.navigator=function(conf){if(typeof conf=='string'){conf={navi:conf};}
conf=$.extend({},t.navigator.conf,conf);var ret;this.each(function(){var api=$(this).data("scrollable"),navi=conf.navi.jquery?conf.navi:find(api.getRoot(),conf.navi),buttons=api.getNaviButtons(),cls=conf.activeClass,history=conf.history&&$.fn.history;if(api){ret=api;}
api.getNaviButtons=function(){return buttons.add(navi);};function doClick(el,i,e){api.seekTo(i);if(history){if(location.hash){location.hash=el.attr("href").replace("#","");}}else{return e.preventDefault();}}
function els(){return navi.find(conf.naviItem||'> *');}
function addItem(i){var item=$("<"+(conf.naviItem||'a')+"/>").click(function(e){doClick($(this),i,e);}).attr("href","#"+i);if(i===0){item.addClass(cls);}
if(conf.indexed){item.text(i+1);}
if(conf.idPrefix){item.attr("id",conf.idPrefix+i);}
return item.appendTo(navi);}
if(els().length){els().each(function(i){$(this).click(function(e){doClick($(this),i,e);});});}else{$.each(api.getItems(),function(i){addItem(i);});}
api.onBeforeSeek(function(e,index){setTimeout(function(){if(!e.isDefaultPrevented()){var el=els().eq(index);if(!e.isDefaultPrevented()&&el.length){els().removeClass(cls).eq(index).addClass(cls);}}},1);});function doHistory(evt,hash){var el=els().eq(hash.replace("#",""));if(!el.length){el=els().filter("[href="+hash+"]");}
el.click();}
api.onAddItem(function(e,item){item=addItem(api.getItems().index(item));if(history){item.history(doHistory);}});if(history){els().history(doHistory);}});return conf.api?ret:this;};})(jQuery);(function($){var t=$.tools.scrollable;t.autoscroll={conf:{autoplay:true,interval:3000,autopause:true}};$.fn.autoscroll=function(conf){if(typeof conf=='number'){conf={interval:conf};}
var opts=$.extend({},t.autoscroll.conf,conf),ret;this.each(function(){var api=$(this).data("scrollable");if(api){ret=api;}
var timer,stopped=true;api.play=function(){if(timer){return;}
stopped=false;timer=setInterval(function(){api.next();},opts.interval);};api.pause=function(){timer=clearInterval(timer);};api.stop=function(){api.pause();stopped=true;};if(opts.autopause){api.getRoot().add(api.getNaviButtons()).hover(api.pause,api.play);}
if(opts.autoplay){api.play();}});return opts.api?ret:this;};})(jQuery);
