/*
 * jQuery Tools 1.2.3 - The missing UI library for the Web
 * 
 * [tabs, tooltip, overlay]
 * 
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 * 
 * http://flowplayer.org/tools/
 * 
 * File generated: Thu Jun 17 00:37:57 GMT 2010
 */
(function(c){function p(e,b,a){var d=this,l=e.add(this),h=e.find(a.tabs),i=b.jquery?b:e.children(b),j;h.length||(h=e.children());i.length||(i=e.parent().find(b));i.length||(i=c(b));c.extend(this,{click:function(f,g){var k=h.eq(f);if(typeof f=="string"&&f.replace("#","")){k=h.filter("[href*="+f.replace("#","")+"]");f=Math.max(h.index(k),0)}if(a.rotate){var n=h.length-1;if(f<0)return d.click(n,g);if(f>n)return d.click(0,g)}if(!k.length){if(j>=0)return d;f=a.initialIndex;k=h.eq(f)}if(f===j)return d;
g=g||c.Event();g.type="onBeforeClick";l.trigger(g,[f]);if(!g.isDefaultPrevented()){o[a.effect].call(d,f,function(){g.type="onClick";l.trigger(g,[f])});j=f;h.removeClass(a.current);k.addClass(a.current);return d}},getConf:function(){return a},getTabs:function(){return h},getPanes:function(){return i},getCurrentPane:function(){return i.eq(j)},getCurrentTab:function(){return h.eq(j)},getIndex:function(){return j},next:function(){return d.click(j+1)},prev:function(){return d.click(j-1)},destroy:function(){h.unbind(a.event).removeClass(a.current);
i.find("a[href^=#]").unbind("click.T");return d}});c.each("onBeforeClick,onClick".split(","),function(f,g){c.isFunction(a[g])&&c(d).bind(g,a[g]);d[g]=function(k){c(d).bind(g,k);return d}});if(a.history&&c.fn.history){c.tools.history.init(h);a.event="history"}h.each(function(f){c(this).bind(a.event,function(g){d.click(f,g);return g.preventDefault()})});i.find("a[href^=#]").bind("click.T",function(f){d.click(c(this).attr("href"),f)});if(location.hash)d.click(location.hash);else if(a.initialIndex===
0||a.initialIndex>0)d.click(a.initialIndex)}c.tools=c.tools||{version:"1.2.3"};c.tools.tabs={conf:{tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",initialIndex:0,event:"click",rotate:false,history:false},addEffect:function(e,b){o[e]=b}};var o={"default":function(e,b){this.getPanes().hide().eq(e).show();b.call()},fade:function(e,b){var a=this.getConf(),d=a.fadeOutSpeed,l=this.getPanes();d?l.fadeOut(d):l.hide();l.eq(e).fadeIn(a.fadeInSpeed,b)},slide:function(e,b){this.getPanes().slideUp(200);
this.getPanes().eq(e).slideDown(400,b)},ajax:function(e,b){this.getPanes().eq(0).load(this.getTabs().eq(e).attr("href"),b)}},m;c.tools.tabs.addEffect("horizontal",function(e,b){m||(m=this.getPanes().eq(0).width());this.getCurrentPane().animate({width:0},function(){c(this).hide()});this.getPanes().eq(e).animate({width:m},function(){c(this).show();b.call()})});c.fn.tabs=function(e,b){var a=this.data("tabs");if(a){a.destroy();this.removeData("tabs")}if(c.isFunction(b))b={onBeforeClick:b};b=c.extend({},
c.tools.tabs.conf,b);this.each(function(){a=new p(c(this),e,b);c(this).data("tabs",a)});return b.api?a:this}})(jQuery);
(function(f){function p(a,b,c){var h=c.relative?a.position().top:a.offset().top,e=c.relative?a.position().left:a.offset().left,i=c.position[0];h-=b.outerHeight()-c.offset[0];e+=a.outerWidth()+c.offset[1];var j=b.outerHeight()+a.outerHeight();if(i=="center")h+=j/2;if(i=="bottom")h+=j;i=c.position[1];a=b.outerWidth()+a.outerWidth();if(i=="center")e-=a/2;if(i=="left")e-=a;return{top:h,left:e}}function t(a,b){var c=this,h=a.add(c),e,i=0,j=0,m=a.attr("title"),q=n[b.effect],k,r=a.is(":input"),u=r&&a.is(":checkbox, :radio, select, :button, :submit"),
s=a.attr("type"),l=b.events[s]||b.events[r?u?"widget":"input":"def"];if(!q)throw'Nonexistent effect "'+b.effect+'"';l=l.split(/,\s*/);if(l.length!=2)throw"Tooltip: bad events configuration for "+s;a.bind(l[0],function(d){clearTimeout(i);if(b.predelay)j=setTimeout(function(){c.show(d)},b.predelay);else c.show(d)}).bind(l[1],function(d){clearTimeout(j);if(b.delay)i=setTimeout(function(){c.hide(d)},b.delay);else c.hide(d)});if(m&&b.cancelDefault){a.removeAttr("title");a.data("title",m)}f.extend(c,{show:function(d){if(!e){if(m)e=
f(b.layout).addClass(b.tipClass).appendTo(document.body).hide().append(m);else if(b.tip)e=f(b.tip).eq(0);else{e=a.next();e.length||(e=a.parent().next())}if(!e.length)throw"Cannot find tooltip for "+a;}if(c.isShown())return c;e.stop(true,true);var g=p(a,e,b);d=d||f.Event();d.type="onBeforeShow";h.trigger(d,[g]);if(d.isDefaultPrevented())return c;g=p(a,e,b);e.css({position:"absolute",top:g.top,left:g.left});k=true;q[0].call(c,function(){d.type="onShow";k="full";h.trigger(d)});g=b.events.tooltip.split(/,\s*/);
e.bind(g[0],function(){clearTimeout(i);clearTimeout(j)});g[1]&&!a.is("input:not(:checkbox, :radio), textarea")&&e.bind(g[1],function(o){o.relatedTarget!=a[0]&&a.trigger(l[1].split(" ")[0])});return c},hide:function(d){if(!e||!c.isShown())return c;d=d||f.Event();d.type="onBeforeHide";h.trigger(d);if(!d.isDefaultPrevented()){k=false;n[b.effect][1].call(c,function(){d.type="onHide";k=false;h.trigger(d)});return c}},isShown:function(d){return d?k=="full":k},getConf:function(){return b},getTip:function(){return e},
getTrigger:function(){return a}});f.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(d,g){f.isFunction(b[g])&&f(c).bind(g,b[g]);c[g]=function(o){f(c).bind(g,o);return c}})}f.tools=f.tools||{version:"1.2.3"};f.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(a,b,c){n[a]=[b,c]}};var n={toggle:[function(a){var b=this.getConf(),c=this.getTip();b=b.opacity;b<1&&c.css({opacity:b});c.show();a.call()},function(a){this.getTip().hide();a.call()}],fade:[function(a){var b=this.getConf();this.getTip().fadeTo(b.fadeInSpeed,b.opacity,a)},function(a){this.getTip().fadeOut(this.getConf().fadeOutSpeed,a)}]};f.fn.tooltip=function(a){var b=this.data("tooltip");if(b)return b;a=f.extend(true,{},f.tools.tooltip.conf,a);
if(typeof a.position=="string")a.position=a.position.split(/,?\s/);this.each(function(){b=new t(f(this),a);f(this).data("tooltip",b)});return a.api?b:this}})(jQuery);
(function(a){function t(d,b){var c=this,i=d.add(c),o=a(window),k,f,m,g=a.tools.expose&&(b.mask||b.expose),n=Math.random().toString().slice(10);if(g){if(typeof g=="string")g={color:g};g.closeOnClick=g.closeOnEsc=false}var p=b.target||d.attr("rel");f=p?a(p):d;if(!f.length)throw"Could not find Overlay: "+p;d&&d.index(f)==-1&&d.click(function(e){c.load(e);return e.preventDefault()});a.extend(c,{load:function(e){if(c.isOpened())return c;var h=q[b.effect];if(!h)throw'Overlay: cannot find effect : "'+b.effect+
'"';b.oneInstance&&a.each(s,function(){this.close(e)});e=e||a.Event();e.type="onBeforeLoad";i.trigger(e);if(e.isDefaultPrevented())return c;m=true;g&&a(f).expose(g);var j=b.top,r=b.left,u=f.outerWidth({margin:true}),v=f.outerHeight({margin:true});if(typeof j=="string")j=j=="center"?Math.max((o.height()-v)/2,0):parseInt(j,10)/100*o.height();if(r=="center")r=Math.max((o.width()-u)/2,0);h[0].call(c,{top:j,left:r},function(){if(m){e.type="onLoad";i.trigger(e)}});g&&b.closeOnClick&&a.mask.getMask().one("click",
c.close);b.closeOnClick&&a(document).bind("click."+n,function(l){a(l.target).parents(f).length||c.close(l)});b.closeOnEsc&&a(document).bind("keydown."+n,function(l){l.keyCode==27&&c.close(l)});return c},close:function(e){if(!c.isOpened())return c;e=e||a.Event();e.type="onBeforeClose";i.trigger(e);if(!e.isDefaultPrevented()){m=false;q[b.effect][1].call(c,function(){e.type="onClose";i.trigger(e)});a(document).unbind("click."+n).unbind("keydown."+n);g&&a.mask.close();return c}},getOverlay:function(){return f},
getTrigger:function(){return d},getClosers:function(){return k},isOpened:function(){return m},getConf:function(){return b}});a.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(e,h){a.isFunction(b[h])&&a(c).bind(h,b[h]);c[h]=function(j){a(c).bind(h,j);return c}});k=f.find(b.close||".close");if(!k.length&&!b.close){k=a('<a class="close"></a>');f.prepend(k)}k.click(function(e){c.close(e)});b.load&&c.load()}a.tools=a.tools||{version:"1.2.3"};a.tools.overlay={addEffect:function(d,
b,c){q[d]=[b,c]},conf:{close:null,closeOnClick:true,closeOnEsc:true,closeSpeed:"fast",effect:"default",fixed:!a.browser.msie||a.browser.version>6,left:"center",load:false,mask:null,oneInstance:true,speed:"normal",target:null,top:"10%"}};var s=[],q={};a.tools.overlay.addEffect("default",function(d,b){var c=this.getConf(),i=a(window);if(!c.fixed){d.top+=i.scrollTop();d.left+=i.scrollLeft()}d.position=c.fixed?"fixed":"absolute";this.getOverlay().css(d).fadeIn(c.speed,b)},function(d){this.getOverlay().fadeOut(this.getConf().closeSpeed,
d)});a.fn.overlay=function(d){var b=this.data("overlay");if(b)return b;if(a.isFunction(d))d={onBeforeLoad:d};d=a.extend(true,{},a.tools.overlay.conf,d);this.each(function(){b=new t(a(this),d);s.push(b);a(this).data("overlay",b)});return d.api?b:this}})

$.tools=$.tools||{version:'@VERSION'};var instances=[],tool,KEYS=[75,76,38,39,74,72,40,37],LABELS={};tool=$.tools.dateinput={conf:{format:'dd/mm/yyyy',selectors:false,yearRange:[-5,5],lang:'en',offset:[0,0],speed:0,firstDay:0,min:undefined,max:undefined,trigger:false,css:{prefix:'cal',input:'date',root:0,head:0,title:0,prev:0,next:0,month:0,year:0,days:0,body:0,weeks:0,today:0,current:0,week:0,off:0,sunday:0,focus:0,disabled:0,trigger:0}},localize:function(language,labels){$.each(labels,function(key,val){labels[key]=val.split(",");});LABELS[language]=labels;}};tool.localize("en",{months:'January,February,March,April,May,June,July,August,September,October,November,December',shortMonths:'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec',days:'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday',shortDays:'Sun,Mon,Tue,Wed,Thu,Fri,Sat'});function dayAm(year,month){return 32-new Date(year,month,32).getDate();}
function zeropad(val,len){val=''+val;len=len||2;while(val.length<len){val="0"+val;}
return val;}
var Re=/d{1,4}|m{1,4}|yy(?:yy)?|"[^"]*"|'[^']*'/g,tmpTag=$("<a/>");function format(date,fmt,lang){var d=date.getDate(),D=date.getDay(),m=date.getMonth(),y=date.getFullYear(),flags={d:d,dd:zeropad(d),ddd:LABELS[lang].shortDays[D],dddd:LABELS[lang].days[D],m:m+1,mm:zeropad(m+1),mmm:LABELS[lang].shortMonths[m],mmmm:LABELS[lang].months[m],yy:String(y).slice(2),yyyy:y};var ret=fmt.replace(Re,function($0){return $0 in flags?flags[$0]:$0.slice(1,$0.length-1);});return tmpTag.html(ret).html();}
function integer(val){return parseInt(val,10);}
function isSameDay(d1,d2){return d1.getFullYear()===d2.getFullYear()&&d1.getMonth()==d2.getMonth()&&d1.getDate()==d2.getDate();}
function parseDate(val){if(!val){return;}
if(val.constructor==Date){return val;}
if(typeof val=='string'){var els=val.split("-");if(els.length==3){return new Date(integer(els[0]),integer(els[1])-1,integer(els[2]));}
if(!/^-?\d+$/.test(val)){return;}
val=integer(val);}
var date=new Date();date.setDate(date.getDate()+val);return date;}
function Dateinput(input,conf){var self=this,now=new Date(),css=conf.css,labels=LABELS[conf.lang],root=$("#"+css.root),title=root.find("#"+css.title),trigger,pm,nm,currYear,currMonth,currDay,value=input.attr("data-value")||conf.value||input.val(),min=input.attr("min")||conf.min,max=input.attr("max")||conf.max,opened;if(min===0){min="0";}
value=parseDate(value)||now;min=parseDate(min||conf.yearRange[0]*365);max=parseDate(max||conf.yearRange[1]*365);if(!labels){throw"Dateinput: invalid language: "+conf.lang;}
if(input.attr("type")=='date'){var tmp=$("<input/>");$.each("class,disabled,id,maxlength,name,readonly,required,size,style,tabindex,title,value".split(","),function(i,attr){tmp.attr(attr,input.attr(attr));});input.replaceWith(tmp);input=tmp;}
input.addClass(css.input);var fire=input.add(self);if(!root.length){root=$('<div><div><a/><div/><a/></div><div><div/><div/></div></div>').hide().css({position:'absolute'}).attr("id",css.root);root.children().eq(0).attr("id",css.head).end().eq(1).attr("id",css.body).children().eq(0).attr("id",css.days).end().eq(1).attr("id",css.weeks).end().end().end().find("a").eq(0).attr("id",css.prev).end().eq(1).attr("id",css.next);title=root.find("#"+css.head).find("div").attr("id",css.title);if(conf.selectors){var monthSelector=$("<select/>").attr("id",css.month),yearSelector=$("<select/>").attr("id",css.year);title.html(monthSelector.add(yearSelector));}
var days=root.find("#"+css.days);for(var d=0;d<7;d++){days.append($("<span/>").text(labels.shortDays[(d+conf.firstDay)%7]));}
$("body").append(root);}
if(conf.trigger){trigger=$("<a/>").attr("href","#").addClass(css.trigger).click(function(e){self.show();return e.preventDefault();}).insertAfter(input);}
var weeks=root.find("#"+css.weeks);yearSelector=root.find("#"+css.year);monthSelector=root.find("#"+css.month);function select(date,conf,e){value=date;currYear=date.getFullYear();currMonth=date.getMonth();currDay=date.getDate();e=e||$.Event("api");e.type="change";fire.trigger(e,[date]);if(e.isDefaultPrevented()){return;}
input.val(format(date,conf.format,conf.lang));input.data("date",date);self.hide(e);}
function onShow(ev){ev.type="onShow";fire.trigger(ev);$(document).bind("keydown.d",function(e){if(e.ctrlKey){return true;}
var key=e.keyCode;if(key==8){input.val("");return self.hide(e);}
if(key==27){return self.hide(e);}
if($(KEYS).index(key)>=0){if(!opened){self.show(e);return e.preventDefault();}
var days=$("#"+css.weeks+" a"),el=$("."+css.focus),index=days.index(el);el.removeClass(css.focus);if(key==74||key==40){index+=7;}
else if(key==75||key==38){index-=7;}
else if(key==76||key==39){index+=1;}
else if(key==72||key==37){index-=1;}
if(index>41){self.addMonth();el=$("#"+css.weeks+" a:eq("+(index-42)+")");}else if(index<0){self.addMonth(-1);el=$("#"+css.weeks+" a:eq("+(index+42)+")");}else{el=days.eq(index);}
el.addClass(css.focus);return e.preventDefault();}
if(key==34){return self.addMonth();}
if(key==33){return self.addMonth(-1);}
if(key==36){return self.today();}
if(key==13){if(!$(e.target).is("select")){$("."+css.focus).click();}}
return $([16,17,18,9]).index(key)>=0;});$(document).bind("click.d",function(e){var el=e.target;if(!$(el).parents("#"+css.root).length&&el!=input[0]&&(!trigger||el!=trigger[0])){self.hide(e);}});}
$.extend(self,{show:function(e){if(input.attr("readonly")||input.attr("disabled")||opened){return;}
e=e||$.Event();e.type="onBeforeShow";fire.trigger(e);if(e.isDefaultPrevented()){return;}
$.each(instances,function(){this.hide();});opened=true;monthSelector.unbind("change").change(function(){self.setValue(yearSelector.val(),$(this).val());});yearSelector.unbind("change").change(function(){self.setValue($(this).val(),monthSelector.val());});pm=root.find("#"+css.prev).unbind("click").click(function(e){if(!pm.hasClass(css.disabled)){self.addMonth(-1);}
return false;});nm=root.find("#"+css.next).unbind("click").click(function(e){if(!nm.hasClass(css.disabled)){self.addMonth();}
return false;});self.setValue(value);var pos=input.offset();if(/iPad/i.test(navigator.userAgent)){pos.top-=$(window).scrollTop();}
root.css({top:pos.top+input.outerHeight({margins:true})+conf.offset[0],left:pos.left+conf.offset[1]});if(conf.speed){root.show(conf.speed,function(){onShow(e);});}else{root.show();onShow(e);}
return self;},setValue:function(year,month,day){var date=integer(month)>=-1?new Date(integer(year),integer(month),integer(day||1)):year||value;if(date<min){date=min;}
else if(date>max){date=max;}
year=date.getFullYear();month=date.getMonth();day=date.getDate();if(month==-1){month=11;year--;}else if(month==12){month=0;year++;}
if(!opened){select(date,conf);return self;}
currMonth=month;currYear=year;var tmp=new Date(year,month,1-conf.firstDay),begin=tmp.getDay(),days=dayAm(year,month),prevDays=dayAm(year,month-1),week;if(conf.selectors){monthSelector.empty();$.each(labels.months,function(i,m){if(min<new Date(year,i+1,-1)&&max>new Date(year,i,0)){monthSelector.append($("<option/>").html(m).attr("value",i));}});yearSelector.empty();var yearNow=now.getFullYear();for(var i=yearNow+conf.yearRange[0];i<yearNow+conf.yearRange[1];i++){if(min<=new Date(i+1,-1,1)&&max>new Date(i,0,0)){yearSelector.append($("<option/>").text(i));}}
monthSelector.val(month);yearSelector.val(year);}else{title.html(labels.months[month]+" "+year);}
weeks.empty();pm.add(nm).removeClass(css.disabled);for(var j=!begin?-7:0,a,num;j<(!begin?35:42);j++){a=$("<a/>");if(j%7===0){week=$("<div/>").addClass(css.week);weeks.append(week);}
if(j<begin){a.addClass(css.off);num=prevDays-begin+j+1;date=new Date(year,month-1,num);}else if(j>=begin+days){a.addClass(css.off);num=j-days-begin+1;date=new Date(year,month+1,num);}else{num=j-begin+1;date=new Date(year,month,num);if(isSameDay(value,date)){a.attr("id",css.current).addClass(css.focus);}else if(isSameDay(now,date)){a.attr("id",css.today);}}
if(min&&date<min){a.add(pm).addClass(css.disabled);}
if(max&&date>max){a.add(nm).addClass(css.disabled);}
a.attr("href","#"+num).text(num).data("date",date);week.append(a);}
weeks.find("a").click(function(e){var el=$(this);if(!el.hasClass(css.disabled)){$("#"+css.current).removeAttr("id");el.attr("id",css.current);select(el.data("date"),conf,e);}
return false;});if(css.sunday){weeks.find(css.week).each(function(){var beg=conf.firstDay?7-conf.firstDay:0;$(this).children().slice(beg,beg+1).addClass(css.sunday);});}
return self;},setMin:function(val,fit){min=parseDate(val);if(fit&&value<min){self.setValue(min);}
return self;},setMax:function(val,fit){max=parseDate(val);if(fit&&value>max){self.setValue(max);}
return self;},today:function(){return self.setValue(now);},addDay:function(amount){return this.setValue(currYear,currMonth,currDay+(amount||1));},addMonth:function(amount){return this.setValue(currYear,currMonth+(amount||1),currDay);},addYear:function(amount){return this.setValue(currYear+(amount||1),currMonth,currDay);},hide:function(e){if(opened){e=$.Event();e.type="onHide";fire.trigger(e);$(document).unbind("click.d").unbind("keydown.d");if(e.isDefaultPrevented()){return;}
root.hide();opened=false;}
return self;},getConf:function(){return conf;},getInput:function(){return input;},getCalendar:function(){return root;},getValue:function(dateFormat){return dateFormat?format(value,dateFormat,conf.lang):value;},isOpen:function(){return opened;}});$.each(['onBeforeShow','onShow','change','onHide'],function(i,name){if($.isFunction(conf[name])){$(self).bind(name,conf[name]);}
self[name]=function(fn){if(fn){$(self).bind(name,fn);}
return self;};});input.bind("focus click",self.show).keydown(function(e){var key=e.keyCode;if(!opened&&$(KEYS).index(key)>=0){self.show(e);return e.preventDefault();}
return e.shiftKey||e.ctrlKey||e.altKey||key==9?true:e.preventDefault();});if(parseDate(input.val())){select(value,conf);}}
$.expr[':'].date=function(el){var type=el.getAttribute("type");return type&&type=='date'||!!$(el).data("dateinput");};$.fn.dateinput=function(conf){if(this.data("dateinput")){return this;}
conf=$.extend(true,{},tool.conf,conf);$.each(conf.css,function(key,val){if(!val&&key!='prefix'){conf.css[key]=(conf.css.prefix||'')+(val||key);}});var els;this.each(function(){var el=new Dateinput($(this),conf);instances.push(el);var input=el.getInput().data("dateinput",el);els=els?els.add(input):input;});return els?els:this;};

(jQuery);
