/*
 * jquery.tools 1.0.2 - The missing UI library
 * 
 * [tools.tabs-1.0.1, tools.tooltip-1.0.2, tools.scrollable-1.0.5, tools.overlay-1.0.4, tools.expose-1.0.3]
 * 
 * Copyright (c) 2009 Tero Piirainen
 * http://flowplayer.org/tools/
 *
 * Dual licensed under MIT and GPL 2+ licenses
 * http://www.opensource.org/licenses
 * 
 * -----
 * 
 * Build: Fri Jun 12 12:37:07 GMT+00:00 2009
 */
(function(a){function c(c,d,e){function h(b,c){return a(f).bind(b,function(a,b){c&&c.call(this,b.index)===!1&&b&&(b.proceed=!1)}),f}var f=this,g;a.each(e,function(b,c){a.isFunction(c)&&h(b,c)}),a.extend(this,{click:function(d){if(d===g)return f;var h=f.getCurrentPane(),i=c.eq(d);typeof d=="string"&&(i=c.filter("[href="+d+"]"),d=c.index(i));if(!i.length){if(g>=0)return f;d=e.initialIndex,i=c.eq(d)}var j={index:d,proceed:!0};return a(f).triggerHandler("onBeforeClick",j),j.proceed?(i.addClass(e.current),b[e.effect].call(f,d),a(f).triggerHandler("onClick",j),c.removeClass(e.current),i.addClass(e.current),g=d,f):f},getConf:function(){return e},getTabs:function(){return c},getPanes:function(){return d},getCurrentPane:function(){return d.eq(g)},getCurrentTab:function(){return c.eq(g)},getIndex:function(){return g},next:function(){return f.click(g+1)},prev:function(){return f.click(g-1)},onBeforeClick:function(a){return h("onBeforeClick",a)},onClick:function(a){return h("onClick",a)}}),c.each(function(b){a(this).bind(e.event,function(a){f.click(b);if(!e.history)return a.preventDefault()})}),e.history&&c.history(function(a,b){f.click(b||0)}),location.hash?f.click(location.hash):f.click(e.initialIndex),d.find("a[href^=#]").click(function(){f.click(a(this).attr("href"))})}a.tools=a.tools||{version:{}},a.tools.version.tabs="1.0.1",a.tools.addTabEffect=function(a,c){b[a]=c};var b={"default":function(a){this.getPanes().hide().eq(a).show()},fade:function(a){this.getPanes().hide().eq(a).fadeIn(this.getConf().fadeInSpeed)},slide:function(a){this.getCurrentPane().slideUp("fast"),this.getPanes().eq(a).slideDown()},horizontal:function(b){a._hW||(a._hW=this.getPanes().eq(0).width()),this.getCurrentPane().animate({width:0},function(){a(this).hide()}),this.getPanes().eq(b).animate({width:a._hW},function(){a(this).show()})}};a.fn.tabs=function(b,d){var e=this.eq(typeof conf=="number"?conf:0).data("tabs");if(e)return e;var f={tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",history:!1,initialIndex:0,event:"click",api:!1};return a.isFunction(d)&&(d={onBeforeClick:d}),a.extend(f,d),this.each(function(){var d=a(this).find(f.tabs);d.length||(d=a(this).children());var h=b.jquery?b:a(b);e=new c(d,h,f),a(this).data("tabs",e)}),f.api?e:this}})(jQuery),function(a){var b,c;a.prototype.history=function(d){var e=this;return a.browser.msie?(c||(c=a("<iframe />").hide().get(0),a("body").append(c),setInterval(function(){var d=c.contentWindow.document,e=d.location.hash;b!==e&&(a.event.trigger("hash",e),b=e)},100)),e.bind("click.hash",function(b){var d=c.contentWindow.document;d.open().close(),d.location.hash=a(this).attr("href")}),e.eq(0).triggerHandler("click.hash")):setInterval(function(){var c=location.hash;e.filter("[href*="+c+"]").length&&c!==b&&(b=c,a.event.trigger("hash",c))},100),a(window).bind("hash",d),this}}(jQuery),function(a){function c(c,d){function g(b,c){return a(e).bind(b,function(a,b){c&&c.call(this)===!1&&b&&(b.proceed=!1)}),e}var e=this,f=c.next();d.tip&&(d.tip.indexOf("#")!=-1?f=a(d.tip):(f=c.nextAll(d.tip).eq(0),f.length||(f=c.parent().nextAll(d.tip).eq(0)))),a.each(d,function(b,c){a.isFunction(c)&&g(b,c)});var h=c.is("input, textarea");c.bind(h?"focus":"mouseover",function(a){a.target=this,e.show(a),f.hover(function(){e.show()},function(){e.hide()})}),c.bind(h?"blur":"mouseout",function(){e.hide()}),f.css("opacity",d.opacity);var i=0;a.extend(e,{show:function(g){g&&(c=a(g.target)),clearTimeout(i);if(f.is(":animated")||f.is(":visible"))return e;var h={proceed:!0};a(e).trigger("onBeforeShow",h);if(!h.proceed)return e;var j=c.position().top-f.outerHeight(),k=f.outerHeight()+c.outerHeight(),l=d.position[0];l=="center"&&(j+=k/2),l=="bottom"&&(j+=k);var m=c.outerWidth()+f.outerWidth(),n=c.position().left+c.outerWidth();return l=d.position[1],l=="center"&&(n-=m/2),l=="left"&&(n-=m),j+=d.offset[0],n+=d.offset[1],f.css({position:"absolute",top:j,left:n}),b[d.effect][0].call(e),a(e).trigger("onShow"),e},hide:function(){return clearTimeout(i),i=setTimeout(function(){if(!f.is(":visible"))return e;var c={proceed:!0};a(e).trigger("onBeforeHide",c);if(!c.proceed)return e;b[d.effect][1].call(e),a(e).trigger("onHide")},d.delay||1),e},isShown:function(){return f.is(":visible, :animated")},getConf:function(){return d},getTip:function(){return f},getTrigger:function(){return c},onBeforeShow:function(a){return g("onBeforeShow",a)},onShow:function(a){return g("onShow",a)},onBeforeHide:function(a){return g("onBeforeHide",a)},onHide:function(a){return g("onHide",a)}})}a.tools=a.tools||{version:{}},a.tools.version.tooltip="1.0.2";var b={toggle:[function(){this.getTip().show()},function(){this.getTip().hide()}],fade:[function(){this.getTip().fadeIn(this.getConf().fadeInSpeed)},function(){this.getTip().fadeOut(this.getConf().fadeOutSpeed)}]};a.tools.addTipEffect=function(a,c,d){b[a]=[c,d]},a.tools.addTipEffect("slideup",function(){var a=this.getConf(),b=a.slideOffset||10;this.getTip().css({opacity:0}).animate({top:"-="+b,opacity:a.opacity},a.slideInSpeed||200).show()},function(){var b=this.getConf(),c=b.slideOffset||10;this.getTip().animate({top:"-="+c,opacity:0},b.slideOutSpeed||200,function(){a(this).hide().animate({top:"+="+c*2},0)})}),a.prototype.tooltip=function(b){var d=this.eq(typeof b=="number"?b:0).data("tooltip");if(d)return d;var e={tip:null,effect:"slideup",delay:30,opacity:1,position:["top","center"],offset:[0,0],api:!1};return a.isFunction(b)&&(b={onBeforeShow:b}),a.extend(e,b),this.each(function(){d=new c(a(this),e),a(this).data("tooltip",d)}),e.api?d:this}}(jQuery),function(a){function c(c,d){function f(b,c){return a(e).bind(b,function(a,b){c&&c.call(this,b.index)===!1&&b&&(b.proceed=!1)}),e}function j(b,c){return b.indexOf("#")!=-1?a(b).eq(0):c.siblings(b).eq(0)}function p(){if(k.is(":empty")||k.data("me")==e){k.empty(),k.data("me",e);for(var b=0;b<e.getPageAmount();b++){var c=a("<"+d.naviItem+"/>").attr("href",b).click(function(b){var c=a(this);return c.parent().children().removeClass(d.activeClass),c.addClass(d.activeClass),e.setPage(c.attr("href")),b.preventDefault()});b===0&&c.addClass(d.activeClass),k.append(c)}}else{var f=k.children();f.each(function(b){var c=a(this);c.attr("href",b),b===0&&c.addClass(d.activeClass),c.click(function(){k.find("."+d.activeClass).removeClass(d.activeClass),c.addClass(d.activeClass),e.setPage(c.attr("href"))})})}return d.clickable&&e.getItems().each(function(b,c){var d=a(this);d.data("set")||(d.bind("click.scrollable",function(){e.click(b)}),d.data("set",!0))}),d.hoverClass&&e.getItems().hover(function(){a(this).addClass(d.hoverClass)},function(){a(this).removeClass(d.hoverClass)}),e}function r(){if(q)return;q=setInterval(function(){if(d.interval===0){clearInterval(q),q=0;return}e.next()},d.interval)}var e=this;b||(b=e),a.each(d,function(b,c){a.isFunction(c)&&f(b,c)});var g=!d.vertical,h=a(d.items,c),i=0,k=j(d.navi,c),l=j(d.prev,c),m=j(d.next,c),n=j(d.prevPage,c),o=j(d.nextPage,c);a.extend(e,{getIndex:function(){return i},getConf:function(){return d},getSize:function(){return e.getItems().size()},getPageAmount:function(){return Math.ceil(this.getSize()/d.size)},getPageIndex:function(){return Math.ceil(i/d.size)},getRoot:function(){return c},getItemWrap:function(){return h},getItems:function(){return h.children()},getVisibleItems:function(){return e.getItems().slice(i,i+d.size)},seekTo:function(c,f,j){f===undefined&&(f=d.speed),a.isFunction(f)&&(j=f,f=d.speed),c<0&&(c=0);if(c>e.getSize()-d.size)return e;var p=e.getItems().eq(c);if(!p.length)return e;var q={index:c,proceed:!0};a(e).trigger("onBeforeSeek",q);if(!q.proceed)return e;if(g){var r=-p.position().left;h.animate({left:r},f,d.easing,j?function(){j.call(e)}:null)}else{var t=-p.position().top;h.animate({top:t},f,d.easing,j?function(){j.call(e)}:null)}if(k.length){var u=d.activeClass,v=Math.ceil(c/d.size);v=Math.min(v,k.children().length-1),k.children().removeClass(u).eq(v).addClass(u)}return c===0?l.add(n).addClass(d.disabledClass):l.add(n).removeClass(d.disabledClass),c>=e.getSize()-d.size?m.add(o).addClass(d.disabledClass):m.add(o).removeClass(d.disabledClass),b=e,i=c,a(e).trigger("onSeek",{index:c}),e},move:function(a,b,c){var f=i+a;return d.loop&&f>e.getSize()-d.size&&(f=0),this.seekTo(f,b,c)},next:function(a,b){return this.move(1,a,b)},prev:function(a,b){return this.move(-1,a,b)},movePage:function(a,b,c){return this.move(d.size*a,b,c)},setPage:function(a,b,c){var e=d.size,f=e*a,g=f+e>=this.getSize();return g&&(f=this.getSize()-d.size),this.seekTo(f,b,c)},prevPage:function(a,b){return this.setPage(this.getPageIndex()-1,a,b)},nextPage:function(a,b){return this.setPage(this.getPageIndex()+1,a,b)},begin:function(a,b){return this.seekTo(0,a,b)},end:function(a,b){return this.seekTo(this.getSize()-d.size,a,b)},reload:function(){return p()},click:function(a,b,c){var f=e.getItems().eq(a),g=d.activeClass;if(a<0||a>=this.getSize())return e;if(d.size==2)return a==e.getIndex()&&a--,e.getItems().removeClass(g),f.addClass(g),this.seekTo(a,b,c);if(!f.hasClass(g)){e.getItems().removeClass(g),f.addClass(g);var h=Math.floor(d.size/2),i=a-h;i>e.getSize()-d.size&&(i=e.getSize()-d.size);if(i!==a)return this.seekTo(i,b,c)}return e},onBeforeSeek:function(a){return f("onBeforeSeek",a)},onSeek:function(a){return f("onSeek",a)}}),a.isFunction(a.fn.mousewheel)&&c.bind("mousewheel.scrollable",function(b,c){var d=a.browser.opera?1:-1;return e.move(c>0?d:-d,50),!1}),l.addClass(d.disabledClass).click(function(){e.prev()}),m.click(function(){e.next()}),o.click(function(){e.nextPage()}),n.addClass(d.disabledClass).click(function(){e.prevPage()}),d.keyboard&&a(document).unbind("keydown.scrollable").bind("keydown.scrollable",function(a){var c=b;if(!c||a.altKey||a.ctrlKey)return;return!g||a.keyCode!=37&&a.keyCode!=39?!!g||a.keyCode!=38&&a.keyCode!=40?!0:(c.move(a.keyCode==38?-1:1),a.preventDefault()):(c.move(a.keyCode==37?-1:1),a.preventDefault())}),p();var q=null;d.interval>0&&(c.hover(function(){clearInterval(q),q=0},function(){r()}),r())}a.tools=a.tools||{version:{}},a.tools.version.scrollable="1.0.5";var b=null;a.fn.scrollable=function(b){var d=this.eq(typeof b=="number"?b:0).data("scrollable");if(d)return d;var e={size:5,vertical:!1,clickable:!0,loop:!1,interval:0,speed:400,keyboard:!0,activeClass:"active",disabledClass:"disabled",hoverClass:null,easing:"swing",items:".items",prev:".prev",next:".next",prevPage:".prevPage",nextPage:".nextPage",navi:".navi",naviItem:"a",api:!1,onBeforeSeek:null,onSeek:null};return a.extend(e,b),this.each(function(){d=new c(a(this),e),a(this).data("scrollable",d)}),e.api?d:this}}(jQuery),function(a){function c(c,d){function o(b,c){return a(e).bind(b,function(a,b){c&&c.call(this)===!1&&b&&(b.proceed=!1)}),e}var e=this,f=a(window),g,h,i,j,k,l,m,n=d.expose&&a.tools.version.expose;a.each(d,function(b,c){a.isFunction(c)&&o(b,c)});var p=d.target||c.attr("rel"),q=p?a(p):null;q?k=c:q=c,f.load(function(){l=q.attr("overlay");if(!l){l=q.css("backgroundImage");if(!l)throw"background-image CSS property not set for overlay element: "+p;l=l.substring(l.indexOf("(")+1,l.indexOf(")")).replace(/\"/g,""),q.css("backgroundImage","none"),q.attr("overlay",l)}i=q.outerWidth({margin:!0}),j=q.outerHeight({margin:!0}),h=a('<img src="'+l+'"/>'),h.css({border:0,position:"absolute",display:"none"}).width(i).attr("overlay",!0),a("body").append(h),k&&k.bind("click.overlay",function(a){return e.load(a.pageY-f.scrollTop(),a.pageX-f.scrollLeft()),a.preventDefault()}),d.close=d.close||".close",q.find(d.close).length||q.prepend('<div class="close"></div>'),g=q.find(d.close),g.bind("click.overlay",function(){e.close()}),d.preload&&setTimeout(function(){var a=new Image;a.src=l},2e3)}),a.extend(e,{load:function(c,k){if(!h)return f.load(function(){e.load(c,k)}),e;if(e.isOpened())return e;d.oneInstance&&a.each(b,function(){this.close()});var l={proceed:!0};a(e).trigger("onBeforeLoad",l);if(!l.proceed)return e;n&&(h.expose(d.expose),m=h.expose().load()),c=c||d.start.top,k=k||d.start.left;var o=d.finish.top,p=d.finish.left;return o=="center"&&(o=Math.max((f.height()-j)/2,0)),p=="center"&&(p=Math.max((f.width()-i)/2,0)),d.start.absolute||(c+=f.scrollTop(),k+=f.scrollLeft()),d.finish.absolute||(o+=f.scrollTop(),p+=f.scrollLeft()),h.css({top:c,left:k,width:d.start.width,zIndex:d.zIndex}).show(),h.animate({top:o,left:p,width:i},d.speed,function(){q.css({position:"absolute",top:o,left:p});var b=h.css("zIndex");g.add(q).css("zIndex",++b),q.fadeIn(d.fadeInSpeed,function(){a(e).trigger("onLoad")})}),e},close:function(){if(!e.isOpened())return e;var b={proceed:!0};a(e).trigger("onBeforeClose",b);if(!b.proceed)return e;m&&m.close();if(h.is(":visible")){q.hide();var c=d.start.top,f=d.start.left;k&&(b=k.offset(),c=b.top+k.height()/2,f=b.left+k.width()/2),h.animate({top:c,left:f,width:0},d.closeSpeed,function(){a(e).trigger("onClose",b)})}return e},getBackgroundImage:function(){return h},getContent:function(){return q},getTrigger:function(){return k},isOpened:function(){return q.is(":visible")},getConf:function(){return d},onBeforeLoad:function(a){return o("onBeforeLoad",a)},onLoad:function(a){return o("onLoad",a)},onBeforeClose:function(a){return o("onBeforeClose",a)},onClose:function(a){return o("onClose",a)}}),a(document).keydown(function(a){a.keyCode==27&&e.close()}),d.closeOnClick&&a(document).bind("click.overlay",function(b){if(!q.is(":visible, :animated"))return;var c=a(b.target);if(c.attr("overlay"))return;if(c.parents("[overlay]").length)return;e.close()})}a.tools=a.tools||{version:{}},a.tools.version.overlay="1.0.4";var b=[];a.fn.overlay=function(d){var e=this.eq(typeof d=="number"?d:0).data("overlay");if(e)return e;var f=a(window),g={start:{top:Math.round(f.height()/2),left:Math.round(f.width()/2),width:0,absolute:!1},finish:{top:80,left:"center",absolute:!1},speed:"normal",fadeInSpeed:"fast",closeSpeed:"fast",close:null,oneInstance:!0,closeOnClick:!0,preload:!0,zIndex:9999,api:!1,expose:null,target:null};return a.isFunction(d)&&(d={onBeforeLoad:d}),a.extend(!0,g,d),this.each(function(){e=new c(a(this),g),b.push(e),a(this).data("overlay",e)}),g.api?e:this}}(jQuery),function(a){function b(){var b=a(window).width();if(a.browser.mozilla)return b;var c;return window.innerHeight&&window.scrollMaxY?c=window.innerWidth+window.scrollMaxX:document.body.scrollHeight>document.body.offsetHeight?c=document.body.scrollWidth:c=document.body.offsetWidth,c<b?c+20:b}function c(c,d){function i(b,c){return a(e).bind(b,function(a,b){c&&c.call(this)===!1&&b&&(b.proceed=!1)}),e}var e=this,f=null,g=!1,h=0;a.each(d,function(b,c){a.isFunction(c)&&i(b,c)}),a(window).bind("resize.expose",function(){f&&f.css({width:b(),height:a(document).height()})}),a.extend(this,{getMask:function(){return f},getExposed:function(){return c},getConf:function(){return d},isLoaded:function(){return g},load:function(){if(g)return e;h=c.eq(0).css("zIndex"),d.maskId&&(f=a("#"+d.maskId));if(!f||!f.length){f=a("<div/>").css({position:"absolute",top:0,left:0,width:b(),height:a(document).height(),display:"none",opacity:0,zIndex:d.zIndex}),d.maskId&&f.attr("id",d.maskId),a("body").append(f);var i=f.css("backgroundColor");(!i||i=="transparent"||i=="rgba(0, 0, 0, 0)")&&f.css("backgroundColor",d.color),d.closeOnEsc&&a(document).bind("keydown.unexpose",function(a){a.keyCode==27&&e.close()}),d.closeOnClick&&f.bind("click.unexpose",function(){e.close()})}var j={proceed:!0};a(e).trigger("onBeforeLoad",j);if(!j.proceed)return e;a.each(c,function(){var b=a(this);/relative|absolute|fixed/i.test(b.css("position"))||b.css("position","relative")}),c.css({zIndex:d.zIndex+1});var k=f.height();return this.isLoaded()||f.css({opacity:0,display:"block"}).fadeTo(d.loadSpeed,d.opacity,function(){f.height()!=k&&f.css("height",k),a(e).trigger("onLoad")}),g=!0,e},close:function(){if(!g)return e;var b={proceed:!0};return a(e).trigger("onBeforeClose",b),b.proceed===!1?e:(f.fadeOut(d.closeSpeed,function(){a(e).trigger("onClose"),c.css({zIndex:a.browser.msie?h:null})}),g=!1,e)},onBeforeLoad:function(a){return i("onBeforeLoad",a)},onLoad:function(a){return i("onLoad",a)},onBeforeClose:function(a){return i("onBeforeClose",a)},onClose:function(a){return i("onClose",a)}})}a.tools=a.tools||{version:{}},a.tools.version.expose="1.0.3",a.fn.expose=function(b){var d=this.eq(typeof b=="number"?b:0).data("expose");if(d)return d;var e={maskId:null,loadSpeed:"slow",closeSpeed:"fast",closeOnClick:!0,closeOnEsc:!0,zIndex:9998,opacity:.8,color:"#456",api:!1};return typeof b=="string"&&(b={color:b}),a.extend(e,b),this.each(function(){d=new c(a(this),e),a(this).data("expose",d)}),e.api?d:this}}(jQuery)
