/* Italian initialisation for the jQuery UI date picker plugin. */
/* Written by Apaella (apaella@gmail.com). */
jQuery(function(a){a.datepicker.regional.it={clearText:"Svuota",clearStatus:"Annulla",closeText:"Chiudi",closeStatus:"Chiudere senza modificare",prevText:"&#x3c;Prec",prevStatus:"Mese precedente",prevBigText:"&#x3c;&#x3c;",prevBigStatus:"Mostra l'anno precedente",nextText:"Succ&#x3e;",nextStatus:"Mese successivo",nextBigText:"&#x3e;&#x3e;",nextBigStatus:"Mostra l'anno successivo",currentText:"Oggi",currentStatus:"Mese corrente",monthNames:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio", "Agosto","Settembre","Ottobre","Novembre","Dicembre"],monthNamesShort:["Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic"],monthStatus:"Seleziona un altro mese",yearStatus:"Seleziona un altro anno",weekHeader:"Sm",weekStatus:"Settimana dell'anno",dayNames:["Domenica","Luned&#236","Marted&#236","Mercoled&#236","Gioved&#236","Venerd&#236","Sabato"],dayNamesShort:["Dom","Lun","Mar","Mer","Gio","Ven","Sab"],dayNamesMin:["Do","Lu","Ma","Me","Gio","Ve","Sa"],dayStatus:"Usa DD come primo giorno della settimana", dateStatus:"'Seleziona' D, M d",dateFormat:"dd/mm/yy",firstDay:1,initStatus:"Scegliere una data",isRTL:false};a.datepicker.setDefaults(a.datepicker.regional.it)});

/*
 * jQuery Cycle Plugin (core)
 * Examples and documentation at: http://jquery.malsup.com/cycle/
 * Copyright (c) 2007-2010 M. Alsup
 * Version: 2.80 (05-MAR-2010)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Requires: jQuery v1.2.6 or later
 */
(function(e){function u(a){e.fn.cycle.debug&&k(a)}function k(){window.console&&window.console.log&&window.console.log("[cycle] "+Array.prototype.join.call(arguments," "))}function z(a,b,d){if(a.cycleStop==undefined)a.cycleStop=0;if(b===undefined||b===null)b={};if(b.constructor==String){switch(b){case "destroy":case "stop":d=e(a).data("cycle.opts");if(!d)return false;a.cycleStop++;a.cycleTimeout&&clearTimeout(a.cycleTimeout);a.cycleTimeout=0;e(a).removeData("cycle.opts");b=="destroy"&&A(d);return false;case "toggle":a.cyclePause=a.cyclePause===1?0:1;return false;case "pause":a.cyclePause=1;return false;case "resume":a.cyclePause=0;if(d===true){b=e(a).data("cycle.opts");if(!b){k("options not found, can not resume");return false}if(a.cycleTimeout){clearTimeout(a.cycleTimeout);a.cycleTimeout=0}n(b.elements,b,1,1)}return false;case "prev":case "next":d=e(a).data("cycle.opts");if(!d){k('options not found, "prev/next" ignored');return false}e.fn.cycle[b](d);return false;default:b={fx:b}}return b}else if(b.constructor== Number){var f=b;b=e(a).data("cycle.opts");if(!b){k("options not found, can not advance slide");return false}if(f<0||f>=b.elements.length){k("invalid slide index: "+f);return false}b.nextSlide=f;if(a.cycleTimeout){clearTimeout(a.cycleTimeout);a.cycleTimeout=0}if(typeof d=="string")b.oneTimeFx=d;n(b.elements,b,1,f>=b.currSlide);return false}return b}function v(a,b){if(!e.support.opacity&&b.cleartype&&a.style.filter)try{a.style.removeAttribute("filter")}catch(d){}}function A(a){a.next&&e(a.next).unbind(a.prevNextEvent);a.prev&&e(a.prev).unbind(a.prevNextEvent);if(a.pager||a.pagerAnchorBuilder)e.each(a.pagerAnchors||[],function(){this.unbind().remove()});a.pagerAnchors=null;a.destroy&&a.destroy(a)}function B(a,b,d,f,g){var c=e.extend({},e.fn.cycle.defaults,f||{},e.metadata?a.metadata():e.meta?a.data():{});if(c.autostop)c.countdown=c.autostopCount||d.length;var h=a[0];a.data("cycle.opts",c);c.$cont=a;c.stopCount=h.cycleStop;c.elements=d;c.before=c.before?[c.before]:[];c.after=c.after?[c.after]:[];c.after.unshift(function(){c.busy= 0});!e.support.opacity&&c.cleartype&&c.after.push(function(){v(this,c)});c.continuous&&c.after.push(function(){n(d,c,0,!c.rev)});C(c);!e.support.opacity&&c.cleartype&&!c.cleartypeNoBg&&w(b);a.css("position")=="static"&&a.css("position","relative");c.width&&a.width(c.width);c.height&&c.height!="auto"&&a.height(c.height);if(c.startingSlide)c.startingSlide=parseInt(c.startingSlide);if(c.random){c.randomMap=[];for(h=0;h<d.length;h++)c.randomMap.push(h);c.randomMap.sort(function(){return Math.random()- 0.5});c.randomIndex=1;c.startingSlide=c.randomMap[1]}else if(c.startingSlide>=d.length)c.startingSlide=0;c.currSlide=c.startingSlide||0;var i=c.startingSlide;b.css({position:"absolute",top:0,left:0}).hide().each(function(j){j=i?j>=i?d.length-(j-i):i-j:d.length-j;e(this).css("z-index",j)});e(d[i]).css("opacity",1).show();v(d[i],c);c.fit&&c.width&&b.width(c.width);c.fit&&c.height&&c.height!="auto"&&b.height(c.height);if(c.containerResize&&!a.innerHeight()){for(var l=h=0,m=0;m<d.length;m++){var o=e(d[m]), q=o[0],r=o.outerWidth(),s=o.outerHeight();r||(r=q.offsetWidth||q.width||o.attr("width"));s||(s=q.offsetHeight||q.height||o.attr("height"));h=r>h?r:h;l=s>l?s:l}h>0&&l>0&&a.css({width:h+"px",height:l+"px"})}c.pause&&a.hover(function(){this.cyclePause++},function(){this.cyclePause--});if(D(c)===false)return false;var x=false;f.requeueAttempts=f.requeueAttempts||0;b.each(function(){var j=e(this);this.cycleH=c.fit&&c.height?c.height:j.height()||this.offsetHeight||this.height||j.attr("height")||0;this.cycleW= c.fit&&c.width?c.width:j.width()||this.offsetWidth||this.width||j.attr("width")||0;if(j.is("img")){j=e.browser.mozilla&&this.cycleW==34&&this.cycleH==19&&!this.complete;var E=e.browser.opera&&(this.cycleW==42&&this.cycleH==19||this.cycleW==37&&this.cycleH==17)&&!this.complete,F=this.cycleH==0&&this.cycleW==0&&!this.complete;if(e.browser.msie&&this.cycleW==28&&this.cycleH==30&&!this.complete||j||E||F)if(g.s&&c.requeueOnImageNotLoaded&&++f.requeueAttempts<100){k(f.requeueAttempts," - img slide not loaded, requeuing slideshow: ", this.src,this.cycleW,this.cycleH);setTimeout(function(){e(g.s,g.c).cycle(f)},c.requeueTimeout);x=true;return false}else k("could not determine size of image: "+this.src,this.cycleW,this.cycleH)}return true});if(x)return false;c.cssBefore=c.cssBefore||{};c.animIn=c.animIn||{};c.animOut=c.animOut||{};b.not(":eq("+i+")").css(c.cssBefore);c.cssFirst&&e(b[i]).css(c.cssFirst);if(c.timeout){c.timeout=parseInt(c.timeout);if(c.speed.constructor==String)c.speed=e.fx.speeds[c.speed]||parseInt(c.speed);for(c.sync|| (c.speed/=2);c.timeout-c.speed<250;)c.timeout+=c.speed}if(c.easing)c.easeIn=c.easeOut=c.easing;if(!c.speedIn)c.speedIn=c.speed;if(!c.speedOut)c.speedOut=c.speed;c.slideCount=d.length;c.currSlide=c.lastSlide=i;if(c.random){if(++c.randomIndex==d.length)c.randomIndex=0;c.nextSlide=c.randomMap[c.randomIndex]}else c.nextSlide=c.startingSlide>=d.length-1?0:c.startingSlide+1;if(!c.multiFx){h=e.fn.cycle.transitions[c.fx];if(e.isFunction(h))h(a,b,c);else if(c.fx!="custom"&&!c.multiFx){k("unknown transition: "+ c.fx,"; slideshow terminating");return false}}a=b[i];c.before.length&&c.before[0].apply(a,[a,a,c,true]);c.after.length>1&&c.after[1].apply(a,[a,a,c,true]);c.next&&e(c.next).bind(c.prevNextEvent,function(){return t(c,c.rev?-1:1)});c.prev&&e(c.prev).bind(c.prevNextEvent,function(){return t(c,c.rev?1:-1)});if(c.pager||c.pagerAnchorBuilder)G(d,c);H(c,d);return c}function C(a){a.original={before:[],after:[]};a.original.cssBefore=e.extend({},a.cssBefore);a.original.cssAfter=e.extend({},a.cssAfter);a.original.animIn= e.extend({},a.animIn);a.original.animOut=e.extend({},a.animOut);e.each(a.before,function(){a.original.before.push(this)});e.each(a.after,function(){a.original.after.push(this)})}function D(a){var b,d,f=e.fn.cycle.transitions;if(a.fx.indexOf(",")>0){a.multiFx=true;a.fxs=a.fx.replace(/\s*/g,"").split(",");for(b=0;b<a.fxs.length;b++){var g=a.fxs[b];d=f[g];if(!d||!f.hasOwnProperty(g)||!e.isFunction(d)){k("discarding unknown transition: ",g);a.fxs.splice(b,1);b--}}if(!a.fxs.length){k("No valid transitions named; slideshow terminating.");return false}}else if(a.fx=="all"){a.multiFx=true;a.fxs=[];for(p in f){d=f[p];f.hasOwnProperty(p)&&e.isFunction(d)&&a.fxs.push(p)}}if(a.multiFx&&a.randomizeEffects){d=Math.floor(Math.random()*20)+30;for(b=0;b<d;b++){f=Math.floor(Math.random()*a.fxs.length);a.fxs.push(a.fxs.splice(f,1)[0])}u("randomized fx sequence: ",a.fxs)}return true}function H(a,b){a.addSlide=function(d,f){d=e(d);var g=d[0];a.autostopCount||a.countdown++;b[f?"unshift":"push"](g);if(a.els)a.els[f?"unshift":"push"](g);a.slideCount= b.length;d.css("position","absolute");d[f?"prependTo":"appendTo"](a.$cont);if(f){a.currSlide++;a.nextSlide++}!e.support.opacity&&a.cleartype&&!a.cleartypeNoBg&&w(d);a.fit&&a.width&&d.width(a.width);a.fit&&a.height&&a.height!="auto"&&$slides.height(a.height);g.cycleH=a.fit&&a.height?a.height:d.height();g.cycleW=a.fit&&a.width?a.width:d.width();d.css(a.cssBefore);if(a.pager||a.pagerAnchorBuilder)e.fn.cycle.createPagerAnchor(b.length-1,g,e(a.pager),b,a);e.isFunction(a.onAddSlide)?a.onAddSlide(d):d.hide()}}function n(a,b,d,f){if(d&&b.busy&&b.manualTrump){e(a).stop(true,true);b.busy=false}if(!b.busy){var g=b.$cont[0],c=a[b.currSlide],h=a[b.nextSlide];if(!(g.cycleStop!=b.stopCount||g.cycleTimeout===0&&!d))if(!d&&!g.cyclePause&&(b.autostop&&--b.countdown<=0||b.nowrap&&!b.random&&b.nextSlide<b.currSlide))b.end&&b.end(b);else{if((d||!g.cyclePause)&&b.nextSlide!=b.currSlide){var i=b.fx;c.cycleH=c.cycleH||e(c).height();c.cycleW=c.cycleW||e(c).width();h.cycleH=h.cycleH||e(h).height();h.cycleW=h.cycleW||e(h).width();if(b.multiFx){if(b.lastFx==undefined||++b.lastFx>=b.fxs.length)b.lastFx=0;i=b.fxs[b.lastFx];b.currFx=i}if(b.oneTimeFx){i=b.oneTimeFx;b.oneTimeFx=null}e.fn.cycle.resetState(b,i);b.before.length&&e.each(b.before,function(l,m){g.cycleStop==b.stopCount&&m.apply(h,[c,h,b,f])});i=function(){e.each(b.after,function(l,m){g.cycleStop==b.stopCount&&m.apply(h,[c,h,b,f])})};b.busy=1;if(b.fxFn)b.fxFn(c,h,b,i,f);else e.isFunction(e.fn.cycle[b.fx])?e.fn.cycle[b.fx](c,h,b,i):e.fn.cycle.custom(c,h,b,i,d&&b.fastOnEvent);b.lastSlide=b.currSlide;if(b.random){b.currSlide=b.nextSlide;if(++b.randomIndex==a.length)b.randomIndex=0;b.nextSlide=b.randomMap[b.randomIndex]}else{d=b.nextSlide+1==a.length;b.nextSlide=d?0:b.nextSlide+1;b.currSlide=d?a.length-1:b.nextSlide-1}b.pager&&b.updateActivePagerLink(b.pager,b.currSlide,b.activePagerClass)}d=0;if(b.timeout&&!b.continuous)d=y(c,h,b,f);else if(b.continuous&&g.cyclePause)d=10;if(d>0)g.cycleTimeout=setTimeout(function(){n(a,b,0,!b.rev)},d)}}}function y(a,b,d,f){if(d.timeoutFn){for(a= d.timeoutFn(a,b,d,f);a-d.speed<250;)a+=d.speed;u("calculated timeout: "+a+"; speed: "+d.speed);if(a!==false)return a}return d.timeout}function t(a,b){var d=a.elements,f=a.$cont[0],g=f.cycleTimeout;if(g){clearTimeout(g);f.cycleTimeout=0}if(a.random&&b<0){a.randomIndex--;if(--a.randomIndex==-2)a.randomIndex=d.length-2;else if(a.randomIndex==-1)a.randomIndex=d.length-1;a.nextSlide=a.randomMap[a.randomIndex]}else if(a.random)a.nextSlide=a.randomMap[a.randomIndex];else{a.nextSlide=a.currSlide+b;if(a.nextSlide< 0){if(a.nowrap)return false;a.nextSlide=d.length-1}else if(a.nextSlide>=d.length){if(a.nowrap)return false;a.nextSlide=0}}e.isFunction(a.prevNextClick)&&a.prevNextClick(b>0,a.nextSlide,d[a.nextSlide]);n(d,a,1,b>=0);return false}function G(a,b){var d=e(b.pager);e.each(a,function(f,g){e.fn.cycle.createPagerAnchor(f,g,d,a,b)});b.updateActivePagerLink(b.pager,b.startingSlide,b.activePagerClass)}function w(a){function b(f){f=parseInt(f).toString(16);return f.length<2?"0"+f:f}function d(f){for(;f&&f.nodeName.toLowerCase()!= "html";f=f.parentNode){var g=e.css(f,"background-color");if(g.indexOf("rgb")>=0){f=g.match(/\d+/g);return"#"+b(f[0])+b(f[1])+b(f[2])}if(g&&g!="transparent")return g}return"#ffffff"}a.each(function(){e(this).css("background-color",d(this))})}if(e.support==undefined)e.support={opacity:!e.browser.msie};e.fn.cycle=function(a,b){var d={s:this.selector,c:this.context};if(this.length===0&&a!="stop"){if(!e.isReady&&d.s){k("DOM not ready, queuing slideshow");e(function(){e(d.s,d.c).cycle(a,b)});return this}k("terminating; zero elements found by selector"+ (e.isReady?"":" (DOM not ready)"));return this}return this.each(function(){var f=z(this,a,b);if(f!==false){f.updateActivePagerLink=f.updateActivePagerLink||e.fn.cycle.updateActivePagerLink;this.cycleTimeout&&clearTimeout(this.cycleTimeout);this.cycleTimeout=this.cyclePause=0;var g=e(this),c=f.slideExpr?e(f.slideExpr,this):g.children(),h=c.get();if(h.length<2)k("terminating; too few slides: "+h.length);else{var i=B(g,c,h,f,d);if(i!==false)if(f=i.continuous?10:y(i.currSlide,i.nextSlide,i,!i.rev)){f+= i.delay||0;if(f<10)f=10;u("first timeout: "+f);this.cycleTimeout=setTimeout(function(){n(h,i,0,!i.rev)},f)}}}})};e.fn.cycle.resetState=function(a,b){b=b||a.fx;a.before=[];a.after=[];a.cssBefore=e.extend({},a.original.cssBefore);a.cssAfter=e.extend({},a.original.cssAfter);a.animIn=e.extend({},a.original.animIn);a.animOut=e.extend({},a.original.animOut);a.fxFn=null;e.each(a.original.before,function(){a.before.push(this)});e.each(a.original.after,function(){a.after.push(this)});b=e.fn.cycle.transitions[b];e.isFunction(b)&&b(a.$cont,e(a.elements),a)};e.fn.cycle.updateActivePagerLink=function(a,b,d){e(a).each(function(){e(this).find("a").removeClass(d).filter("a:eq("+b+")").addClass(d)})};e.fn.cycle.next=function(a){t(a,a.rev?-1:1)};e.fn.cycle.prev=function(a){t(a,a.rev?1:-1)};e.fn.cycle.createPagerAnchor=function(a,b,d,f,g){if(b=e.isFunction(g.pagerAnchorBuilder)?g.pagerAnchorBuilder(a,b):'<a href="#">'+(a+1)+"</a>"){var c=e(b);if(c.parents("body").length===0){var h=[];if(d.length>1){d.each(function(){var i= c.clone(true);e(this).append(i);h.push(i[0])});c=e(h)}else c.appendTo(d)}g.pagerAnchors=g.pagerAnchors||[];g.pagerAnchors.push(c);c.bind(g.pagerEvent,function(i){i.preventDefault();g.nextSlide=a;i=g.$cont[0];var l=i.cycleTimeout;if(l){clearTimeout(l);i.cycleTimeout=0}e.isFunction(g.pagerClick)&&g.pagerClick(g.nextSlide,f[g.nextSlide]);n(f,g,1,g.currSlide<a)});!/^click/.test(g.pagerEvent)&&!g.allowPagerClickBubble&&c.bind("click.cycle",function(){return false});g.pauseOnPagerHover&&c.hover(function(){g.$cont[0].cyclePause++}, function(){g.$cont[0].cyclePause--})}};e.fn.cycle.hopsFromLast=function(a,b){var d=a.lastSlide,f=a.currSlide;return b?f>d?f-d:a.slideCount-d:f<d?d-f:d+a.slideCount-f};e.fn.cycle.commonReset=function(a,b,d,f,g,c){e(d.elements).not(a).hide();d.cssBefore.opacity=1;d.cssBefore.display="block";if(f!==false&&b.cycleW>0)d.cssBefore.width=b.cycleW;if(g!==false&&b.cycleH>0)d.cssBefore.height=b.cycleH;d.cssAfter=d.cssAfter||{};d.cssAfter.display="none";e(a).css("zIndex",d.slideCount+(c===true?1:0));e(b).css("zIndex", d.slideCount+(c===true?0:1))};e.fn.cycle.custom=function(a,b,d,f,g){var c=e(a),h=e(b),i=d.speedIn;a=d.speedOut;var l=d.easeIn;b=d.easeOut;h.css(d.cssBefore);if(g){i=typeof g=="number"?(a=g):(a=1);l=b=null}var m=function(){h.animate(d.animIn,i,l,f)};c.animate(d.animOut,a,b,function(){d.cssAfter&&c.css(d.cssAfter);d.sync||m()});d.sync&&m()};e.fn.cycle.transitions={fade:function(a,b,d){b.not(":eq("+d.currSlide+")").css("opacity",0);d.before.push(function(f,g,c){e.fn.cycle.commonReset(f,g,c);c.cssBefore.opacity= 0});d.animIn={opacity:1};d.animOut={opacity:0};d.cssBefore={top:0,left:0}}};e.fn.cycle.ver=function(){return"2.80"};e.fn.cycle.defaults={fx:"fade",timeout:4E3,timeoutFn:null,continuous:0,speed:1E3,speedIn:null,speedOut:null,next:null,prev:null,prevNextClick:null,prevNextEvent:"click.cycle",pager:null,pagerClick:null,pagerEvent:"click.cycle",allowPagerClickBubble:false,pagerAnchorBuilder:null,before:null,after:null,end:null,easing:null,easeIn:null,easeOut:null,shuffle:null,animIn:null,animOut:null, cssBefore:null,cssAfter:null,fxFn:null,height:"auto",startingSlide:0,sync:1,random:0,fit:0,containerResize:1,pause:0,pauseOnPagerHover:0,autostop:0,autostopCount:0,delay:0,slideExpr:null,cleartype:!e.support.opacity,cleartypeNoBg:false,nowrap:0,fastOnEvent:0,randomizeEffects:1,rev:0,manualTrump:true,requeueOnImageNotLoaded:true,requeueTimeout:250,activePagerClass:"activeSlide",updateActivePagerLink:null}})(jQuery);

/*
 * jQuery Carousel Lite Plugin (core)
 */
(function($){$.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},o||{});return this.each(function(){var b=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var c=$(this),ul=$("ul",c),tLi=$("li",ul),tl=tLi.size(),v=o.visible;if(o.circular){ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());o.start+=v}var f=$("li",ul),itemLength=f.size(),curr=o.start;c.css("visibility","visible");f.css({overflow:"hidden",float:o.vertical?"none":"left"});ul.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});c.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var g=o.vertical?height(f):width(f);var h=g*itemLength;var j=g*v;f.css({width:f.width(),height:f.height()});ul.css(sizeCss,h+"px").css(animCss,-(curr*g));c.css(sizeCss,j+"px");if(o.btnPrev)$(o.btnPrev).click(function(){return go(curr-o.scroll)});if(o.btnNext)$(o.btnNext).click(function(){return go(curr+o.scroll)});if(o.btnGo)$.each(o.btnGo,function(i,a){$(a).click(function(){return go(o.circular?o.visible+i:i)})});if(o.mouseWheel&&c.mousewheel)c.mousewheel(function(e,d){return d>0?go(curr-o.scroll):go(curr+o.scroll)});if(o.auto)setInterval(function(){go(curr+o.scroll)},o.auto+o.speed);function vis(){return f.slice(curr).slice(0,v)};function go(a){if(!b){if(o.beforeStart)o.beforeStart.call(this,vis());if(o.circular){if(a<=o.start-v-1){ul.css(animCss,-((itemLength-(v*2))*g)+"px");curr=a==o.start-v-1?itemLength-(v*2)-1:itemLength-(v*2)-o.scroll}else if(a>=itemLength-v+1){ul.css(animCss,-((v)*g)+"px");curr=a==itemLength-v+1?v+1:v+o.scroll}else curr=a}else{if(a<0||a>itemLength-v)return;else curr=a}b=true;ul.animate(animCss=="left"?{left:-(curr*g)}:{top:-(curr*g)},o.speed,o.easing,function(){if(o.afterEnd)o.afterEnd.call(this,vis());b=false});if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled")}}return false}})};function css(a,b){return parseInt($.css(a[0],b))||0};function width(a){return a[0].offsetWidth+css(a,'marginLeft')+css(a,'marginRight')};function height(a){return a[0].offsetHeight+css(a,'marginTop')+css(a,'marginBottom')}})(jQuery);

/*
 * ColorBox v1.3.6 - a full featured, light-weight, customizable lightbox based on jQuery 1.3
 */
(function(c){function r(b,d){d=d==="x"?m.width():m.height();return typeof b==="string"?Math.round(b.match(/%/)?d/100*parseInt(b,10):parseInt(b,10)):b}function M(b){b=c.isFunction(b)?b.call(i):b;return a.photo||b.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i)}function Y(){for(var b in a)if(c.isFunction(a[b])&&b.substring(0,2)!=="on")a[b]=a[b].call(i);a.rel=a.rel||i.rel;a.href=a.href||i.href;a.title=a.title||i.title}function Z(b){i=b;a=c(i).data(q);Y();if(a.rel&&a.rel!=="nofollow"){g= c(".cboxElement").filter(function(){return(c(this).data(q).rel||this.rel)===a.rel});j=g.index(i);if(j<0){g=g.add(i);j=g.length-1}}else{g=c(i);j=0}if(!B){C=B=n;N=i;N.blur();c(document).bind("keydown.cbox_close",function(d){if(d.keyCode===27){d.preventDefault();e.close()}}).bind("keydown.cbox_arrows",function(d){if(g.length>1)if(d.keyCode===37){d.preventDefault();D.click()}else if(d.keyCode===39){d.preventDefault();E.click()}});a.overlayClose&&s.css({cursor:"pointer"}).one("click",e.close);c.event.trigger(aa);a.onOpen&&a.onOpen.call(i);s.css({opacity:a.opacity}).show();a.w=r(a.initialWidth,"x");a.h=r(a.initialHeight,"y");e.position(0);O&&m.bind("resize.cboxie6 scroll.cboxie6",function(){s.css({width:m.width(),height:m.height(),top:m.scrollTop(),left:m.scrollLeft()})}).trigger("scroll.cboxie6")}P.add(D).add(E).add(t).add(Q).hide();R.html(a.close).show();e.slideshow();e.load()}var q="colorbox",F="hover",n=true,e,x=!c.support.opacity,O=x&&!window.XMLHttpRequest,aa="cbox_open",H="cbox_load",S="cbox_complete", T="resize.cbox_resize",s,k,u,p,U,V,W,X,g,m,l,I,J,K,Q,P,t,E,D,R,y,z,v,w,i,N,j,a,B,C,$={transition:"elastic",speed:350,width:false,height:false,innerWidth:false,innerHeight:false,initialWidth:"400",initialHeight:"400",maxWidth:false,maxHeight:false,scalePhotos:n,scrolling:n,inline:false,html:false,iframe:false,photo:false,href:false,title:false,rel:false,opacity:0.9,preloading:n,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:false,overlayClose:n,slideshow:false, slideshowAuto:n,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:false,onLoad:false,onComplete:false,onCleanup:false,onClosed:false};e=c.fn.colorbox=function(b,d){var h=this;if(!h.length)if(h.selector===""){h=c("<a/>");b.open=n}else return this;h.each(function(){var f=c.extend({},c(this).data(q)?c(this).data(q):$,b);c(this).data(q,f).addClass("cboxElement");if(d)c(this).data(q).onComplete=d});b&&b.open&&Z(h);return this};e.init=function(){function b(d){return c('<div id="cbox'+ d+'"/>')}m=c(window);k=c('<div id="colorbox"/>');s=b("Overlay").hide();u=b("Wrapper");p=b("Content").append(l=b("LoadedContent").css({width:0,height:0}),J=b("LoadingOverlay"),K=b("LoadingGraphic"),Q=b("Title"),P=b("Current"),t=b("Slideshow"),E=b("Next"),D=b("Previous"),R=b("Close"));u.append(c("<div/>").append(b("TopLeft"),U=b("TopCenter"),b("TopRight")),c("<div/>").append(V=b("MiddleLeft"),p,W=b("MiddleRight")),c("<div/>").append(b("BottomLeft"),X=b("BottomCenter"),b("BottomRight"))).children().children().css({"float":"left"});I=c("<div style='position:absolute; top:0; left:0; width:9999px; height:0;'/>");c("body").prepend(s,k.append(u,I));if(x){k.addClass("cboxIE");O&&s.css("position","absolute")}p.children().bind("mouseover mouseout",function(){c(this).toggleClass(F)}).addClass(F);y=U.height()+X.height()+p.outerHeight(n)-p.height();z=V.width()+W.width()+p.outerWidth(n)-p.width();v=l.outerHeight(n);w=l.outerWidth(n);k.css({"padding-bottom":y,"padding-right":z}).hide();E.click(e.next);D.click(e.prev);R.click(e.close);p.children().removeClass(F);c(".cboxElement").live("click",function(d){if(d.button!==0&&typeof d.button!=="undefined")return n;else{Z(this);return false}})};e.position=function(b,d){function h(A){U[0].style.width=X[0].style.width=p[0].style.width=A.style.width;K[0].style.height=J[0].style.height=p[0].style.height=V[0].style.height=W[0].style.height=A.style.height}var f=m.height();f=Math.max(f-a.h-v-y,0)/2+m.scrollTop();var o=Math.max(document.documentElement.clientWidth-a.w-w-z,0)/2+m.scrollLeft();b=k.width()===a.w+w&&k.height()=== a.h+v?0:b;u[0].style.width=u[0].style.height="9999px";k.dequeue().animate({width:a.w+w,height:a.h+v,top:f,left:o},{duration:b,complete:function(){h(this);C=false;u[0].style.width=a.w+w+z+"px";u[0].style.height=a.h+v+y+"px";d&&d()},step:function(){h(this)}})};e.resize=function(b){function d(){a.w=a.w||l.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}function h(){a.h=a.h||l.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}function f(G){e.position(G,function(){if(B){if(x){A&&l.fadeIn(100);k[0].style.removeAttribute("filter")}if(a.iframe)l.append("<iframe id='cboxIframe'"+ (a.scrolling?" ":"scrolling='no'")+" name='iframe_"+(new Date).getTime()+"' frameborder=0 src='"+a.href+"' "+(x?"allowtransparency='true'":"")+" />");l.show();Q.show().html(a.title);if(g.length>1){P.html(a.current.replace(/\{current\}/,j+1).replace(/\{total\}/,g.length)).show();E.html(a.next).show();D.html(a.previous).show();a.slideshow&&t.show()}J.hide();K.hide();c.event.trigger(S);a.onComplete&&a.onComplete.call(i);a.transition==="fade"&&k.fadeTo(L,1,function(){x&&k[0].style.removeAttribute("filter")});m.bind(T,function(){e.position(0)})}})}if(B){var o,A,L=a.transition==="none"?0:a.speed;m.unbind(T);if(b){l.remove();l=c('<div id="cboxLoadedContent"/>').html(b);l.hide().appendTo(I).css({width:d(),overflow:a.scrolling?"auto":"hidden"}).css({height:h()}).prependTo(p);c("#cboxPhoto").css({cssFloat:"none"});O&&c("select:not(#colorbox select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("cbox_cleanup",function(){this.style.visibility="inherit"});a.transition=== "fade"&&k.fadeTo(L,0,function(){f(0)})||f(L);if(a.preloading&&g.length>1){b=j>0?g[j-1]:g[g.length-1];o=j<g.length-1?g[j+1]:g[0];o=c(o).data(q).href||o.href;b=c(b).data(q).href||b.href;M(o)&&c("<img />").attr("src",o);M(b)&&c("<img />").attr("src",b)}}else setTimeout(function(){var G=l.wrapInner("<div style='overflow:auto'></div>").children();a.h=G.height();l.css({height:a.h});G.replaceWith(G.children());e.position(L)},1)}};e.load=function(){var b,d,h,f=e.resize;C=n;i=g[j];a=c(i).data(q);Y();c.event.trigger(H);a.onLoad&&a.onLoad.call(i);a.h=a.height?r(a.height,"y")-v-y:a.innerHeight?r(a.innerHeight,"y"):false;a.w=a.width?r(a.width,"x")-w-z:a.innerWidth?r(a.innerWidth,"x"):false;a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=r(a.maxWidth,"x")-w-z;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=r(a.maxHeight,"y")-v-y;a.mh=a.h&&a.h<a.mh?a.h:a.mh}b=a.href;J.show();K.show();if(a.inline){c('<div id="cboxInlineTemp" />').hide().insertBefore(c(b)[0]).bind(H+" cbox_cleanup",function(){c(this).replaceWith(l.children())});f(c(b))}else if(a.iframe)f(" ");else if(a.html)f(a.html);else if(M(b)){d=new Image;d.onload=function(){var o;d.onload=null;d.id="cboxPhoto";c(d).css({margin:"auto",border:"none",display:"block",cssFloat:"left"});if(a.scalePhotos){h=function(){d.height-=d.height*o;d.width-=d.width*o};if(a.mw&&d.width>a.mw){o=(d.width-a.mw)/d.width;h()}if(a.mh&&d.height>a.mh){o=(d.height-a.mh)/d.height;h()}}if(a.h)d.style.marginTop=Math.max(a.h-d.height,0)/2+"px";f(d);g.length>1&&c(d).css({cursor:"pointer"}).click(e.next);if(x)d.style.msInterpolationMode="bicubic"};d.src=b}else c("<div />").appendTo(I).load(b,function(o,A){A==="success"?f(this):f(c("<p>Request unsuccessful.</p>"))})};e.next=function(){if(!C){j=j<g.length-1?j+1:0;e.load()}};e.prev=function(){if(!C){j=j>0?j-1:g.length-1;e.load()}};e.slideshow=function(){function b(){t.text(a.slideshowStop).bind(S,function(){h=setTimeout(e.next,a.slideshowSpeed)}).bind(H,function(){clearTimeout(h)}).one("click",function(){d();c(this).removeClass(F)});k.removeClass(f+ "off").addClass(f+"on")}var d,h,f="cboxSlideshow_";t.bind("cbox_closed",function(){t.unbind();clearTimeout(h);k.removeClass(f+"off "+f+"on")});d=function(){clearTimeout(h);t.text(a.slideshowStart).unbind(S+" "+H).one("click",function(){b();h=setTimeout(e.next,a.slideshowSpeed);c(this).removeClass(F)});k.removeClass(f+"on").addClass(f+"off")};if(a.slideshow&&g.length>1)a.slideshowAuto?b():d()};e.close=function(){c.event.trigger("cbox_cleanup");a.onCleanup&&a.onCleanup.call(i);B=false;c(document).unbind("keydown.cbox_close keydown.cbox_arrows");m.unbind(T+" resize.cboxie6 scroll.cboxie6");s.css({cursor:"auto"}).fadeOut("fast");k.stop(n,false).fadeOut("fast",function(){c("#colorbox iframe").attr("src","about:blank");l.remove();k.css({opacity:1});try{N.focus()}catch(b){}c.event.trigger("cbox_closed");a.onClosed&&a.onClosed.call(i)})};e.element=function(){return c(i)};e.settings=$;c(e.init)})(jQuery);

/*!
* jquery.qtip. The jQuery tooltip plugin
*
* Copyright (c) 2009 Craig Thompson
* http://craigsworks.com
*
* Licensed under MIT
* http://www.opensource.org/licenses/mit-license.php
*
* Launch  : February 2009
* Version : 1.0.0-rc3
* Released: Tuesday 12th May, 2009 - 00:00
* Debug: jquery.qtip.debug.js
*/
(function(c){function x(b){if(!b)return false;this.x=String(b).replace(/middle/i,"center").match(/left|right|center/i)[0].toLowerCase();this.y=String(b).replace(/middle/i,"center").match(/top|bottom|center/i)[0].toLowerCase();this.offset={left:0,top:0};this.precedance=b.charAt(0).search(/^(t|b)/)>-1?"y":"x";this.string=function(){return this.precedance==="y"?this.y+this.x:this.x+this.y}}function D(b,e,f){e={bottomright:[[0,0],[e,f],[e,0]],bottomleft:[[0,0],[e,0],[0,f]],topright:[[0,f],[e,0],[e,f]], topleft:[[0,0],[0,f],[e,f]],topcenter:[[0,f],[e/2,0],[e,f]],bottomcenter:[[0,0],[e,0],[e/2,f]],rightcenter:[[0,0],[e,f/2],[0,f]],leftcenter:[[e,0],[e,f],[0,f/2]]};e.lefttop=e.bottomright;e.righttop=e.bottomleft;e.leftbottom=e.topright;e.rightbottom=e.topleft;return e[b]}function E(b){var e;if(c("<canvas />").get(0).getContext)e={topLeft:[b,b],topRight:[0,b],bottomLeft:[b,0],bottomRight:[0,0]};else if(c.browser.msie)e={topLeft:[-90,90,0],topRight:[-90,90,-b],bottomLeft:[90,270,0],bottomRight:[90,270, -b]};return e}function y(b,e){var f,a;f=c.extend(true,{},b);for(a in f)if(e===true&&/(tip|classes)/i.test(a))delete f[a];else!e&&/(width|border|tip|title|classes|user)/i.test(a)&&delete f[a];return f}function F(b){if(typeof b.tip!=="object")b.tip={corner:b.tip};if(typeof b.tip.size!=="object")b.tip.size={width:b.tip.size,height:b.tip.size};if(typeof b.border!=="object")b.border={width:b.border};if(typeof b.width!=="object")b.width={value:b.width};if(typeof b.width.max==="string")b.width.max=parseInt(b.width.max.replace(/([0-9]+)/i, "$1"),10);if(typeof b.width.min==="string")b.width.min=parseInt(b.width.min.replace(/([0-9]+)/i,"$1"),10);if(typeof b.tip.size.x==="number"){b.tip.size.width=b.tip.size.x;delete b.tip.size.x}if(typeof b.tip.size.y==="number"){b.tip.size.height=b.tip.size.y;delete b.tip.size.y}return b}function G(){var b,e;e=[true,{}];for(b=0;b<arguments.length;b++)e.push(arguments[b]);for(b=[c.extend.apply(c,e)];typeof b[0].name==="string";)b.unshift(F(c.fn.qtip.styles[b[0].name]));b.unshift(true,{classes:{tooltip:"qtip-"+ (arguments[0].name||"defaults")}},c.fn.qtip.styles.defaults);b=c.extend.apply(c,b);e=c.browser.msie?1:0;b.tip.size.width+=e;b.tip.size.height+=e;if(b.tip.size.width%2>0)b.tip.size.width+=1;if(b.tip.size.height%2>0)b.tip.size.height+=1;if(b.tip.corner===true)b.tip.corner=this.options.position.corner.tooltip==="center"&&this.options.position.corner.target==="center"?false:this.options.position.corner.tooltip;return b}function H(b,e,f,a){b=b.get(0).getContext("2d");b.fillStyle=a;b.beginPath();b.arc(e[0], e[1],f,0,Math.PI*2,false);b.fill()}function N(){var b,e,f,a,d,g,i,h,j;b=this;b.elements.wrapper.find(".qtip-borderBottom, .qtip-borderTop").remove();f=b.options.style.border.width;a=b.options.style.border.radius;d=b.options.style.border.color||b.options.style.tip.color;g=E(a);i={};for(e in g){i[e]='<div rel="'+e+'" style="'+(/Left/.test(e)?"left":"right")+":0; position:absolute; height:"+a+"px; width:"+a+'px; overflow:hidden; line-height:0.1px; font-size:1px">';if(c("<canvas />").get(0).getContext)i[e]+= '<canvas height="'+a+'" width="'+a+'" style="vertical-align: top"></canvas>';else if(c.browser.msie){h=a*2+3;i[e]+='<v:arc stroked="false" fillcolor="'+d+'" startangle="'+g[e][0]+'" endangle="'+g[e][1]+'" style="width:'+h+"px; height:"+h+"px; margin-top:"+(/bottom/.test(e)?-2:-1)+"px; margin-left:"+(/Right/.test(e)?g[e][2]-3.5:-1)+'px; vertical-align:top; display:inline-block; behavior:url(#default#VML)"></v:arc>'}i[e]+="</div>"}e=b.getDimensions().width-Math.max(f,a)*2;e='<div class="qtip-betweenCorners" style="height:'+ a+"px; width:"+e+"px; overflow:hidden; background-color:"+d+'; line-height:0.1px; font-size:1px;">';b.elements.wrapper.prepend('<div class="qtip-borderTop" dir="ltr" style="height:'+a+"px; margin-left:"+a+'px; line-height:0.1px; font-size:1px; padding:0;">'+i.topLeft+i.topRight+e);b.elements.wrapper.append('<div class="qtip-borderBottom" dir="ltr" style="height:'+a+"px; margin-left:"+a+'px; line-height:0.1px; font-size:1px; padding:0;">'+i.bottomLeft+i.bottomRight+e);if(c("<canvas />").get(0).getContext)b.elements.wrapper.find("canvas").each(function(){j= g[c(this).parent("[rel]:first").attr("rel")];H.call(b,c(this),j,a,d)});else c.browser.msie&&b.elements.tooltip.append('<v:image style="behavior:url(#default#VML);"></v:image>');i=Math.max(a,a+(f-a));b.elements.contentWrapper.css({border:"0px solid "+d,borderWidth:Math.max(f-a,0)+"px "+i+"px"})}function I(b,e,f){b=b.get(0).getContext("2d");b.fillStyle=f;b.beginPath();b.moveTo(e[0][0],e[0][1]);b.lineTo(e[1][0],e[1][1]);b.lineTo(e[2][0],e[2][1]);b.fill()}function J(b){var e,f;if(!(this.options.style.tip.corner=== false||!this.elements.tip)){b||(b=new x(this.elements.tip.attr("rel")));e=f=c.browser.msie?1:0;this.elements.tip.css(b[b.precedance],0);if(b.precedance==="y"){if(c.browser.msie)f=parseInt(c.browser.version.charAt(0),10)===6?b.y==="top"?-3:1:b.y==="top"?1:2;if(b.x==="center")this.elements.tip.css({left:"50%",marginLeft:-(this.options.style.tip.size.width/2)});else b.x==="left"?this.elements.tip.css({left:this.options.style.border.radius-e}):this.elements.tip.css({right:this.options.style.border.radius+ e});b.y==="top"?this.elements.tip.css({top:-f}):this.elements.tip.css({bottom:f})}else{if(c.browser.msie)f=parseInt(c.browser.version.charAt(0),10)===6?1:b.x==="left"?1:2;if(b.y==="center")this.elements.tip.css({top:"50%",marginTop:-(this.options.style.tip.size.height/2)});else b.y==="top"?this.elements.tip.css({top:this.options.style.border.radius-e}):this.elements.tip.css({bottom:this.options.style.border.radius+e});b.x==="left"?this.elements.tip.css({left:-f}):this.elements.tip.css({right:f})}e= "padding-"+b[b.precedance];b=this.options.style.tip.size[b.precedance==="x"?"width":"height"];this.elements.tooltip.css("padding",0).css(e,b);if(c.browser.msie&&parseInt(c.browser.version.charAt(0),6)===6){b=parseInt(this.elements.tip.css("margin-top"),10)||0;b+=parseInt(this.elements.content.css("margin-top"),10)||0;this.elements.tip.css({marginTop:b})}}}function K(b){var e,f,a,d;this.elements.tip!==null&&this.elements.tip.remove();e=this.options.style.tip.color||this.options.style.border.color; if(this.options.style.tip.corner!==false){b||(b=new x(this.options.style.tip.corner));f=D(b.string(),this.options.style.tip.size.width,this.options.style.tip.size.height);this.elements.tip='<div class="'+this.options.style.classes.tip+'" dir="ltr" rel="'+b.string()+'" style="position:absolute; height:'+this.options.style.tip.size.height+"px; width:"+this.options.style.tip.size.width+'px; margin:0 auto; line-height:0.1px; font-size:1px;"></div>';this.elements.tooltip.prepend(this.elements.tip);if(c("<canvas />").get(0).getContext)a= '<canvas height="'+this.options.style.tip.size.height+'" width="'+this.options.style.tip.size.width+'"></canvas>';else if(c.browser.msie){a=this.options.style.tip.size.width+","+this.options.style.tip.size.height;d="m"+f[0][0]+","+f[0][1];d+=" l"+f[1][0]+","+f[1][1];d+=" "+f[2][0]+","+f[2][1];d+=" xe";a='<v:shape fillcolor="'+e+'" stroked="false" filled="true" path="'+d+'" coordsize="'+a+'" style="width:'+this.options.style.tip.size.width+"px; height:"+this.options.style.tip.size.height+"px; line-height:0.1px; display:inline-block; behavior:url(#default#VML); vertical-align:"+ (b.y==="top"?"bottom":"top")+'"></v:shape>';a+='<v:image style="behavior:url(#default#VML);"></v:image>';this.elements.contentWrapper.css("position","relative")}this.elements.tip=this.elements.tooltip.find("."+this.options.style.classes.tip).eq(0);this.elements.tip.html(a);c("<canvas />").get(0).getContext&&I.call(this,this.elements.tip.find("canvas:first"),f,e);b.y==="top"&&c.browser.msie&&parseInt(c.browser.version.charAt(0),10)===6&&this.elements.tip.css({marginTop:-4});J.call(this,b)}}function O(){var b= this;b.elements.title!==null&&b.elements.title.remove();b.elements.tooltip.attr("aria-labelledby","qtip-"+b.id+"-title");b.elements.title=c('<div id="qtip-'+b.id+'-title" class="'+b.options.style.classes.title+'"></div>').css(y(b.options.style.title,true)).css({zoom:c.browser.msie?1:0}).prependTo(b.elements.contentWrapper);b.options.content.title.text&&b.updateTitle.call(b,b.options.content.title.text);if(b.options.content.title.button!==false&&typeof b.options.content.title.button==="string")b.elements.button= c('<a class="'+b.options.style.classes.button+'" role="button" style="float:right; position: relative"></a>').css(y(b.options.style.button,true)).html(b.options.content.title.button).prependTo(b.elements.title).click(function(e){b.status.disabled||b.hide(e)})}function P(){function b(h){if(a.status.disabled!==true){clearTimeout(a.timers.inactive);a.timers.inactive=setTimeout(function(){c(i).each(function(){g.unbind(this+".qtip-inactive");a.elements.content.unbind(this+".qtip-inactive")});a.hide(h)}, a.options.hide.delay)}}function e(h){if(a.status.disabled!==true){if(a.options.hide.when.event==="inactive"){c(i).each(function(){g.bind(this+".qtip-inactive",b);a.elements.content.bind(this+".qtip-inactive",b)});b()}clearTimeout(a.timers.show);clearTimeout(a.timers.hide);if(a.options.show.delay>0)a.timers.show=setTimeout(function(){a.show(h)},a.options.show.delay);else a.show(h)}}function f(h){if(a.status.disabled!==true){if(a.options.hide.fixed===true&&/mouse(out|leave)/i.test(a.options.hide.when.event)&& c(h.relatedTarget).parents('div.qtip[id^="qtip"]').length>0){h.stopPropagation();h.preventDefault();clearTimeout(a.timers.hide);return false}clearTimeout(a.timers.show);clearTimeout(a.timers.hide);a.elements.tooltip.stop(true,true);a.timers.hide=setTimeout(function(){a.hide(h)},a.options.hide.delay)}}var a,d,g,i;a=this;d=a.options.show.when.target;g=a.options.hide.when.target;if(a.options.hide.fixed)g=g.add(a.elements.tooltip);i=["click","dblclick","mousedown","mouseup","mousemove","mouseout","mouseenter", "mouseleave","mouseover"];a.options.hide.fixed===true&&a.elements.tooltip.bind("mouseover.qtip",function(){a.status.disabled!==true&&clearTimeout(a.timers.hide)});if(a.options.show.when.target.add(a.options.hide.when.target).length===1&&a.options.show.when.event===a.options.hide.when.event&&a.options.hide.when.event!=="inactive"||a.options.hide.when.event==="unfocus"){a.cache.toggle=0;d.bind(a.options.show.when.event+".qtip",function(h){a.cache.toggle===0?e(h):f(h)})}else{d.bind(a.options.show.when.event+ ".qtip",e);a.options.hide.when.event!=="inactive"&&g.bind(a.options.hide.when.event+".qtip",f)}/(fixed|absolute)/.test(a.options.position.type)&&a.elements.tooltip.bind("mouseover.qtip",a.focus);a.options.position.target==="mouse"&&a.options.position.type!=="static"&&d.bind("mousemove.qtip",function(h){a.cache.mouse={x:h.pageX,y:h.pageY};a.status.disabled===false&&a.options.position.adjust.mouse===true&&a.options.position.type!=="static"&&a.elements.tooltip.css("display")!=="none"&&a.updatePosition(h)})} function Q(){var b;b=this.getDimensions();this.elements.bgiframe=this.elements.wrapper.prepend('<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:false" style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=\'0\'); border: 1px solid red; height:'+b.height+"px; width:"+b.width+'px" />').children(".qtip-bgiframe:first")}function L(){var b,e,f;this.beforeRender.call(this);this.status.rendered=2;this.elements.tooltip='<div qtip="'+this.id+'" id="qtip-'+this.id+ '" role="tooltip" aria-describedby="qtip-'+this.id+'-content" class="qtip '+(this.options.style.classes.tooltip||this.options.style)+'" style="display:none; -moz-border-radius:0; -webkit-border-radius:0; border-radius:0; position:'+this.options.position.type+';"> <div class="qtip-wrapper" style="position:relative; overflow:hidden; text-align:left;"> <div class="qtip-contentWrapper" style="overflow:hidden;"> <div id="qtip-'+this.id+'-content" class="qtip-content '+this.options.style.classes.content+ '"></div> </div></div></div>';this.elements.tooltip=c(this.elements.tooltip);this.elements.tooltip.appendTo(this.options.position.container);this.elements.tooltip.data("qtip",{current:0,interfaces:[this]});this.elements.wrapper=this.elements.tooltip.children("div:first");this.elements.contentWrapper=this.elements.wrapper.children("div:first");this.elements.content=this.elements.contentWrapper.children("div:first").css(y(this.options.style));c.browser.msie&&this.elements.wrapper.add(this.elements.content).css({zoom:1}); this.options.hide.when.event==="unfocus"&&this.elements.tooltip.attr("unfocus",true);typeof this.options.style.width.value==="number"&&this.updateWidth();if(c("<canvas />").get(0).getContext||c.browser.msie){this.options.style.border.radius>0?N.call(this):this.elements.contentWrapper.css({border:this.options.style.border.width+"px solid "+this.options.style.border.color});this.options.style.tip.corner!==false&&K.call(this)}else{this.elements.contentWrapper.css({border:this.options.style.border.width+ "px solid "+this.options.style.border.color});this.options.style.border.radius=0;this.options.style.tip.corner=false}if(typeof this.options.content.text==="string"&&this.options.content.text.length>0||this.options.content.text.jquery&&this.options.content.text.length>0)b=this.options.content.text;else if(this.elements.target.attr("title")){this.cache.attr=["title",this.elements.target.attr("title")];b=this.cache.attr[1].replace(/\n/gi,"<br />")}else if(this.elements.target.attr("alt")){this.cache.attr= ["alt",this.elements.target.attr("alt")];b=this.cache.attr[1].replace(/\n/gi,"<br />")}else b=" ";this.options.content.title.text!==false&&O.call(this);this.updateContent(b,false);P.call(this);this.options.show.ready===true&&this.show();if(this.options.content.url!==false){b=this.options.content.url;e=this.options.content.data;f=this.options.content.method||"get";this.loadContent(b,e,f)}this.status.rendered=true;this.onRender.call(this)}function R(b,e,f){var a=this;a.id=f;a.options=e;a.status={animated:false, rendered:false,disabled:false,focused:false};a.elements={target:b.addClass(a.options.style.classes.target),tooltip:null,wrapper:null,content:null,contentWrapper:null,title:null,button:null,tip:null,bgiframe:null};a.cache={attr:null,mouse:{},toggle:0,overflow:{left:false,top:false}};a.timers={};c.extend(a,a.options.api,{show:function(d){function g(){a.elements.tooltip.attr("aria-hidden",true);a.options.position.type!=="static"&&a.focus();a.onShow.call(a,d);c.browser.msie&&a.elements.tooltip.get(0).style.removeAttribute("filter"); a.elements.tooltip.css({opacity:""})}var i;if(!a.status.rendered)return false;if(a.elements.tooltip.css("display")!=="none")return a;a.cache.attr&&a.elements.target.removeAttr(a.cache.attr[0]);a.elements.tooltip.stop(true,false);if(a.beforeShow.call(a,d)===false)return a;a.cache.toggle=1;a.options.position.type!=="static"&&a.updatePosition(d,a.options.show.effect.length>0&&a.rendered!==2);if(typeof a.options.show.solo==="object")i=c(a.options.show.solo);else if(a.options.show.solo===true)i=c("div.qtip").not(a.elements.tooltip); i&&i.each(function(){c(this).qtip("api").status.rendered===true&&c(this).qtip("api").hide()});if(typeof a.options.show.effect.type==="function"){a.options.show.effect.type.call(a.elements.tooltip,a.options.show.effect.length);a.elements.tooltip.queue(function(){g();c(this).dequeue()})}else{switch(a.options.show.effect.type.toLowerCase()){case "fade":a.elements.tooltip.fadeIn(a.options.show.effect.length,g);break;case "slide":a.elements.tooltip.slideDown(a.options.show.effect.length,function(){g(); a.options.position.type!=="static"&&a.updatePosition(d,true)});break;case "grow":a.elements.tooltip.show(a.options.show.effect.length,g);break;default:a.elements.tooltip.show(null,g);break}a.elements.tooltip.addClass(a.options.style.classes.active)}return a},hide:function(d){function g(){a.elements.tooltip.attr("aria-hidden",true);a.elements.tooltip.css({opacity:""});a.onHide.call(a,d)}if(a.status.rendered){if(a.elements.tooltip.css("display")==="none")return a}else return false;a.cache.attr&&a.elements.target.attr(a.cache.attr[0], a.cache.attr[1]);clearTimeout(a.timers.show);a.elements.tooltip.stop(true,false);if(a.beforeHide.call(a,d)===false)return a;a.cache.toggle=0;if(typeof a.options.hide.effect.type==="function"){a.options.hide.effect.type.call(a.elements.tooltip,a.options.hide.effect.length);a.elements.tooltip.queue(function(){g();c(this).dequeue()})}else{switch(a.options.hide.effect.type.toLowerCase()){case "fade":a.elements.tooltip.fadeOut(a.options.hide.effect.length,g);break;case "slide":a.elements.tooltip.slideUp(a.options.hide.effect.length, g);break;case "grow":a.elements.tooltip.hide(a.options.hide.effect.length,g);break;default:a.elements.tooltip.hide(null,g);break}a.elements.tooltip.removeClass(a.options.style.classes.active)}return a},toggle:function(d,g){var i=/boolean|number/.test(typeof g)?g:!a.elements.tooltip.is(":visible");a[i?"show":"hide"](d);return a},updatePosition:function(d,g){if(!a.status.rendered)return false;var i=e.position,h=c(i.target),j=a.elements.tooltip.outerWidth(),o=a.elements.tooltip.outerHeight(),m,s,k,q= i.corner.tooltip,z=i.corner.target,l,n,w,M={left:function(){var t=c(window).scrollLeft(),r=c(window).width()+c(window).scrollLeft(),u=q.x==="center"?j/2:j,A=q.x==="center"?m/2:m,B=(q.x==="center"?1:2)*a.options.style.border.radius,C=-2*i.adjust.x,v=k.left+j,p;if(v>r){p=C-u-A+B;if(k.left+p>t||t-(k.left+p)<v-r)return{adjust:p,tip:"right"}}if(k.left<t){p=C+u+A-B;if(v+p<r||v+p-r<t-k.left)return{adjust:p,tip:"left"}}return{adjust:0,tip:q.x}},top:function(){var t=c(window).scrollTop(),r=c(window).height()+ c(window).scrollTop(),u=q.y==="center"?o/2:o,A=q.y==="center"?s/2:s,B=(q.y==="center"?1:2)*a.options.style.border.radius,C=-2*i.adjust.y,v=k.top+o,p;if(v>r){p=C-u-A+B;if(k.top+p>t||t-(k.top+p)<v-r)return{adjust:p,tip:"bottom"}}if(k.top<t){p=C+u+A-B;if(v+p<r||v+p-r<t-k.top)return{adjust:p,tip:"top"}}return{adjust:0,tip:q.y}}};if(d&&e.position.target==="mouse"){z={x:"left",y:"top"};m=s=0;k={top:d.pageY,left:d.pageX}}else{if(h[0]===document){m=h.width();s=h.height();k={top:0,left:0}}else if(h[0]===window){m= h.width();s=h.height();k={top:h.scrollTop(),left:h.scrollLeft()}}else if(h.is("area")){l=a.options.position.target.attr("coords").split(",");for(n=0;n<l.length;n++)l[n]=parseInt(l[n],10);n=a.options.position.target.parent("map").attr("name");w=c('img[usemap="#'+n+'"]:first').offset();h.position={left:Math.floor(w.left+l[0]),top:Math.floor(w.top+l[1])};switch(a.options.position.target.attr("shape").toLowerCase()){case "rect":m=Math.ceil(Math.abs(l[2]-l[0]));s=Math.ceil(Math.abs(l[3]-l[1]));break;case "circle":m= l[2]+1;s=l[2]+1;break;case "poly":m=l[0];s=l[1];for(n=0;n<l.length;n++)if(n%2===0){if(l[n]>m)m=l[n];if(l[n]<l[0])k.left=Math.floor(w.left+l[n])}else{if(l[n]>s)s=l[n];if(l[n]<l[1])k.top=Math.floor(w.top+l[n])}m-=k.left-w.left;s-=k.top-w.top;break}m-=2;s-=2}else{m=h.outerWidth();s=h.outerHeight();k=h.offset()}k.left+=z.x==="right"?m:z.x==="center"?m/2:0;k.top+=z.y==="bottom"?s:z.y==="center"?s/2:0}k.left+=i.adjust.x+(q.x==="right"?-j:q.x==="center"?-j/2:0);k.top+=i.adjust.y+(q.y==="bottom"?-o:q.y=== "center"?-o/2:0);if(a.options.style.border.radius>0){if(q.x==="left")k.left-=a.options.style.border.radius;else if(q.x==="right")k.left+=a.options.style.border.radius;if(q.y==="top")k.top-=a.options.style.border.radius;else if(q.y==="bottom")k.top+=a.options.style.border.radius}i.adjust.screen&&function(){var t={x:0,y:0},r={x:M.left(),y:M.top()},u=new x(e.style.tip.corner);if(a.elements.tip&&u){if(r.y.adjust!==0){k.top+=r.y.adjust;u.y=t.y=r.y.tip}if(r.x.adjust!==0){k.left+=r.x.adjust;u.x=t.x=r.x.tip}a.cache.overflow= {left:t.x===false,top:t.y===false};a.elements.tip.attr("rel")!==u.string()&&K.call(a,u)}}();!a.elements.bgiframe&&c.browser.msie&&parseInt(c.browser.version.charAt(0),10)===6&&Q.call(a);if(a.beforePositionUpdate.call(a,d)===false)return a;if(e.position.target!=="mouse"&&g===true){a.status.animated=true;a.elements.tooltip.stop().animate(k,200,"swing",function(){a.status.animated=false})}else a.elements.tooltip.css(k);a.onPositionUpdate.call(a,d);return a},updateWidth:function(d){if(!a.status.rendered|| d&&typeof d!=="number")return false;var g=a.elements.contentWrapper.siblings().add(a.elements.tip).add(a.elements.button),i=a.elements.wrapper.add(a.elements.contentWrapper.children()),h=a.elements.tooltip,j=a.options.style.width.max,o=a.options.style.width.min;if(!d)if(typeof a.options.style.width.value==="number")d=a.options.style.width.value;else{a.elements.tooltip.css({width:"auto"});g.hide();h.width(d);c.browser.msie&&i.css({zoom:""});d=a.getDimensions().width;a.options.style.width.value||(d= Math.min(Math.max(d,o),j))}if(d%2)d+=1;a.elements.tooltip.width(d);g.show();a.options.style.border.radius&&a.elements.tooltip.find(".qtip-betweenCorners").each(function(){c(this).width(d-a.options.style.border.radius*2)});if(c.browser.msie){i.css({zoom:1});a.elements.wrapper.width(d);a.elements.bgiframe&&a.elements.bgiframe.width(d).height(a.getDimensions.height)}return a},updateStyle:function(d){var g,i,h,j;if(!a.status.rendered||typeof d!=="string"||!c.fn.qtip.styles[d])return false;a.options.style= G.call(a,c.fn.qtip.styles[d],a.options.user.style);a.elements.content.css(y(a.options.style));a.options.content.title.text!==false&&a.elements.title.css(y(a.options.style.title,true));a.elements.contentWrapper.css({borderColor:a.options.style.border.color});if(a.options.style.tip.corner!==false)if(c("<canvas />").get(0).getContext){d=a.elements.tooltip.find(".qtip-tip canvas:first");i=d.get(0).getContext("2d");i.clearRect(0,0,300,300);h=d.parent("div[rel]:first").attr("rel");j=D(h,a.options.style.tip.size.width, a.options.style.tip.size.height);I.call(a,d,j,a.options.style.tip.color||a.options.style.border.color)}else if(c.browser.msie){d=a.elements.tooltip.find('.qtip-tip [nodeName="shape"]');d.attr("fillcolor",a.options.style.tip.color||a.options.style.border.color)}if(a.options.style.border.radius>0){a.elements.tooltip.find(".qtip-betweenCorners").css({backgroundColor:a.options.style.border.color});if(c("<canvas />").get(0).getContext){g=E(a.options.style.border.radius);a.elements.tooltip.find(".qtip-wrapper canvas").each(function(){i= c(this).get(0).getContext("2d");i.clearRect(0,0,300,300);h=c(this).parent("div[rel]:first").attr("rel");H.call(a,c(this),g[h],a.options.style.border.radius,a.options.style.border.color)})}else c.browser.msie&&a.elements.tooltip.find('.qtip-wrapper [nodeName="arc"]').each(function(){c(this).attr("fillcolor",a.options.style.border.color)})}return a},updateContent:function(d,g){function i(){a.updateWidth();if(g!==false){a.options.position.type!=="static"&&a.updatePosition(a.elements.tooltip.is(":visible"), true);a.options.style.tip.corner!==false&&J.call(a)}}var h,j,o;if(!a.status.rendered||!d)return false;h=a.beforeContentUpdate.call(a,d);if(typeof h==="string")d=h;else if(h===false)return;c.browser.msie&&a.elements.contentWrapper.children().css({zoom:"normal"});d.jquery&&d.length>0?d.clone(true).appendTo(a.elements.content).show():a.elements.content.html(d);j=a.elements.content.find("img[complete=false]");if(j.length>0){o=0;j.each(function(){c('<img src="'+c(this).attr("src")+'" />').load(function(){++o=== j.length&&i()})})}else i();a.onContentUpdate.call(a);return a},loadContent:function(d,g,i){function h(j){a.onContentLoad.call(a);a.updateContent(j)}if(!a.status.rendered)return false;if(a.beforeContentLoad.call(a)===false)return a;i==="post"?c.post(d,g,h):c.get(d,g,h);return a},updateTitle:function(d){if(!a.status.rendered||!d)return false;if(a.beforeTitleUpdate.call(a)===false)return a;if(a.elements.button)a.elements.button=a.elements.button.clone(true);a.elements.title.html(d);a.elements.button&& a.elements.title.prepend(a.elements.button);a.onTitleUpdate.call(a);return a},focus:function(d){var g,i,h;if(!a.status.rendered||a.options.position.type==="static")return false;g=parseInt(a.elements.tooltip.css("z-index"),10);i=15E3+c('div.qtip[id^="qtip"]').length-1;if(!a.status.focused&&g!==i){g=a.beforeFocus.call(a,d);if(g===false)return a;c('div.qtip[id^="qtip"]').not(a.elements.tooltip).each(function(){if(c(this).qtip("api").status.rendered===true){h=parseInt(c(this).css("z-index"),10);typeof h=== "number"&&h>-1&&c(this).css({zIndex:parseInt(c(this).css("z-index"),10)-1});c(this).qtip("api").status.focused=false}});a.elements.tooltip.css({zIndex:i});a.status.focused=true;a.onFocus.call(a,d)}return a},disable:function(d){if(!a.status.rendered)return false;a.status.disabled=d?true:false;return a},destroy:function(){var d,g;if(a.beforeDestroy.call(a)===false)return a;if(a.status.rendered){a.options.show.when.target.unbind("mousemove.qtip",a.updatePosition);a.options.show.when.target.unbind("mouseout.qtip", a.hide);a.options.show.when.target.unbind(a.options.show.when.event+".qtip");a.options.hide.when.target.unbind(a.options.hide.when.event+".qtip");a.elements.tooltip.unbind(a.options.hide.when.event+".qtip");a.elements.tooltip.unbind("mouseover.qtip",a.focus);a.elements.tooltip.remove()}else a.options.show.when.target.unbind(a.options.show.when.event+".qtip-"+a.id+"-create");if(typeof a.elements.target.data("qtip")==="object"){g=a.elements.target.data("qtip").interfaces;if(typeof g==="object"&&g.length> 0)for(d=0;d<g.length-1;d++)g[d].id===a.id&&g.splice(d,1)}c.fn.qtip.interfaces.splice(a.id,1);if(typeof g==="object"&&g.length>0)a.elements.target.data("qtip").current=g.length-1;else a.elements.target.removeData("qtip");a.onDestroy.call(a);return a.elements.target},getPosition:function(){var d,g;if(!a.status.rendered)return false;(d=a.elements.tooltip.css("display")!=="none"?false:true)&&a.elements.tooltip.css({visiblity:"hidden"}).show();g=a.elements.tooltip.offset();d&&a.elements.tooltip.css({visiblity:"visible"}).hide(); return g},getDimensions:function(){var d,g;if(!a.status.rendered)return false;(d=!a.elements.tooltip.is(":visible")?true:false)&&a.elements.tooltip.css({visiblity:"hidden"}).show();g={height:a.elements.tooltip.outerHeight(),width:a.elements.tooltip.outerWidth()};d&&a.elements.tooltip.css({visiblity:"visible"}).hide();return g}})}c(document).ready(function(){var b;c(window).bind("resize scroll",function(e){for(b=0;b<c.fn.qtip.interfaces.length;b++){var f=c.fn.qtip.interfaces[b];if(f&&f.status&&f.status.rendered&& f.options.position.type!=="static"&&(f.options.position.adjust.scroll&&e.type==="scroll"||f.options.position.adjust.resize&&e.type==="resize"))f.updatePosition(e,true)}});c(document).bind("mousedown.qtip",function(e){c(e.target).parents("div.qtip").length===0&&c(".qtip[unfocus]").each(function(){var f=c(this).qtip("api");c(this).is(":visible")&&f&&f.status&&!f.status.disabled&&c(e.target).add(f.elements.target).length>1&&f.hide(e)})})});c.fn.qtip=function(b,e){var f,a,d,g,i,h,j,o;if(typeof b==="string")if(c(this).data("qtip"))if(b=== "api")return c(this).data("qtip").interfaces[c(this).data("qtip").current];else{if(b==="interfaces")return c(this).data("qtip").interfaces}else return c(this);else{b||(b={});if(typeof b.content!=="object"||b.content.jquery&&b.content.length>0)b.content={text:b.content};if(typeof b.content.title!=="object")b.content.title={text:b.content.title};if(typeof b.position!=="object")b.position={corner:b.position};if(typeof b.position.corner!=="object")b.position.corner={target:b.position.corner,tooltip:b.position.corner}; if(typeof b.show!=="object")b.show={when:b.show};if(typeof b.show.when!=="object")b.show.when={event:b.show.when};if(typeof b.show.effect!=="object")b.show.effect={type:b.show.effect};if(typeof b.hide!=="object")b.hide={when:b.hide};if(typeof b.hide.when!=="object")b.hide.when={event:b.hide.when};if(typeof b.hide.effect!=="object")b.hide.effect={type:b.hide.effect};if(typeof b.style!=="object")b.style={name:b.style};b.style=F(b.style);g=c.extend(true,{},c.fn.qtip.defaults,b);g.style=G.call({options:g}, g.style);g.user=c.extend(true,{},b)}return c(this).each(function(){if(typeof b==="string"){h=b.toLowerCase();d=c(this).qtip("interfaces");if(typeof d==="object")if(e===true&&h==="destroy")for(f=d.length-1;f>-1;f--)"object"===typeof d[f]&&d[f].destroy();else{if(e!==true)d=[c(this).qtip("api")];for(f=0;f<d.length;f++)if(h==="destroy")d[f].destroy();else if(d[f].status.rendered===true)if(h==="show")d[f].show();else if(h==="hide")d[f].hide();else if(h==="focus")d[f].focus();else if(h==="disable")d[f].disable(true); else if(h==="enable")d[f].disable(false);else h==="update"&&d[f].updatePosition()}}else{j=c.extend(true,{},g);j.hide.effect.length=g.hide.effect.length;j.show.effect.length=g.show.effect.length;if(j.position.container===false)j.position.container=c(document.body);if(j.position.target===false)j.position.target=c(this);if(j.show.when.target===false)j.show.when.target=c(this);if(j.hide.when.target===false)j.hide.when.target=c(this);j.position.corner.tooltip=new x(j.position.corner.tooltip);j.position.corner.target= new x(j.position.corner.target);a=c.fn.qtip.interfaces.length;for(f=0;f<a;f++)if(typeof c.fn.qtip.interfaces[f]==="undefined"){a=f;break}i=new R(c(this),j,a);c.fn.qtip.interfaces[a]=i;if(typeof c(this).data("qtip")==="object"&&c(this).data("qtip")){if(typeof c(this).attr("qtip")==="undefined")c(this).data("qtip").current=c(this).data("qtip").interfaces.length;c(this).data("qtip").interfaces.push(i)}else c(this).data("qtip",{current:0,interfaces:[i]});if(j.content.prerender===false&&j.show.when.event!== false&&j.show.ready!==true)j.show.when.target.bind(j.show.when.event+".qtip-"+a+"-create",{qtip:a},function(m){o=c.fn.qtip.interfaces[m.data.qtip];o.options.show.when.target.unbind(o.options.show.when.event+".qtip-"+m.data.qtip+"-create");o.cache.mouse={x:m.pageX,y:m.pageY};L.call(o);o.options.show.when.target.trigger(o.options.show.when.event)});else{i.cache.mouse={x:j.show.when.target.offset().left,y:j.show.when.target.offset().top};L.call(i)}}})};c.fn.qtip.interfaces=[];c.fn.qtip.log={error:function(){return this}}; c.fn.qtip.constants={};c.fn.qtip.defaults={content:{prerender:false,text:false,url:false,data:null,title:{text:false,button:false}},position:{target:false,corner:{target:"bottomRight",tooltip:"topLeft"},adjust:{x:0,y:0,mouse:true,screen:false,scroll:true,resize:true},type:"absolute",container:false},show:{when:{target:false,event:"mouseover"},effect:{type:"fade",length:100},delay:140,solo:false,ready:false},hide:{when:{target:false,event:"mouseout"},effect:{type:"fade",length:100},delay:0,fixed:false}, api:{beforeRender:function(){},onRender:function(){},beforePositionUpdate:function(){},onPositionUpdate:function(){},beforeShow:function(){},onShow:function(){},beforeHide:function(){},onHide:function(){},beforeContentUpdate:function(){},onContentUpdate:function(){},beforeContentLoad:function(){},onContentLoad:function(){},beforeTitleUpdate:function(){},onTitleUpdate:function(){},beforeDestroy:function(){},onDestroy:function(){},beforeFocus:function(){},onFocus:function(){}}};c.fn.qtip.styles={defaults:{background:"white", color:"#111",overflow:"hidden",textAlign:"left",width:{min:0,max:250},padding:"5px 9px",border:{width:1,radius:0,color:"#d3d3d3"},tip:{corner:false,color:false,size:{width:13,height:13},opacity:1},title:{background:"#e1e1e1",fontWeight:"bold",padding:"7px 12px"},button:{cursor:"pointer"},classes:{target:"",tip:"qtip-tip",title:"qtip-title",button:"qtip-button",content:"qtip-content",active:"qtip-active"}},cream:{border:{width:3,radius:0,color:"#F9E98E"},title:{background:"#F0DE7D",color:"#A27D35"}, background:"#FBF7AA",color:"#A27D35",classes:{tooltip:"qtip-cream"}},light:{border:{width:3,radius:0,color:"#E2E2E2"},title:{background:"#f1f1f1",color:"#454545"},background:"white",color:"#454545",classes:{tooltip:"qtip-light"}},dark:{border:{width:3,radius:0,color:"#303030"},title:{background:"#404040",color:"#f3f3f3"},background:"#505050",color:"#f3f3f3",classes:{tooltip:"qtip-dark"}},red:{border:{width:3,radius:0,color:"#CE6F6F"},title:{background:"#f28279",color:"#9C2F2F"},background:"#F79992", color:"#9C2F2F",classes:{tooltip:"qtip-red"}},green:{border:{width:3,radius:0,color:"#A9DB66"},title:{background:"#b9db8c",color:"#58792E"},background:"#CDE6AC",color:"#58792E",classes:{tooltip:"qtip-green"}},blue:{border:{width:3,radius:0,color:"#ADD9ED"},title:{background:"#D0E9F5",color:"#5E99BD"},background:"#E5F6FE",color:"#4D9FBF",classes:{tooltip:"qtip-blue"}}}})(jQuery);
                                            
/*
 * Metadata - jQuery plugin for parsing metadata from elements
 *
 * Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.metadata.js 3640 2007-10-11 18:34:38Z pmclanahan $
 *
 */
(function(e){e.extend({metadata:{defaults:{type:"class",name:"metadata",cre:/({.*})/,single:"metadata"},setType:function(b,a){this.defaults.type=b;this.defaults.name=a},get:function(b,a){a=e.extend({},this.defaults,a);if(!a.single.length)a.single="metadata";var c=e.data(b,a.single);if(c)return c;c="{}";var h=function(d){if(typeof d!="string")return d;return d=eval("("+d+")")};if(a.type=="html5"){var g={};e(b.attributes).each(function(){var d=this.nodeName;if(d.match(/^data-/))d=d.replace(/^data-/, "");else return true;g[d]=h(this.nodeValue)})}else{if(a.type=="class"){var f=a.cre.exec(b.className);if(f)c=f[1]}else if(a.type=="elem"){if(!b.getElementsByTagName)return;f=b.getElementsByTagName(a.name);if(f.length)c=e.trim(f[0].innerHTML)}else if(b.getAttribute!=undefined)if(f=b.getAttribute(a.name))c=f;g=h(c.indexOf("{")<0?"{"+c+"}":c)}e.data(b,a.single,g);return g}}});e.fn.metadata=function(b){return e.metadata.get(this[0],b)}})(jQuery);

/**
*	@name							Defaultvalue
*	@descripton						Gives value to empty inputs
*	@version						1.2
*	@requires						Jquery 1.3.2
*
*	@author							Jan Jarfalk
*	@author-email					jan.jarfalk@unwrongest.com
*	@author-website					http://www.unwrongest.com
*
*	@licens							MIT License - http://www.opensource.org/licenses/mit-license.php
*
*	@param {String} str				The default value
*	@param {Function} callback		Callback function
*/
(function(d){d.fn.extend({defaultValue:function(h,f){return this.each(function(){function i(){var b=j();g.clone=b;b.insertAfter(a);a.hide();a.blur(function(){if(a.val().length<=0){b.show();a.hide()}})}function k(){e();a.keypress(function(){a.val().length>0&&e()}).blur(e).focus(function(){a.val()==c&&a.val("")});a.closest("form").submit(function(){a.val()==c&&a.val("")})}function e(){val=d.trim(a.val());if(val.length<=0||val==c){a.val(c);a.addClass("empty")}else a.removeClass("empty")}function j(){var b= d("<input />").attr({type:"text",value:c,"class":a.attr("class")+" empty",style:a.attr("style"),tabindex:a.attr("tabindex")});b.focus(function(){b.hide();a.show();setTimeout(function(){a.focus()},1)});return b}var a=$(this),c=h||a.attr("rel"),g={input:a};a.attr("type")=="password"?i():k();f&&f(g)})}})})(jQuery);

function addCommas(nStr)
{
    nStr += '';
    x = nStr.split('.');
    x1 = x[0];
    x2 = x.length > 1 ? '.' + x[1] : '';
    var rgx = /(\d+)(\d{3})/;
    while (rgx.test(x1)) {
            x1 = x1.replace(rgx, '$1' + '.' + '$2');
    }
    return x1 + x2;
}

function updateServices(e)
{
    /*if ( $('#cruise-booking').length )
    {
        return;
    }*/

    if ( e )
    {
        var _this = $(this);

        if ( isNaN(String.fromCharCode(e.which)) )
        {
            _this.val((_this.val().match(/(\d+)/g) || []).join(''));
        }
    }

    var customerFilters = [];
    var totalCustomerFilters = 0;
    var total = 0;

    $('.customer').each(function() {
        var _this = $(this);
        var categoryId = _this.attr('id').replace('customer_', '');

        customerFilters[categoryId] = parseInt(_this.val(), 10);

        if ( isNaN(customerFilters[categoryId]) )
        {
            customerFilters[categoryId] = 0;
        }

        totalCustomerFilters += customerFilters[categoryId];
    });
    $('.service').each(function() {
        var _this = $(this);
        var check = true;
        var quantity = 0;
        var subtotal = 0;

        $.each(_this.metadata().filters, function(id, value) {
            var min = value.split('-')[0];
            var max = value.split('-')[1];

            if ( !(
                (
                    id == 0 &&
                    (min == 0 || totalCustomerFilters >= min) &&
                    (max == 0 || totalCustomerFilters <= max)
                ) ||
                (
                    id > 0 &&
                    typeof customerFilters[id] != 'undefined' &&
                    (min == 0 || customerFilters[id] >= min) &&
                    (max == 0 || customerFilters[id] <= max)
                )
            ) )
            {
                _this.addClass('disattivo');
                $(':radio', _this).attr('disabled', 'disabled');
                check = false;

                return false;
            }
        });
        if ( check )
        {
            _this.removeClass('disattivo');
            $(':radio', _this).removeAttr('disabled');

            if ( _this.is('.ad_personam') )
            {
                var category = _this.metadata().category;

                if ( category == 0 )
                {
                    $('.customer').each(function() {
                        var subquantity = parseInt($(this).val(), 10);

                        if ( isNaN(subquantity) )
                        {
                            subquantity = 0;
                        }

                        quantity += subquantity;
                    });
                }
                else
                {
                    quantity = parseInt($('#customer_' + category).val(), 10);

                    if ( isNaN(quantity) )
                    {
                        quantity = 0;
                    }
                }
            }
            else
            {
                quantity = 1;
            }
        }

        subtotal = quantity * parseFloat(
            $('#' + _this.attr('id') + ' input[name=services\[' + (_this.attr('id').replace('service_', '')) + '\]]:checked').parent().find('.price').text()
                .replace('.', '')
                .replace(',', '.')
            , 10
        );

        if ( isNaN(subtotal) )
        {
            quantity = 0;
        }

        total += subtotal;

        if ( quantity == 0 )
        {
            _this.addClass('disattivo');
            $(':radio', _this).attr('disabled', 'disabled');
        }

        $('.quantity', _this).text(quantity);
        $('.partial-total', _this).text(addCommas(
            subtotal
                .toFixed(2)
                .replace('.', ',')
        ));
    });
    $('.total').text(addCommas(
        total
            .toFixed(2)
            .replace('.', ',')
    ));
}

$(document).ready(function() {
    $.datepicker.setDefaults($.datepicker.regional['it']);
    
    $.getScript('http://browser-update.org/update.js');
    
    $("#slider ul").cycle({
        fx: 'fade',
        timeout: 4000,
        speed: 1500
    });

    $("#slider-offerte.slide-active").jCarouselLite({
        btnNext: "#nextBtn2",
        btnPrev: "#prevBtn2",
        auto: 5000,
        speed: 500,
        circular: true,
        visible: 3,
        scroll: 1
    });

    /**
     * destination selection start
     */
    var links    = '<ul id="destination_alternative">';
    var location = $('#destination');
    var alternativeLocation = $('<input readonly="readonly" type="text" class="richiesta" />');
    alternativeLocation.attr('id', location.attr('id'));
    location.removeAttr('id');
    alternativeLocation.val($('option:selected', location).text());

    $('option', location).each(function(index) {
        if ( index == 0 )
        {
            return;
        }

        var $this = $(this);

        links += '<li><a href="' + escape($this.val()) + '" class="destination_option">' + $this.html() + '</a></li>';
    });

    links += '</ul>';

    $('.destination_option').live('click', function() {
        var $this = $(this);
        var locationId = $this.attr('href');

        if ( !$.support.hrefNormalized )
        {
            var regExp = new RegExp('http://' + document.location.host + document.location.pathname);
            locationId = locationId.replace(regExp, '');
        }

        location.val(locationId);
        alternativeLocation.val($this.text());

        $(alternativeLocation).qtip('hide');

        return false;
    });

    location.hide();
    alternativeLocation.insertAfter(location);

    $(alternativeLocation).qtip({
        content: {
            text: links,
            title: 'Scegli la tua destinazione'
        },
        hide: { fixed: true, when: 'unfocus' },
        position: { adjust: { screen: 'flip' } },
        show: 'focus',
        style: { name: 'light', tip: true, width: 630, border: {width: 3, radius: 5, color:'#FB9C32'}, title: {background:'#FB9C32', color:'#fff', 'padding-left':'7px'}}
    });
    /**
     * destination selection end
     */

    /**
     * sorting form start
     */
    var sort = $('#sort');
    var form = sort.parents('form:first');
    $('input:submit', form).remove();
    sort.change(function() {
        form.submit();
    });
    /**
     * sorting form end
     */

    $('#data').datepicker({ 'buttonImage' : BASEURL + '/images/calendar.gif', 'buttonImageOnly' : true, 'minDate' : '+14', 'showOn': 'both' });

    $('.ui-tabs').tabs();

    $('a[rel=external]').click(function() {
        window.open($(this).attr('href'));

        return false;
    });

    updateServices();
    $('.customer').live('keyup', updateServices);
    $('.service input:radio').live('click', updateServices);

    $('#nation').change(function() {
        if ( $(this).val() == 82 )
        {
            $('#city-field').show();
        }
        else
        {
            $('#city-field').hide();
        }
    });
    $('#nation').change();

    $('#children').keyup(function() {
        var childrenField = $('#children_field');
        var children      = parseInt($(this).val(), 10);
        var maxChildren   = 20;

        if( isNaN(children) )
        {
            for ( var i = 1; i <= maxChildren; i++ )
            {
                $('#child_age_field_' + i).remove();
            }
        }
        else
        {
            children = Math.min(Math.max(children, 0), maxChildren);

            for ( var i = 1; i <= children; i ++ )
            {
                if ( !$('#child_age_field_' + i).length )
                {
                    var childAgeField = $(
                        '<p class="flottante-c" id="child_age_field_' + i + '">' +
                            '<label for="child_age_' + i + '" class="generica">età bambino ' + i + '*:</label>' +
                            '<input id="child_age_' + i + '" name="child_age_' + i + '" type="text" class="lungo" value="0" size="" />' +
                        '</p>'
                    );

                    if ( i == 1 )
                    {
                        childAgeField.insertAfter(childrenField);
                    }
                    else
                    {
                        childAgeField.insertAfter($('#child_age_field_' + (i - 1)));
                    }
                }
            }

            for ( var i = children + 1; i <= maxChildren; i++ )
            {
                $('#child_age_field_' + i).remove();
            }
        }
    });

    $('#news-nome').defaultValue('nome');
    $('#news-email').defaultValue('email');

    $('#videogallery h3, #photogallery h3')
        .css('cursor', 'pointer')
        .bind('click', function() {
            var $this = $(this);

            if ( $this.find('.flag').text() == '+' )
            {
                $this.find('.flag').text('–');

                $('#' + $this.attr('id').replace('-handler', '')).show();
            }
            else
            {
                $this.find('.flag').text('+');

                $('#' + $this.attr('id').replace('-handler', '')).hide();
            }
        });

    $('#videogallery div[id|=videogallery], #photogallery div[id|=photogallery]').hide();
    $('#photogallery div[id|=photogallery]').each(function() {
        $(this).find('a[rel|=photogallery]').colorbox({maxHeight: '95%', maxWidth: '95%'});
    });
    $('#videogallery div[id|=videogallery]').each(function() {
        $(this).find('a[rel|=videogallery]').colorbox({iframe: true, height: 390, width: 640});
    });

    $(this).find('a[rel=gallery]').colorbox({maxHeight: '95%', maxWidth: '95%'});

    $('a[href*=#casa_vacanze]').bind('click', function() {
        $(this).colorbox({href: 'http://www.interhome.it/appartementi/Search.aspx?partnerID=IT300442&lCode=IT-IT&sortField=25&ihnav=N', iframe: true, height: '95%', width: '630px', open: true});

        return false;
    });
    $('a[href*=#hotel]').bind('click', function() {
        $(this).colorbox({href: 'http://b2c.towers.it/?cstz=mergell', iframe: true, height: '95%', width: '730px', open: true});

        return false;
    });
});
