/**
 * Cookie plugin
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 */
jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}var expires='';if(options.expires &&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}expires=';expires='+date.toUTCString();}var path=options.path?';path='+(options.path):'';var domain=options.domain?';domain='+(options.domain):'';var secure=options.secure?';secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie && document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}return cookieValue;}};

/* jQuery Cycle Plugin */
(function(D){var A="Lite-1.0";D.fn.xcycle=function(E){return this.each(function(){E=E||{};if(this.xcycleTimeout){clearTimeout(this.xcycleTimeout)}this.xcycleTimeout=0;this.xcyclePause=0;var I=D(this);var J=E.slideExpr?D(E.slideExpr,this):I.children();var G=J.get();if(G.length<2){if(window.console&&window.console.log){window.console.log("terminating; too few slides: "+G.length)}return }var H=D.extend({},D.fn.xcycle.defaults,E||{},D.metadata?I.metadata():D.meta?I.data():{});H.before=H.before?[H.before]:[];H.after=H.after?[H.after]:[];H.after.unshift(function(){H.busy=0});var F=this.className;H.width=parseInt((F.match(/w:(\d+)/)||[])[1])||H.width;H.height=parseInt((F.match(/h:(\d+)/)||[])[1])||H.height;H.timeout=parseInt((F.match(/t:(\d+)/)||[])[1])||H.timeout;if(I.css("position")=="static"){I.css("position","relative")}if(H.width){I.width(H.width)}if(H.height&&H.height!="auto"){I.height(H.height)}var K=0;J.css({position:"absolute",top:0,left:0}).hide().each(function(M){D(this).css("z-index",G.length-M)});D(G[K]).css("opacity",1).show();if(D.browser.msie){G[K].style.removeAttribute("filter")}if(H.fit&&H.width){J.width(H.width)}if(H.fit&&H.height&&H.height!="auto"){J.height(H.height)}if(H.pause){I.hover(function(){this.xcyclePause=1},function(){this.xcyclePause=0})}D.fn.xcycle.transitions.fade(I,J,H);J.each(function(){var M=D(this);this.xcycleH=(H.fit&&H.height)?H.height:M.height();this.xcycleW=(H.fit&&H.width)?H.width:M.width()});J.not(":eq("+K+")").css({opacity:0});if(H.cssFirst){D(J[K]).css(H.cssFirst)}if(H.timeout){if(H.speed.constructor==String){H.speed={slow:600,fast:200}[H.speed]||400}if(!H.sync){H.speed=H.speed/2}while((H.timeout-H.speed)<250){H.timeout+=H.speed}}H.speedIn=H.speed;H.speedOut=H.speed;H.slideCount=G.length;H.currSlide=K;H.nextSlide=1;var L=J[K];if(H.before.length){H.before[0].apply(L,[L,L,H,true])}if(H.after.length>1){H.after[1].apply(L,[L,L,H,true])}if(H.click&&!H.next){H.next=H.click}if(H.next){D(H.next).bind("click",function(){return C(G,H,H.rev?-1:1)})}if(H.prev){D(H.prev).bind("click",function(){return C(G,H,H.rev?1:-1)})}if(H.timeout){this.xcycleTimeout=setTimeout(function(){B(G,H,0,!H.rev)},H.timeout+(H.delay||0))}})};function B(J,E,I,K){if(E.busy){return }var H=J[0].parentNode,M=J[E.currSlide],L=J[E.nextSlide];if(H.xcycleTimeout===0&&!I){return }if(I||!H.xcyclePause){if(E.before.length){D.each(E.before,function(N,O){O.apply(L,[M,L,E,K])})}var F=function(){if(D.browser.msie){this.style.removeAttribute("filter")}D.each(E.after,function(N,O){O.apply(L,[M,L,E,K])})};if(E.nextSlide!=E.currSlide){E.busy=1;D.fn.xcycle.custom(M,L,E,F)}var G=(E.nextSlide+1)==J.length;E.nextSlide=G?0:E.nextSlide+1;E.currSlide=G?J.length-1:E.nextSlide-1}if(E.timeout){H.xcycleTimeout=setTimeout(function(){B(J,E,0,!E.rev)},E.timeout)}}function C(E,F,I){var H=E[0].parentNode,G=H.xcycleTimeout;if(G){clearTimeout(G);H.xcycleTimeout=0}F.nextSlide=F.currSlide+I;if(F.nextSlide<0){F.nextSlide=E.length-1}else{if(F.nextSlide>=E.length){F.nextSlide=0}}B(E,F,1,I>=0);return false}D.fn.xcycle.custom=function(K,H,I,E){var J=D(K),G=D(H);G.css({opacity:0});var F=function(){G.animate({opacity:1},I.speedIn,I.easeIn,E)};J.animate({opacity:0},I.speedOut,I.easeOut,function(){J.css({display:"none"});if(!I.sync){F()}});if(I.sync){F()}};D.fn.xcycle.transitions={fade:function(F,G,E){G.not(":eq(0)").css("opacity",0);E.before.push(function(){D(this).show()})}};D.fn.xcycle.ver=function(){return A};D.fn.xcycle.defaults={timeout:4000,speed:1000,next:null,prev:null,before:null,after:null,height:"auto",sync:1,fit:0,pause:0,delay:0,slideExpr:null}})(jQuery);
(function($){var ver="2.88";if($.support==undefined){$.support={opacity:!($.browser.msie)};}function debug(s){if($.fn.cycle.debug){log(s);}}function log(){if(window.console&&window.console.log){window.console.log("[cycle] "+Array.prototype.join.call(arguments," "));}}$.fn.cycle=function(options,arg2){var o={s:this.selector,c:this.context};if(this.length===0&&options!="stop"){if(!$.isReady&&o.s){log("DOM not ready, queuing slideshow");$(function(){$(o.s,o.c).cycle(options,arg2);});return this;}log("terminating; zero elements found by selector"+($.isReady?"":" (DOM not ready)"));return this;}return this.each(function(){var opts=handleArguments(this,options,arg2);if(opts===false){return;}opts.updateActivePagerLink=opts.updateActivePagerLink||$.fn.cycle.updateActivePagerLink;if(this.cycleTimeout){clearTimeout(this.cycleTimeout);}this.cycleTimeout=this.cyclePause=0;var $cont=$(this);var $slides=opts.slideExpr?$(opts.slideExpr,this):$cont.children();var els=$slides.get();if(els.length<2){log("terminating; too few slides: "+els.length);return;}var opts2=buildOptions($cont,$slides,els,opts,o);if(opts2===false){return;}var startTime=opts2.continuous?10:getTimeout(els[opts2.currSlide],els[opts2.nextSlide],opts2,!opts2.rev);if(startTime){startTime+=(opts2.delay||0);if(startTime<10){startTime=10;}debug("first timeout: "+startTime);this.cycleTimeout=setTimeout(function(){go(els,opts2,0,(!opts2.rev&&!opts.backwards));},startTime);}});};function handleArguments(cont,options,arg2){if(cont.cycleStop==undefined){cont.cycleStop=0;}if(options===undefined||options===null){options={};}if(options.constructor==String){switch(options){case"destroy":case"stop":var opts=$(cont).data("cycle.opts");if(!opts){return false;}cont.cycleStop++;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);}cont.cycleTimeout=0;$(cont).removeData("cycle.opts");if(options=="destroy"){destroy(opts);}return false;case"toggle":cont.cyclePause=(cont.cyclePause===1)?0:1;checkInstantResume(cont.cyclePause,arg2,cont);return false;case"pause":cont.cyclePause=1;return false;case"resume":cont.cyclePause=0;checkInstantResume(false,arg2,cont);return false;case"prev":case"next":var opts=$(cont).data("cycle.opts");if(!opts){log('options not found, "prev/next" ignored');return false;}$.fn.cycle[options](opts);return false;default:options={fx:options};}return options;}else{if(options.constructor==Number){var num=options;options=$(cont).data("cycle.opts");if(!options){log("options not found, can not advance slide");return false;}if(num<0||num>=options.elements.length){log("invalid slide index: "+num);return false;}options.nextSlide=num;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}if(typeof arg2=="string"){options.oneTimeFx=arg2;}go(options.elements,options,1,num>=options.currSlide);return false;}}return options;function checkInstantResume(isPaused,arg2,cont){if(!isPaused&&arg2===true){var options=$(cont).data("cycle.opts");if(!options){log("options not found, can not resume");return false;}if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}go(options.elements,options,1,(!opts.rev&&!opts.backwards));}}}function removeFilter(el,opts){if(!$.support.opacity&&opts.cleartype&&el.style.filter){try{el.style.removeAttribute("filter");}catch(smother){}}}function destroy(opts){if(opts.next){$(opts.next).unbind(opts.prevNextEvent);}if(opts.prev){$(opts.prev).unbind(opts.prevNextEvent);}if(opts.pager||opts.pagerAnchorBuilder){$.each(opts.pagerAnchors||[],function(){this.unbind().remove();});}opts.pagerAnchors=null;if(opts.destroy){opts.destroy(opts);}}function buildOptions($cont,$slides,els,options,o){var opts=$.extend({},$.fn.cycle.defaults,options||{},$.metadata?$cont.metadata():$.meta?$cont.data():{});if(opts.autostop){opts.countdown=opts.autostopCount||els.length;}var cont=$cont[0];$cont.data("cycle.opts",opts);opts.$cont=$cont;opts.stopCount=cont.cycleStop;opts.elements=els;opts.before=opts.before?[opts.before]:[];opts.after=opts.after?[opts.after]:[];opts.after.unshift(function(){opts.busy=0;});if(!$.support.opacity&&opts.cleartype){opts.after.push(function(){removeFilter(this,opts);});}if(opts.continuous){opts.after.push(function(){go(els,opts,0,(!opts.rev&&!opts.backwards));});}saveOriginalOpts(opts);if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($slides);}if($cont.css("position")=="static"){$cont.css("position","relative");}if(opts.width){$cont.width(opts.width);}if(opts.height&&opts.height!="auto"){$cont.height(opts.height);}if(opts.startingSlide){opts.startingSlide=parseInt(opts.startingSlide);}else{if(opts.backwards){opts.startingSlide=els.length-1;}}if(opts.random){opts.randomMap=[];for(var i=0;i<els.length;i++){opts.randomMap.push(i);}opts.randomMap.sort(function(a,b){return Math.random()-0.5;});opts.randomIndex=1;opts.startingSlide=opts.randomMap[1];}else{if(opts.startingSlide>=els.length){opts.startingSlide=0;}}opts.currSlide=opts.startingSlide||0;var first=opts.startingSlide;$slides.css({position:"absolute",top:0,left:0}).hide().each(function(i){var z;if(opts.backwards){z=first?i<=first?els.length+(i-first):first-i:els.length-i;}else{z=first?i>=first?els.length-(i-first):first-i:els.length-i;}$(this).css("z-index",z);});$(els[first]).css("opacity",1).show();removeFilter(els[first],opts);if(opts.fit&&opts.width){$slides.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$slides.height(opts.height);}var reshape=opts.containerResize&&!$cont.innerHeight();if(reshape){var maxw=0,maxh=0;for(var j=0;j<els.length;j++){var $e=$(els[j]),e=$e[0],w=$e.outerWidth(),h=$e.outerHeight();if(!w){w=e.offsetWidth||e.width||$e.attr("width");}if(!h){h=e.offsetHeight||e.height||$e.attr("height");}maxw=w>maxw?w:maxw;maxh=h>maxh?h:maxh;}if(maxw>0&&maxh>0){$cont.css({width:maxw+"px",height:maxh+"px"});}}if(opts.pause){$cont.hover(function(){this.cyclePause++;},function(){this.cyclePause--;});}if(supportMultiTransitions(opts)===false){return false;}var requeue=false;options.requeueAttempts=options.requeueAttempts||0;$slides.each(function(){var $el=$(this);this.cycleH=(opts.fit&&opts.height)?opts.height:($el.height()||this.offsetHeight||this.height||$el.attr("height")||0);this.cycleW=(opts.fit&&opts.width)?opts.width:($el.width()||this.offsetWidth||this.width||$el.attr("width")||0);if($el.is("img")){var loadingIE=($.browser.msie&&this.cycleW==28&&this.cycleH==30&&!this.complete);var loadingFF=($.browser.mozilla&&this.cycleW==34&&this.cycleH==19&&!this.complete);var loadingOp=($.browser.opera&&((this.cycleW==42&&this.cycleH==19)||(this.cycleW==37&&this.cycleH==17))&&!this.complete);var loadingOther=(this.cycleH==0&&this.cycleW==0&&!this.complete);if(loadingIE||loadingFF||loadingOp||loadingOther){if(o.s&&opts.requeueOnImageNotLoaded&&++options.requeueAttempts<100){log(options.requeueAttempts," - img slide not loaded, requeuing slideshow: ",this.src,this.cycleW,this.cycleH);setTimeout(function(){$(o.s,o.c).cycle(options);},opts.requeueTimeout);requeue=true;return false;}else{log("could not determine size of image: "+this.src,this.cycleW,this.cycleH);}}}return true;});if(requeue){return false;}opts.cssBefore=opts.cssBefore||{};opts.animIn=opts.animIn||{};opts.animOut=opts.animOut||{};$slides.not(":eq("+first+")").css(opts.cssBefore);if(opts.cssFirst){$($slides[first]).css(opts.cssFirst);}if(opts.timeout){opts.timeout=parseInt(opts.timeout);if(opts.speed.constructor==String){opts.speed=$.fx.speeds[opts.speed]||parseInt(opts.speed);}if(!opts.sync){opts.speed=opts.speed/2;}var buffer=opts.fx=="shuffle"?500:250;while((opts.timeout-opts.speed)<buffer){opts.timeout+=opts.speed;}}if(opts.easing){opts.easeIn=opts.easeOut=opts.easing;}if(!opts.speedIn){opts.speedIn=opts.speed;}if(!opts.speedOut){opts.speedOut=opts.speed;}opts.slideCount=els.length;opts.currSlide=opts.lastSlide=first;if(opts.random){if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.backwards){opts.nextSlide=opts.startingSlide==0?(els.length-1):opts.startingSlide-1;}else{opts.nextSlide=opts.startingSlide>=(els.length-1)?0:opts.startingSlide+1;}}if(!opts.multiFx){var init=$.fn.cycle.transitions[opts.fx];if($.isFunction(init)){init($cont,$slides,opts);}else{if(opts.fx!="custom"&&!opts.multiFx){log("unknown transition: "+opts.fx,"; slideshow terminating");return false;}}}var e0=$slides[first];if(opts.before.length){opts.before[0].apply(e0,[e0,e0,opts,true]);}if(opts.after.length>1){opts.after[1].apply(e0,[e0,e0,opts,true]);}if(opts.next){$(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?-1:1);});}if(opts.prev){$(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?1:-1);});}if(opts.pager||opts.pagerAnchorBuilder){buildPager(els,opts);}exposeAddSlide(opts,els);return opts;}function saveOriginalOpts(opts){opts.original={before:[],after:[]};opts.original.cssBefore=$.extend({},opts.cssBefore);opts.original.cssAfter=$.extend({},opts.cssAfter);opts.original.animIn=$.extend({},opts.animIn);opts.original.animOut=$.extend({},opts.animOut);$.each(opts.before,function(){opts.original.before.push(this);});$.each(opts.after,function(){opts.original.after.push(this);});}function supportMultiTransitions(opts){var i,tx,txs=$.fn.cycle.transitions;if(opts.fx.indexOf(",")>0){opts.multiFx=true;opts.fxs=opts.fx.replace(/\s*/g,"").split(",");for(i=0;i<opts.fxs.length;i++){var fx=opts.fxs[i];tx=txs[fx];if(!tx||!txs.hasOwnProperty(fx)||!$.isFunction(tx)){log("discarding unknown transition: ",fx);opts.fxs.splice(i,1);i--;}}if(!opts.fxs.length){log("No valid transitions named; slideshow terminating.");return false;}}else{if(opts.fx=="all"){opts.multiFx=true;opts.fxs=[];for(p in txs){tx=txs[p];if(txs.hasOwnProperty(p)&&$.isFunction(tx)){opts.fxs.push(p);}}}}if(opts.multiFx&&opts.randomizeEffects){var r1=Math.floor(Math.random()*20)+30;for(i=0;i<r1;i++){var r2=Math.floor(Math.random()*opts.fxs.length);opts.fxs.push(opts.fxs.splice(r2,1)[0]);}debug("randomized fx sequence: ",opts.fxs);}return true;}function exposeAddSlide(opts,els){opts.addSlide=function(newSlide,prepend){var $s=$(newSlide),s=$s[0];if(!opts.autostopCount){opts.countdown++;}els[prepend?"unshift":"push"](s);if(opts.els){opts.els[prepend?"unshift":"push"](s);}opts.slideCount=els.length;$s.css("position","absolute");$s[prepend?"prependTo":"appendTo"](opts.$cont);if(prepend){opts.currSlide++;opts.nextSlide++;}if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($s);}if(opts.fit&&opts.width){$s.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$slides.height(opts.height);}s.cycleH=(opts.fit&&opts.height)?opts.height:$s.height();s.cycleW=(opts.fit&&opts.width)?opts.width:$s.width();$s.css(opts.cssBefore);if(opts.pager||opts.pagerAnchorBuilder){$.fn.cycle.createPagerAnchor(els.length-1,s,$(opts.pager),els,opts);}if($.isFunction(opts.onAddSlide)){opts.onAddSlide($s);}else{$s.hide();}};}$.fn.cycle.resetState=function(opts,fx){fx=fx||opts.fx;opts.before=[];opts.after=[];opts.cssBefore=$.extend({},opts.original.cssBefore);opts.cssAfter=$.extend({},opts.original.cssAfter);opts.animIn=$.extend({},opts.original.animIn);opts.animOut=$.extend({},opts.original.animOut);opts.fxFn=null;$.each(opts.original.before,function(){opts.before.push(this);});$.each(opts.original.after,function(){opts.after.push(this);});var init=$.fn.cycle.transitions[fx];if($.isFunction(init)){init(opts.$cont,$(opts.elements),opts);}};function go(els,opts,manual,fwd){if(manual&&opts.busy&&opts.manualTrump){debug("manualTrump in go(), stopping active transition");$(els).stop(true,true);opts.busy=false;}if(opts.busy){debug("transition active, ignoring new tx request");return;}var p=opts.$cont[0],curr=els[opts.currSlide],next=els[opts.nextSlide];if(p.cycleStop!=opts.stopCount||p.cycleTimeout===0&&!manual){return;}if(!manual&&!p.cyclePause&&!opts.bounce&&((opts.autostop&&(--opts.countdown<=0))||(opts.nowrap&&!opts.random&&opts.nextSlide<opts.currSlide))){if(opts.end){opts.end(opts);}return;}var changed=false;if((manual||!p.cyclePause)&&(opts.nextSlide!=opts.currSlide)){changed=true;var fx=opts.fx;curr.cycleH=curr.cycleH||$(curr).height();curr.cycleW=curr.cycleW||$(curr).width();next.cycleH=next.cycleH||$(next).height();next.cycleW=next.cycleW||$(next).width();if(opts.multiFx){if(opts.lastFx==undefined||++opts.lastFx>=opts.fxs.length){opts.lastFx=0;}fx=opts.fxs[opts.lastFx];opts.currFx=fx;}if(opts.oneTimeFx){fx=opts.oneTimeFx;opts.oneTimeFx=null;}$.fn.cycle.resetState(opts,fx);if(opts.before.length){$.each(opts.before,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});}var after=function(){$.each(opts.after,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});};debug("tx firing; currSlide: "+opts.currSlide+"; nextSlide: "+opts.nextSlide);opts.busy=1;if(opts.fxFn){opts.fxFn(curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}else{if($.isFunction($.fn.cycle[opts.fx])){$.fn.cycle[opts.fx](curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}else{$.fn.cycle.custom(curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}}}if(changed||opts.nextSlide==opts.currSlide){opts.lastSlide=opts.currSlide;if(opts.random){opts.currSlide=opts.nextSlide;if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];if(opts.nextSlide==opts.currSlide){opts.nextSlide=(opts.currSlide==opts.slideCount-1)?0:opts.currSlide+1;}}else{if(opts.backwards){var roll=(opts.nextSlide-1)<0;if(roll&&opts.bounce){opts.backwards=!opts.backwards;opts.nextSlide=1;opts.currSlide=0;}else{opts.nextSlide=roll?(els.length-1):opts.nextSlide-1;opts.currSlide=roll?0:opts.nextSlide+1;}}else{var roll=(opts.nextSlide+1)==els.length;if(roll&&opts.bounce){opts.backwards=!opts.backwards;opts.nextSlide=els.length-2;opts.currSlide=els.length-1;}else{opts.nextSlide=roll?0:opts.nextSlide+1;opts.currSlide=roll?els.length-1:opts.nextSlide-1;}}}}if(changed&&opts.pager){opts.updateActivePagerLink(opts.pager,opts.currSlide,opts.activePagerClass);}var ms=0;if(opts.timeout&&!opts.continuous){ms=getTimeout(els[opts.currSlide],els[opts.nextSlide],opts,fwd);}else{if(opts.continuous&&p.cyclePause){ms=10;}}if(ms>0){p.cycleTimeout=setTimeout(function(){go(els,opts,0,(!opts.rev&&!opts.backwards));},ms);}}$.fn.cycle.updateActivePagerLink=function(pager,currSlide,clsName){$(pager).each(function(){$(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);});};function getTimeout(curr,next,opts,fwd){if(opts.timeoutFn){var t=opts.timeoutFn.call(curr,curr,next,opts,fwd);while((t-opts.speed)<250){t+=opts.speed;}debug("calculated timeout: "+t+"; speed: "+opts.speed);if(t!==false){return t;}}return opts.timeout;}$.fn.cycle.next=function(opts){advance(opts,opts.rev?-1:1);};$.fn.cycle.prev=function(opts){advance(opts,opts.rev?1:-1);};function advance(opts,val){var els=opts.elements;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}if(opts.random&&val<0){opts.randomIndex--;if(--opts.randomIndex==-2){opts.randomIndex=els.length-2;}else{if(opts.randomIndex==-1){opts.randomIndex=els.length-1;}}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.random){opts.nextSlide=opts.randomMap[opts.randomIndex];}else{opts.nextSlide=opts.currSlide+val;if(opts.nextSlide<0){if(opts.nowrap){return false;}opts.nextSlide=els.length-1;}else{if(opts.nextSlide>=els.length){if(opts.nowrap){return false;}opts.nextSlide=0;}}}}var cb=opts.onPrevNextEvent||opts.prevNextClick;if($.isFunction(cb)){cb(val>0,opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,val>=0);return false;}function buildPager(els,opts){var $p=$(opts.pager);$.each(els,function(i,o){$.fn.cycle.createPagerAnchor(i,o,$p,els,opts);});opts.updateActivePagerLink(opts.pager,opts.startingSlide,opts.activePagerClass);}$.fn.cycle.createPagerAnchor=function(i,el,$p,els,opts){var a;if($.isFunction(opts.pagerAnchorBuilder)){a=opts.pagerAnchorBuilder(i,el);debug("pagerAnchorBuilder("+i+", el) returned: "+a);}else{a='<a href="#">'+(i+1)+"</a>";}if(!a){return;}var $a=$(a);if($a.parents("body").length===0){var arr=[];if($p.length>1){$p.each(function(){var $clone=$a.clone(true);$(this).append($clone);arr.push($clone[0]);});$a=$(arr);}else{$a.appendTo($p);}}opts.pagerAnchors=opts.pagerAnchors||[];opts.pagerAnchors.push($a);$a.bind(opts.pagerEvent,function(e){e.preventDefault();opts.nextSlide=i;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}var cb=opts.onPagerEvent||opts.pagerClick;if($.isFunction(cb)){cb(opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,opts.currSlide<i);});if(!/^click/.test(opts.pagerEvent)&&!opts.allowPagerClickBubble){$a.bind("click.cycle",function(){return false;});}if(opts.pauseOnPagerHover){$a.hover(function(){opts.$cont[0].cyclePause++;},function(){opts.$cont[0].cyclePause--;});}};$.fn.cycle.hopsFromLast=function(opts,fwd){var hops,l=opts.lastSlide,c=opts.currSlide;if(fwd){hops=c>l?c-l:opts.slideCount-l;}else{hops=c<l?l-c:l+opts.slideCount-c;}return hops;};function clearTypeFix($slides){debug("applying clearType background-color hack");function hex(s){s=parseInt(s).toString(16);return s.length<2?"0"+s:s;}function getBg(e){for(;e&&e.nodeName.toLowerCase()!="html";e=e.parentNode){var v=$.css(e,"background-color");if(v.indexOf("rgb")>=0){var rgb=v.match(/\d+/g);return"#"+hex(rgb[0])+hex(rgb[1])+hex(rgb[2]);}if(v&&v!="transparent"){return v;}}return"#ffffff";}$slides.each(function(){$(this).css("background-color",getBg(this));});}$.fn.cycle.commonReset=function(curr,next,opts,w,h,rev){$(opts.elements).not(curr).hide();opts.cssBefore.opacity=1;opts.cssBefore.display="block";if(w!==false&&next.cycleW>0){opts.cssBefore.width=next.cycleW;}if(h!==false&&next.cycleH>0){opts.cssBefore.height=next.cycleH;}opts.cssAfter=opts.cssAfter||{};opts.cssAfter.display="none";$(curr).css("zIndex",opts.slideCount+(rev===true?1:0));$(next).css("zIndex",opts.slideCount+(rev===true?0:1));};$.fn.cycle.custom=function(curr,next,opts,cb,fwd,speedOverride){var $l=$(curr),$n=$(next);var speedIn=opts.speedIn,speedOut=opts.speedOut,easeIn=opts.easeIn,easeOut=opts.easeOut;$n.css(opts.cssBefore);if(speedOverride){if(typeof speedOverride=="number"){speedIn=speedOut=speedOverride;}else{speedIn=speedOut=1;}easeIn=easeOut=null;}var fn=function(){$n.animate(opts.animIn,speedIn,easeIn,cb);};$l.animate(opts.animOut,speedOut,easeOut,function(){if(opts.cssAfter){$l.css(opts.cssAfter);}if(!opts.sync){fn();}});if(opts.sync){fn();}};$.fn.cycle.transitions={fade:function($cont,$slides,opts){$slides.not(":eq("+opts.currSlide+")").css("opacity",0);opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.opacity=0;});opts.animIn={opacity:1};opts.animOut={opacity:0};opts.cssBefore={top:0,left:0};}};$.fn.cycle.ver=function(){return ver;};$.fn.cycle.defaults={fx:"fade",timeout:4000,timeoutFn:null,continuous:0,speed:1000,speedIn:null,speedOut:null,next:null,prev:null,onPrevNextEvent:null,prevNextEvent:"click.cycle",pager:null,onPagerEvent: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:!$.support.opacity,cleartypeNoBg:false,nowrap:0,fastOnEvent:0,randomizeEffects:1,rev:0,manualTrump:true,requeueOnImageNotLoaded:true,requeueTimeout:250,activePagerClass:"activeSlide",updateActivePagerLink:null,backwards:false};})(jQuery);
(function($){$.fn.cycle.transitions.none=function($cont,$slides,opts){opts.fxFn=function(curr,next,opts,after){$(next).show();$(curr).hide();after();};};$.fn.cycle.transitions.scrollUp=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var h=$cont.height();opts.cssBefore={top:h,left:0};opts.cssFirst={top:0};opts.animIn={top:0};opts.animOut={top:-h};};$.fn.cycle.transitions.scrollDown=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var h=$cont.height();opts.cssFirst={top:0};opts.cssBefore={top:-h,left:0};opts.animIn={top:0};opts.animOut={top:h};};$.fn.cycle.transitions.scrollLeft=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var w=$cont.width();opts.cssFirst={left:0};opts.cssBefore={left:w,top:0};opts.animIn={left:0};opts.animOut={left:0-w};};$.fn.cycle.transitions.scrollRight=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var w=$cont.width();opts.cssFirst={left:0};opts.cssBefore={left:-w,top:0};opts.animIn={left:0};opts.animOut={left:w};};$.fn.cycle.transitions.scrollHorz=function($cont,$slides,opts){$cont.css("overflow","hidden").width();opts.before.push(function(curr,next,opts,fwd){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.left=fwd?(next.cycleW-1):(1-next.cycleW);opts.animOut.left=fwd?-curr.cycleW:curr.cycleW;});opts.cssFirst={left:0};opts.cssBefore={top:0};opts.animIn={left:0};opts.animOut={top:0};};$.fn.cycle.transitions.scrollVert=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push(function(curr,next,opts,fwd){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.top=fwd?(1-next.cycleH):(next.cycleH-1);opts.animOut.top=fwd?curr.cycleH:-curr.cycleH;});opts.cssFirst={top:0};opts.cssBefore={left:0};opts.animIn={top:0};opts.animOut={left:0};};$.fn.cycle.transitions.slideX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$(opts.elements).not(curr).hide();$.fn.cycle.commonReset(curr,next,opts,false,true);opts.animIn.width=next.cycleW;});opts.cssBefore={left:0,top:0,width:0};opts.animIn={width:"show"};opts.animOut={width:0};};$.fn.cycle.transitions.slideY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$(opts.elements).not(curr).hide();$.fn.cycle.commonReset(curr,next,opts,true,false);opts.animIn.height=next.cycleH;});opts.cssBefore={left:0,top:0,height:0};opts.animIn={height:"show"};opts.animOut={height:0};};$.fn.cycle.transitions.shuffle=function($cont,$slides,opts){var i,w=$cont.css("overflow","visible").width();$slides.css({left:0,top:0});opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);});if(!opts.speedAdjusted){opts.speed=opts.speed/2;opts.speedAdjusted=true;}opts.random=0;opts.shuffle=opts.shuffle||{left:-w,top:15};opts.els=[];for(i=0;i<$slides.length;i++){opts.els.push($slides[i]);}for(i=0;i<opts.currSlide;i++){opts.els.push(opts.els.shift());}opts.fxFn=function(curr,next,opts,cb,fwd){var $el=fwd?$(curr):$(next);$(next).css(opts.cssBefore);var count=opts.slideCount;$el.animate(opts.shuffle,opts.speedIn,opts.easeIn,function(){var hops=$.fn.cycle.hopsFromLast(opts,fwd);for(var k=0;k<hops;k++){fwd?opts.els.push(opts.els.shift()):opts.els.unshift(opts.els.pop());}if(fwd){for(var i=0,len=opts.els.length;i<len;i++){$(opts.els[i]).css("z-index",len-i+count);}}else{var z=$(curr).css("z-index");$el.css("z-index",parseInt(z)+1+count);}$el.animate({left:0,top:0},opts.speedOut,opts.easeOut,function(){$(fwd?this:curr).hide();if(cb){cb();}});});};opts.cssBefore={display:"block",opacity:1,top:0,left:0};};$.fn.cycle.transitions.turnUp=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.cssBefore.top=next.cycleH;opts.animIn.height=next.cycleH;});opts.cssFirst={top:0};opts.cssBefore={left:0,height:0};opts.animIn={top:0};opts.animOut={height:0};};$.fn.cycle.transitions.turnDown=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssFirst={top:0};opts.cssBefore={left:0,top:0,height:0};opts.animOut={height:0};};$.fn.cycle.transitions.turnLeft=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.cssBefore.left=next.cycleW;opts.animIn.width=next.cycleW;});opts.cssBefore={top:0,width:0};opts.animIn={left:0};opts.animOut={width:0};};$.fn.cycle.transitions.turnRight=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.animIn.width=next.cycleW;opts.animOut.left=curr.cycleW;});opts.cssBefore={top:0,left:0,width:0};opts.animIn={left:0};opts.animOut={width:0};};$.fn.cycle.transitions.zoom=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,false,true);opts.cssBefore.top=next.cycleH/2;opts.cssBefore.left=next.cycleW/2;opts.animIn={top:0,left:0,width:next.cycleW,height:next.cycleH};opts.animOut={width:0,height:0,top:curr.cycleH/2,left:curr.cycleW/2};});opts.cssFirst={top:0,left:0};opts.cssBefore={width:0,height:0};};$.fn.cycle.transitions.fadeZoom=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,false);opts.cssBefore.left=next.cycleW/2;opts.cssBefore.top=next.cycleH/2;opts.animIn={top:0,left:0,width:next.cycleW,height:next.cycleH};});opts.cssBefore={width:0,height:0};opts.animOut={opacity:0};};$.fn.cycle.transitions.blindX=function($cont,$slides,opts){var w=$cont.css("overflow","hidden").width();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.width=next.cycleW;opts.animOut.left=curr.cycleW;});opts.cssBefore={left:w,top:0};opts.animIn={left:0};opts.animOut={left:w};};$.fn.cycle.transitions.blindY=function($cont,$slides,opts){var h=$cont.css("overflow","hidden").height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssBefore={top:h,left:0};opts.animIn={top:0};opts.animOut={top:h};};$.fn.cycle.transitions.blindZ=function($cont,$slides,opts){var h=$cont.css("overflow","hidden").height();var w=$cont.width();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssBefore={top:h,left:w};opts.animIn={top:0,left:0};opts.animOut={top:h,left:w};};$.fn.cycle.transitions.growX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.cssBefore.left=this.cycleW/2;opts.animIn={left:0,width:this.cycleW};opts.animOut={left:0};});opts.cssBefore={width:0,top:0};};$.fn.cycle.transitions.growY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.cssBefore.top=this.cycleH/2;opts.animIn={top:0,height:this.cycleH};opts.animOut={top:0};});opts.cssBefore={height:0,left:0};};$.fn.cycle.transitions.curtainX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true,true);opts.cssBefore.left=next.cycleW/2;opts.animIn={left:0,width:this.cycleW};opts.animOut={left:curr.cycleW/2,width:0};});opts.cssBefore={top:0,width:0};};$.fn.cycle.transitions.curtainY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false,true);opts.cssBefore.top=next.cycleH/2;opts.animIn={top:0,height:next.cycleH};opts.animOut={top:curr.cycleH/2,height:0};});opts.cssBefore={left:0,height:0};};$.fn.cycle.transitions.cover=function($cont,$slides,opts){var d=opts.direction||"left";var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);if(d=="right"){opts.cssBefore.left=-w;}else{if(d=="up"){opts.cssBefore.top=h;}else{if(d=="down"){opts.cssBefore.top=-h;}else{opts.cssBefore.left=w;}}}});opts.animIn={left:0,top:0};opts.animOut={opacity:1};opts.cssBefore={top:0,left:0};};$.fn.cycle.transitions.uncover=function($cont,$slides,opts){var d=opts.direction||"left";var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);if(d=="right"){opts.animOut.left=w;}else{if(d=="up"){opts.animOut.top=-h;}else{if(d=="down"){opts.animOut.top=h;}else{opts.animOut.left=-w;}}}});opts.animIn={left:0,top:0};opts.animOut={opacity:1};opts.cssBefore={top:0,left:0};};$.fn.cycle.transitions.toss=function($cont,$slides,opts){var w=$cont.css("overflow","visible").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);if(!opts.animOut.left&&!opts.animOut.top){opts.animOut={left:w*2,top:-h/2,opacity:0};}else{opts.animOut.opacity=0;}});opts.cssBefore={left:0,top:0};opts.animIn={left:0};};$.fn.cycle.transitions.wipe=function($cont,$slides,opts){var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.cssBefore=opts.cssBefore||{};var clip;if(opts.clip){if(/l2r/.test(opts.clip)){clip="rect(0px 0px "+h+"px 0px)";}else{if(/r2l/.test(opts.clip)){clip="rect(0px "+w+"px "+h+"px "+w+"px)";}else{if(/t2b/.test(opts.clip)){clip="rect(0px "+w+"px 0px 0px)";}else{if(/b2t/.test(opts.clip)){clip="rect("+h+"px "+w+"px "+h+"px 0px)";}else{if(/zoom/.test(opts.clip)){var top=parseInt(h/2);var left=parseInt(w/2);clip="rect("+top+"px "+left+"px "+top+"px "+left+"px)";}}}}}}opts.cssBefore.clip=opts.cssBefore.clip||clip||"rect(0px 0px 0px 0px)";var d=opts.cssBefore.clip.match(/(\d+)/g);var t=parseInt(d[0]),r=parseInt(d[1]),b=parseInt(d[2]),l=parseInt(d[3]);opts.before.push(function(curr,next,opts){if(curr==next){return;}var $curr=$(curr),$next=$(next);$.fn.cycle.commonReset(curr,next,opts,true,true,false);opts.cssAfter.display="block";var step=1,count=parseInt((opts.speedIn/13))-1;(function f(){var tt=t?t-parseInt(step*(t/count)):0;var ll=l?l-parseInt(step*(l/count)):0;var bb=b<h?b+parseInt(step*((h-b)/count||1)):h;var rr=r<w?r+parseInt(step*((w-r)/count||1)):w;$next.css({clip:"rect("+tt+"px "+rr+"px "+bb+"px "+ll+"px)"});(step++<=count)?setTimeout(f,13):$curr.css("display","none");})();});opts.cssBefore={display:"block",opacity:1,top:0,left:0};opts.animIn={left:0};opts.animOut={left:0};};})(jQuery);

/**
 * jQuery Lightbox
 * Version 0.5 - 11/29/2007
 * @author Warren Krewenki
 **/
(function(a){a.fn.lightbox=function(h){var s=a.extend({},a.fn.lightbox.defaults,h);return this.each(function(){a(this).click(function(){e();n(this);return false;});});function e(){a("#overlay").remove();a("#lightbox").remove();s.inprogress=false;if(s.jsonData&&s.jsonData.length>0){var y=s.jsonDataParser?s.jsonDataParser:a.fn.lightbox.parseJsonData;s.imageArray=[];s.imageArray=y(s.jsonData);}var v='<div id="outerImageContainer"><div id="imageContainer"><iframe id="lightboxIframe" /><img id="lightboxImage"><div id="hoverNav"><a href="javascript://" title="'+s.strings.prevLinkTitle+'" id="prevLink"></a><a href="javascript://" id="nextLink" title="'+s.strings.nextLinkTitle+'"></a></div><div id="loading"><a href="javascript://" id="loadingLink"><img src="'+s.fileLoadingImage+'"></a></div></div></div>';var x='<div id="imageDataContainer" class="clearfix"><div id="imageData"><div id="imageDetails"><span id="caption"></span><span id="numberDisplay"></span></div><div id="bottomNav">';if(s.displayHelp){x+='<span id="helpDisplay">'+s.strings.help+"</span>";}x+='<a href="javascript://" id="bottomNavClose" title="'+s.strings.closeTitle+'"><img src="'+s.fileBottomNavCloseImage+'"></a></div></div></div>';var w;if(s.navbarOnTop){w='<div id="overlay"></div><div id="lightbox">'+x+v+"</div>";a("body").append(w);a("#imageDataContainer").addClass("ontop");}else{w='<div id="overlay"></div><div id="lightbox">'+v+x+"</div>";a("body").append(w);}a("#overlay").click(function(){l();}).hide();a("#lightbox").click(function(){l();}).hide();a("#loadingLink").click(function(){l();return false;});a("#bottomNavClose").click(function(){l();return false;});a("#outerImageContainer").width(s.widthCurrent).height(s.heightCurrent);a("#imageDataContainer").width(s.widthCurrent);if(!s.imageClickClose){a("#lightboxImage").click(function(){return false;});a("#hoverNav").click(function(){return false;});}}function u(){var v=new Array(a(document).width(),a(document).height(),a(window).width(),a(window).height());return v;}function g(){var x,v;if(self.pageYOffset){v=self.pageYOffset;x=self.pageXOffset;}else{if(document.documentElement&&document.documentElement.scrollTop){v=document.documentElement.scrollTop;x=document.documentElement.scrollLeft;}else{if(document.body){v=document.body.scrollTop;x=document.body.scrollLeft;}}}var w=new Array(x,v);return w;}function o(x){var w=new Date();var v=null;do{v=new Date();}while(v-w<x);}function n(z){a("select, embed, object").hide();var w=u();a("#overlay").hide().css({width:"100%",height:w[1]+"px",opacity:s.overlayOpacity}).fadeIn();imageNum=0;if(!s.jsonData){s.imageArray=[];if(!z.rel||(z.rel=="")){s.imageArray.push(new Array(z.href,s.displayTitle?z.title:""));}else{a("a").each(function(){if(this.href&&(this.rel==z.rel)){s.imageArray.push(new Array(this.href,s.displayTitle?this.title:""));}});}}if(s.imageArray.length>1){for(i=0;i<s.imageArray.length;i++){for(j=s.imageArray.length-1;j>i;j--){if(s.imageArray[i][0]==s.imageArray[j][0]){s.imageArray.splice(j,1);}}}while(s.imageArray[imageNum][0]!=z.href){imageNum++;}}var v=g();var y=v[1]+(w[3]/10);var x=v[0];a("#lightbox").css({top:y+"px",left:x+"px"}).show();if(!s.slideNavBar){a("#imageData").hide();}t(imageNum);}function t(v){if(s.inprogress==false){s.inprogress=true;s.activeImage=v;a("#loading").show();a("#lightboxImage").hide();a("#hoverNav").hide();a("#prevLink").hide();a("#nextLink").hide();if(s.slideNavBar){a("#imageDataContainer").hide();a("#imageData").hide();k();}else{k();}}}function k(){imgPreloader=new Image();imgPreloader.onload=function(){var z=imgPreloader.width;var v=imgPreloader.height;if(s.fitToScreen){var x=u();var y;var w=x[2]-2*s.borderSize;var A=x[3]-200;if(imgPreloader.height>A){z=parseInt((A/imgPreloader.height)*imgPreloader.width);v=A;}else{if(imgPreloader.width>w){v=parseInt((w/imgPreloader.width)*imgPreloader.height);z=w;}}}a("#lightboxImage").attr("src",s.imageArray[s.activeImage][0]).width(z).height(v);m(z,v);};imgPreloader.src=s.imageArray[s.activeImage][0];}function l(){p();a("#lightbox").hide();a("#overlay").fadeOut();a("select, object, embed").show();}function f(){if(s.loopImages&&s.imageArray.length>1){preloadNextImage=new Image();preloadNextImage.src=s.imageArray[(s.activeImage==(s.imageArray.length-1))?0:s.activeImage+1][0];preloadPrevImage=new Image();preloadPrevImage.src=s.imageArray[(s.activeImage==0)?(s.imageArray.length-1):s.activeImage-1][0];}else{if((s.imageArray.length-1)>s.activeImage){preloadNextImage=new Image();preloadNextImage.src=s.imageArray[s.activeImage+1][0];}if(s.activeImage>0){preloadPrevImage=new Image();preloadPrevImage.src=s.imageArray[s.activeImage-1][0];}}}function m(y,w){s.widthCurrent=a("#outerImageContainer").outerWidth();s.heightCurrent=a("#outerImageContainer").outerHeight();var v=Math.max(350,y+(s.borderSize*2));var x=(w+(s.borderSize*2));s.xScale=(v/s.widthCurrent)*100;s.yScale=(x/s.heightCurrent)*100;wDiff=s.widthCurrent-v;hDiff=s.heightCurrent-x;a("#imageDataContainer").animate({width:v},s.resizeSpeed,"linear");a("#outerImageContainer").animate({width:v},s.resizeSpeed,"linear",function(){a("#outerImageContainer").animate({height:x},s.resizeSpeed,"linear",function(){d();});});if((hDiff==0)&&(wDiff==0)){if(jQuery.browser.msie){o(250);}else{o(100);}}a("#prevLink").height(w);a("#nextLink").height(w);}function d(){a("#loading").hide();a("#lightboxImage").fadeIn("fast");c();f();s.inprogress=false;}function c(){a("#numberDisplay").html("");if(s.imageArray[s.activeImage][1]){a("#caption").html(s.imageArray[s.activeImage][1]).show();}if(s.imageArray.length>1){var w;w=s.strings.image+(s.activeImage+1)+s.strings.of+s.imageArray.length;if(!s.disableNavbarLinks){if((s.activeImage)>0||s.loopImages){w='<a title="'+s.strings.prevLinkTitle+'" href="#" id="prevLinkText">'+s.strings.prevLinkText+"</a>"+w;}if(((s.activeImage+1)<s.imageArray.length)||s.loopImages){w+='<a title="'+s.strings.nextLinkTitle+'" href="#" id="nextLinkText">'+s.strings.nextLinkText+"</a>";}}a("#numberDisplay").html(w).show();}if(s.slideNavBar){a("#imageData").slideDown(s.navBarSlideSpeed);}else{a("#imageData").show();}var v=u();a("#overlay").height(v[1]);q();}function q(){if(s.imageArray.length>1){a("#hoverNav").show();if(s.loopImages){a("#prevLink,#prevLinkText").show().click(function(){t((s.activeImage==0)?(s.imageArray.length-1):s.activeImage-1);return false;});a("#nextLink,#nextLinkText").show().click(function(){t((s.activeImage==(s.imageArray.length-1))?0:s.activeImage+1);return false;});}else{if(s.activeImage!=0){a("#prevLink,#prevLinkText").show().click(function(){t(s.activeImage-1);return false;});}if(s.activeImage!=(s.imageArray.length-1)){a("#nextLink,#nextLinkText").show().click(function(){t(s.activeImage+1);return false;});}}b();}}function r(y){var z=y.data.opts;var v=y.keyCode;var w=27;var x=String.fromCharCode(v).toLowerCase();if((x=="x")||(x=="o")||(x=="c")||(v==w)){l();}else{if((x=="p")||(v==37)){if(z.loopImages){p();t((z.activeImage==0)?(z.imageArray.length-1):z.activeImage-1);}else{if(z.activeImage!=0){p();t(z.activeImage-1);}}}else{if((x=="n")||(v==39)){if(s.loopImages){p();t((z.activeImage==(z.imageArray.length-1))?0:z.activeImage+1);}else{if(z.activeImage!=(z.imageArray.length-1)){p();t(z.activeImage+1);}}}}}}function b(){a(document).bind("keydown",{opts:s},r);}function p(){a(document).unbind("keydown");}};a.fn.lightbox.parseJsonData=function(c){var b=[];a.each(c,function(){b.push(new Array(this.url,this.title));});return b;};a.fn.lightbox.defaults={fileLoadingImage:"/style/loading.gif",fileBottomNavCloseImage:"/style/close.gif",overlayOpacity:0.8,borderSize:10,imageArray:new Array,activeImage:null,inprogress:false,resizeSpeed:350,widthCurrent:250,heightCurrent:250,xScale:1,yScale:1,displayTitle:true,navbarOnTop:false,slideNavBar:false,navBarSlideSpeed:350,displayHelp:false,strings:{help:" \u2190 / P - previous image\u00a0\u00a0\u00a0\u00a0\u2192 / N - next image\u00a0\u00a0\u00a0\u00a0ESC / X - close image gallery",prevLinkTitle:"previous image",nextLinkTitle:"next image",prevLinkText:"&laquo; Previous",nextLinkText:"Next &raquo;",closeTitle:"close image gallery",image:"Image ",of:" of "},fitToScreen:false,disableNavbarLinks:false,loopImages:false,imageClickClose:true,jsonData:null,jsonDataParser:null};})(jQuery);

/*
 * Date Format 1.2.3
 * (c) 2007-2009 Steven Levithan <stevenlevithan.com>
 * MIT license
 */
var dateFormat=function(){var a=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,b=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,d=/[^-+\dA-Z]/g,c=function(f,e){f=String(f);e=e||2;while(f.length<e){f="0"+f}return f};return function(i,v,q){var g=dateFormat;if(arguments.length==1&&Object.prototype.toString.call(i)=="[object String]"&&!/\d/.test(i)){v=i;i=undefined}i=i?new Date(i):new Date;if(isNaN(i)){throw SyntaxError("invalid date")}v=String(g.masks[v]||v||g.masks["default"]);if(v.slice(0,4)=="UTC:"){v=v.slice(4);q=true}var t=q?"getUTC":"get",l=i[t+"Date"](),e=i[t+"Day"](),j=i[t+"Month"](),p=i[t+"FullYear"](),r=i[t+"Hours"](),k=i[t+"Minutes"](),u=i[t+"Seconds"](),n=i[t+"Milliseconds"](),f=q?0:i.getTimezoneOffset(),h={d:l,dd:c(l),ddd:g.i18n.dayNames[e],dddd:g.i18n.dayNames[e+7],m:j+1,mm:c(j+1),mmm:g.i18n.monthNames[j],mmmm:g.i18n.monthNames[j+12],yy:String(p).slice(2),yyyy:p,h:r%12||12,hh:c(r%12||12),H:r,HH:c(r),M:k,MM:c(k),s:u,ss:c(u),l:c(n,3),L:c(n>99?Math.round(n/10):n),t:r<12?"a":"p",tt:r<12?"am":"pm",T:r<12?"A":"P",TT:r<12?"AM":"PM",Z:q?"UTC":(String(i).match(b)||[""]).pop().replace(d,""),o:(f>0?"-":"+")+c(Math.floor(Math.abs(f)/60)*100+Math.abs(f)%60,4),S:["th","st","nd","rd"][l%10>3?0:(l%100-l%10!=10)*l%10]};return v.replace(a,function(m){return m in h?h[m]:m.slice(1,m.length-1)})}}();dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};Date.prototype.format=function(a,b){return dateFormat(this,a,b)};

/**
 * Date picker
 * Author: Stefan Petre www.eyecon.ro
 */
(function(b){var a=function(){var c={},n={years:"datepickerViewYears",moths:"datepickerViewMonths",days:"datepickerViewDays"},k={wrapper:'<div class="datepicker"><div class="datepickerBorderT" /><div class="datepickerBorderB" /><div class="datepickerBorderL" /><div class="datepickerBorderR" /><div class="datepickerBorderTL" /><div class="datepickerBorderTR" /><div class="datepickerBorderBL" /><div class="datepickerBorderBR" /><div class="datepickerContainer"><table cellspacing="0" cellpadding="0"><tbody><tr></tr></tbody></table></div></div>',head:["<td>",'<table cellspacing="0" cellpadding="0">',"<thead>","<tr>",'<th class="datepickerGoPrev"><a href="#"><span><%=prev%></span></a></th>','<th colspan="6" class="datepickerMonth"><a href="#"><span></span></a></th>','<th class="datepickerGoNext"><a href="#"><span><%=next%></span></a></th>',"</tr>",'<tr class="datepickerDoW">',"<th><span><%=week%></span></th>","<th><span><%=day1%></span></th>","<th><span><%=day2%></span></th>","<th><span><%=day3%></span></th>","<th><span><%=day4%></span></th>","<th><span><%=day5%></span></th>","<th><span><%=day6%></span></th>","<th><span><%=day7%></span></th>","</tr>","</thead>","</table></td>"],space:'<td class="datepickerSpace"><div></div></td>',days:['<tbody class="datepickerDays">',"<tr>",'<th class="datepickerWeek"><a href="#"><span><%=weeks[0].week%></span></a></th>','<td class="<%=weeks[0].days[0].classname%>"><a href="#"><span><%=weeks[0].days[0].text%></span></a></td>','<td class="<%=weeks[0].days[1].classname%>"><a href="#"><span><%=weeks[0].days[1].text%></span></a></td>','<td class="<%=weeks[0].days[2].classname%>"><a href="#"><span><%=weeks[0].days[2].text%></span></a></td>','<td class="<%=weeks[0].days[3].classname%>"><a href="#"><span><%=weeks[0].days[3].text%></span></a></td>','<td class="<%=weeks[0].days[4].classname%>"><a href="#"><span><%=weeks[0].days[4].text%></span></a></td>','<td class="<%=weeks[0].days[5].classname%>"><a href="#"><span><%=weeks[0].days[5].text%></span></a></td>','<td class="<%=weeks[0].days[6].classname%>"><a href="#"><span><%=weeks[0].days[6].text%></span></a></td>',"</tr>","<tr>",'<th class="datepickerWeek"><a href="#"><span><%=weeks[1].week%></span></a></th>','<td class="<%=weeks[1].days[0].classname%>"><a href="#"><span><%=weeks[1].days[0].text%></span></a></td>','<td class="<%=weeks[1].days[1].classname%>"><a href="#"><span><%=weeks[1].days[1].text%></span></a></td>','<td class="<%=weeks[1].days[2].classname%>"><a href="#"><span><%=weeks[1].days[2].text%></span></a></td>','<td class="<%=weeks[1].days[3].classname%>"><a href="#"><span><%=weeks[1].days[3].text%></span></a></td>','<td class="<%=weeks[1].days[4].classname%>"><a href="#"><span><%=weeks[1].days[4].text%></span></a></td>','<td class="<%=weeks[1].days[5].classname%>"><a href="#"><span><%=weeks[1].days[5].text%></span></a></td>','<td class="<%=weeks[1].days[6].classname%>"><a href="#"><span><%=weeks[1].days[6].text%></span></a></td>',"</tr>","<tr>",'<th class="datepickerWeek"><a href="#"><span><%=weeks[2].week%></span></a></th>','<td class="<%=weeks[2].days[0].classname%>"><a href="#"><span><%=weeks[2].days[0].text%></span></a></td>','<td class="<%=weeks[2].days[1].classname%>"><a href="#"><span><%=weeks[2].days[1].text%></span></a></td>','<td class="<%=weeks[2].days[2].classname%>"><a href="#"><span><%=weeks[2].days[2].text%></span></a></td>','<td class="<%=weeks[2].days[3].classname%>"><a href="#"><span><%=weeks[2].days[3].text%></span></a></td>','<td class="<%=weeks[2].days[4].classname%>"><a href="#"><span><%=weeks[2].days[4].text%></span></a></td>','<td class="<%=weeks[2].days[5].classname%>"><a href="#"><span><%=weeks[2].days[5].text%></span></a></td>','<td class="<%=weeks[2].days[6].classname%>"><a href="#"><span><%=weeks[2].days[6].text%></span></a></td>',"</tr>","<tr>",'<th class="datepickerWeek"><a href="#"><span><%=weeks[3].week%></span></a></th>','<td class="<%=weeks[3].days[0].classname%>"><a href="#"><span><%=weeks[3].days[0].text%></span></a></td>','<td class="<%=weeks[3].days[1].classname%>"><a href="#"><span><%=weeks[3].days[1].text%></span></a></td>','<td class="<%=weeks[3].days[2].classname%>"><a href="#"><span><%=weeks[3].days[2].text%></span></a></td>','<td class="<%=weeks[3].days[3].classname%>"><a href="#"><span><%=weeks[3].days[3].text%></span></a></td>','<td class="<%=weeks[3].days[4].classname%>"><a href="#"><span><%=weeks[3].days[4].text%></span></a></td>','<td class="<%=weeks[3].days[5].classname%>"><a href="#"><span><%=weeks[3].days[5].text%></span></a></td>','<td class="<%=weeks[3].days[6].classname%>"><a href="#"><span><%=weeks[3].days[6].text%></span></a></td>',"</tr>","<tr>",'<th class="datepickerWeek"><a href="#"><span><%=weeks[4].week%></span></a></th>','<td class="<%=weeks[4].days[0].classname%>"><a href="#"><span><%=weeks[4].days[0].text%></span></a></td>','<td class="<%=weeks[4].days[1].classname%>"><a href="#"><span><%=weeks[4].days[1].text%></span></a></td>','<td class="<%=weeks[4].days[2].classname%>"><a href="#"><span><%=weeks[4].days[2].text%></span></a></td>','<td class="<%=weeks[4].days[3].classname%>"><a href="#"><span><%=weeks[4].days[3].text%></span></a></td>','<td class="<%=weeks[4].days[4].classname%>"><a href="#"><span><%=weeks[4].days[4].text%></span></a></td>','<td class="<%=weeks[4].days[5].classname%>"><a href="#"><span><%=weeks[4].days[5].text%></span></a></td>','<td class="<%=weeks[4].days[6].classname%>"><a href="#"><span><%=weeks[4].days[6].text%></span></a></td>',"</tr>","<tr>",'<th class="datepickerWeek"><a href="#"><span><%=weeks[5].week%></span></a></th>','<td class="<%=weeks[5].days[0].classname%>"><a href="#"><span><%=weeks[5].days[0].text%></span></a></td>','<td class="<%=weeks[5].days[1].classname%>"><a href="#"><span><%=weeks[5].days[1].text%></span></a></td>','<td class="<%=weeks[5].days[2].classname%>"><a href="#"><span><%=weeks[5].days[2].text%></span></a></td>','<td class="<%=weeks[5].days[3].classname%>"><a href="#"><span><%=weeks[5].days[3].text%></span></a></td>','<td class="<%=weeks[5].days[4].classname%>"><a href="#"><span><%=weeks[5].days[4].text%></span></a></td>','<td class="<%=weeks[5].days[5].classname%>"><a href="#"><span><%=weeks[5].days[5].text%></span></a></td>','<td class="<%=weeks[5].days[6].classname%>"><a href="#"><span><%=weeks[5].days[6].text%></span></a></td>',"</tr>","</tbody>"],months:['<tbody class="<%=className%>">',"<tr>",'<td colspan="2"><a href="#"><span><%=data[0]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[1]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[2]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[3]%></span></a></td>',"</tr>","<tr>",'<td colspan="2"><a href="#"><span><%=data[4]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[5]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[6]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[7]%></span></a></td>',"</tr>","<tr>",'<td colspan="2"><a href="#"><span><%=data[8]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[9]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[10]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[11]%></span></a></td>',"</tr>","</tbody>"]},g={flat:false,starts:1,prev:"&#9664;",next:"&#9654;",lastSel:false,mode:"single",view:"days",calendars:1,format:"Y-m-d",position:"bottom",eventName:"click",onRender:function(){return{}},onChange:function(){return true},onShow:function(){return true},onBeforeShow:function(){return true},onHide:function(){return true},locale:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekMin:"wk"}},p=function(r){var u=b(r).data("datepicker");var y=b(r);var s=Math.floor(u.calendars/2),G,I,z,H,E=0,C,v,t,w,x,A;y.find("td>table tbody").remove();for(var F=0;F<u.calendars;F++){G=new Date(u.current);G.addMonths(-s+F);A=y.find("table").eq(F+1);switch(A[0].className){case"datepickerViewDays":z=q(G,"B, Y");break;case"datepickerViewMonths":z=G.getFullYear();break;case"datepickerViewYears":z=(G.getFullYear()-6)+" - "+(G.getFullYear()+5);break}A.find("thead tr:first th:eq(1) span").text(z);z=G.getFullYear()-6;I={data:[],className:"datepickerYears"};for(var D=0;D<12;D++){I.data.push(z+D)}x=tmpl(k.months.join(""),I);G.setDate(1);I={weeks:[],test:10};H=G.getMonth();var z=(G.getDay()-u.starts)%7;G.addDays(-(z+(z<0?7:0)));C=-1;E=0;while(E<42){t=parseInt(E/7,10);w=E%7;if(!I.weeks[t]){C=G.getWeekNumber();I.weeks[t]={week:C,days:[]}}I.weeks[t].days[w]={text:G.getDate(),classname:[]};if(H!=G.getMonth()){I.weeks[t].days[w].classname.push("datepickerNotInMonth")}if(G.getDay()==0){I.weeks[t].days[w].classname.push("datepickerSunday")}if(G.getDay()==6){I.weeks[t].days[w].classname.push("datepickerSaturday")}var B=u.onRender(G);var J=G.valueOf();if(B.selected||u.date==J||b.inArray(J,u.date)>-1||(u.mode=="range"&&J>=u.date[0]&&J<=u.date[1])){I.weeks[t].days[w].classname.push("datepickerSelected")}if(B.disabled){I.weeks[t].days[w].classname.push("datepickerDisabled")}if(B.className){I.weeks[t].days[w].classname.push(B.className)}I.weeks[t].days[w].classname=I.weeks[t].days[w].classname.join(" ");E++;G.addDays(1)}x=tmpl(k.days.join(""),I)+x;I={data:u.locale.monthsShort,className:"datepickerMonths"};x=tmpl(k.months.join(""),I)+x;A.append(x)}},e=function(s,C){if(s.constructor==Date){return new Date(s)}var w=s.split(/\W+/);var t=C.split(/\W+/),A,u,B,z,v,r=new Date();for(var x=0;x<w.length;x++){switch(t[x]){case"d":case"e":A=parseInt(w[x],10);break;case"m":u=parseInt(w[x],10)-1;break;case"Y":case"y":B=parseInt(w[x],10);B+=B>100?0:(B<29?2000:1900);break;case"H":case"I":case"k":case"l":z=parseInt(w[x],10);break;case"P":case"p":if(/pm/i.test(w[x])&&z<12){z+=12}else{if(/am/i.test(w[x])&&z>=12){z-=12}}break;case"M":v=parseInt(w[x],10);break}}return new Date(B===undefined?r.getFullYear():B,u===undefined?r.getMonth():u,A===undefined?r.getDate():A,z===undefined?r.getHours():z,v===undefined?r.getMinutes():v,0)},q=function(t,F){var u=t.getMonth();var D=t.getDate();var E=t.getFullYear();var G=t.getWeekNumber();var H=t.getDay();var K={};var I=t.getHours();var v=(I>=12);var B=(v)?(I-12):I;var J=t.getDayOfYear();if(B==0){B=12}var z=t.getMinutes();var C=t.getSeconds();var x=F.split(""),r;for(var A=0;A<x.length;A++){r=x[A];switch(x[A]){case"a":r=t.getDayName();break;case"A":r=t.getDayName(true);break;case"b":r=t.getMonthName();break;case"B":r=t.getMonthName(true);break;case"C":r=1+Math.floor(E/100);break;case"d":r=(D<10)?("0"+D):D;break;case"e":r=D;break;case"H":r=(I<10)?("0"+I):I;break;case"I":r=(B<10)?("0"+B):B;break;case"j":r=(J<100)?((J<10)?("00"+J):("0"+J)):J;break;case"k":r=I;break;case"l":r=B;break;case"m":r=(u<9)?("0"+(1+u)):(1+u);break;case"M":r=(z<10)?("0"+z):z;break;case"p":case"P":r=v?"PM":"AM";break;case"s":r=Math.floor(t.getTime()/1000);break;case"S":r=(C<10)?("0"+C):C;break;case"u":r=H+1;break;case"w":r=H;break;case"y":r=(""+E).substr(2,2);break;case"Y":r=E;break}x[A]=r}return x.join("")},f=function(r){if(Date.prototype.tempDate){return}Date.prototype.tempDate=null;Date.prototype.months=r.months;Date.prototype.monthsShort=r.monthsShort;Date.prototype.days=r.days;Date.prototype.daysShort=r.daysShort;Date.prototype.getMonthName=function(s){return this[s?"months":"monthsShort"][this.getMonth()]};Date.prototype.getDayName=function(s){return this[s?"days":"daysShort"][this.getDay()]};Date.prototype.addDays=function(s){this.setDate(this.getDate()+s);this.tempDate=this.getDate()};Date.prototype.addMonths=function(s){if(this.tempDate==null){this.tempDate=this.getDate()}this.setDate(1);this.setMonth(this.getMonth()+s);this.setDate(Math.min(this.tempDate,this.getMaxDays()))};Date.prototype.addYears=function(s){if(this.tempDate==null){this.tempDate=this.getDate()}this.setDate(1);this.setFullYear(this.getFullYear()+s);this.setDate(Math.min(this.tempDate,this.getMaxDays()))};Date.prototype.getMaxDays=function(){var t=new Date(Date.parse(this)),u=28,s;s=t.getMonth();u=28;while(t.getMonth()==s){u++;t.setDate(u)}return u-1};Date.prototype.getFirstDay=function(){var s=new Date(Date.parse(this));s.setDate(1);return s.getDay()};Date.prototype.getWeekNumber=function(){var s=new Date(this);s.setDate(s.getDate()-(s.getDay()+6)%7+3);var t=s.valueOf();s.setMonth(0);s.setDate(4);return Math.round((t-s.valueOf())/(604800000))+1};Date.prototype.getDayOfYear=function(){var s=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var u=new Date(this.getFullYear(),0,0,0,0,0);var t=s-u;return Math.floor(t/24*60*60*1000)}},i=function(v){var s=b(v).data("datepicker");var x=b("#"+s.id);if(!s.extraHeight){var u=b(v).find("div");s.extraHeight=u.get(0).offsetHeight+u.get(1).offsetHeight;s.extraWidth=u.get(2).offsetWidth+u.get(3).offsetWidth}var w=x.find("table:first").get(0);var t=w.offsetWidth;var r=w.offsetHeight;x.css({width:t+s.extraWidth+"px",height:r+s.extraHeight+"px"}).find("div.datepickerContainer").css({width:t+"px",height:r+"px"})},o=function(y){if(b(y.target).is("span")){y.target=y.target.parentNode}var t=b(y.target);if(t.is("a")){y.target.blur();if(t.hasClass("datepickerDisabled")){return false}var A=b(this).data("datepicker");var x=t.parent();var s=x.parent().parent().parent();var z=b("table",this).index(s.get(0))-1;var w=new Date(A.current);var v=false;var r=false;if(x.is("th")){if(x.hasClass("datepickerWeek")&&A.mode=="range"&&!x.next().hasClass("datepickerDisabled")){var u=parseInt(x.next().text(),10);w.addMonths(z-Math.floor(A.calendars/2));if(x.next().hasClass("datepickerNotInMonth")){w.addMonths(u>15?-1:1)}w.setDate(u);A.date[0]=(w.setHours(0,0,0,0)).valueOf();w.setHours(23,59,59,0);w.addDays(6);A.date[1]=w.valueOf();r=true;v=true;A.lastSel=false}else{if(x.hasClass("datepickerMonth")){w.addMonths(z-Math.floor(A.calendars/2));switch(s.get(0).className){case"datepickerViewDays":s.get(0).className="datepickerViewMonths";t.find("span").text(w.getFullYear());break;case"datepickerViewMonths":s.get(0).className="datepickerViewYears";t.find("span").text((w.getFullYear()-6)+" - "+(w.getFullYear()+5));break;case"datepickerViewYears":s.get(0).className="datepickerViewDays";t.find("span").text(q(w,"B, Y"));break}}else{if(x.parent().parent().is("thead")){switch(s.get(0).className){case"datepickerViewDays":A.current.addMonths(x.hasClass("datepickerGoPrev")?-1:1);break;case"datepickerViewMonths":A.current.addYears(x.hasClass("datepickerGoPrev")?-1:1);break;case"datepickerViewYears":A.current.addYears(x.hasClass("datepickerGoPrev")?-12:12);break}r=true}}}}else{if(x.is("td")&&!x.hasClass("datepickerDisabled")){switch(s.get(0).className){case"datepickerViewMonths":A.current.setMonth(s.find("tbody.datepickerMonths td").index(x));A.current.setFullYear(parseInt(s.find("thead th.datepickerMonth span").text(),10));A.current.addMonths(Math.floor(A.calendars/2)-z);s.get(0).className="datepickerViewDays";break;case"datepickerViewYears":A.current.setFullYear(parseInt(t.text(),10));s.get(0).className="datepickerViewMonths";break;default:var u=parseInt(t.text(),10);w.addMonths(z-Math.floor(A.calendars/2));if(x.hasClass("datepickerNotInMonth")){w.addMonths(u>15?-1:1)}w.setDate(u);switch(A.mode){case"multiple":u=(w.setHours(0,0,0,0)).valueOf();if(b.inArray(u,A.date)>-1){b.each(A.date,function(B,C){if(C==u){A.date.splice(B,1);return false}})}else{A.date.push(u)}break;case"range":if(!A.lastSel){A.date[0]=(w.setHours(0,0,0,0)).valueOf()}u=(w.setHours(23,59,59,0)).valueOf();if(u<A.date[0]){A.date[1]=A.date[0]+86399000;A.date[0]=u-86399000}else{A.date[1]=u}A.lastSel=!A.lastSel;break;default:A.date=w.valueOf();break}break}r=true;v=true}}if(r){p(this)}if(v){A.onChange.apply(this,j(A))}}return false},j=function(r){var s;if(r.mode=="single"){s=new Date(r.date);return[q(s,r.format),s,r.el]}else{s=[[],[],r.el];b.each(r.date,function(u,v){var t=new Date(v);s[0].push(q(t,r.format));s[1].push(t)});return s}},d=function(){var r=document.compatMode=="CSS1Compat";return{l:window.pageXOffset||(r?document.documentElement.scrollLeft:document.body.scrollLeft),t:window.pageYOffset||(r?document.documentElement.scrollTop:document.body.scrollTop),w:window.innerWidth||(r?document.documentElement.clientWidth:document.body.clientWidth),h:window.innerHeight||(r?document.documentElement.clientHeight:document.body.clientHeight)}},l=function(t,s,r){if(t==s){return true}if(t.contains){return t.contains(s)}if(t.compareDocumentPosition){return !!(t.compareDocumentPosition(s)&16)}var u=s.parentNode;while(u&&u!=r){if(u==t){return true}u=u.parentNode}return false},m=function(w){var r=b("#"+b(this).data("datepickerId"));if(!r.is(":visible")){var x=r.get(0);p(x);var z=r.data("datepicker");z.onBeforeShow.apply(this,[r.get(0)]);var u=b(this).offset();var y=d();var v=u.top;var s=u.left;var t=b.curCSS(x,"display");r.css({visibility:"hidden",display:"block"});i(x);switch(z.position){case"top":v-=x.offsetHeight;break;case"left":s-=x.offsetWidth;break;case"right":s+=this.offsetWidth;break;case"bottom":v+=this.offsetHeight;break}if(v+x.offsetHeight>y.t+y.h){v=u.top-x.offsetHeight}if(v<y.t){v=u.top+this.offsetHeight+x.offsetHeight}if(s+x.offsetWidth>y.l+y.w){s=u.left-x.offsetWidth}if(s<y.l){s=u.left+this.offsetWidth}r.css({visibility:"visible",display:"block",top:v+"px",left:s+"px"});if(z.onShow.apply(this,[r.get(0)])!=false){r.show()}b(document).bind("mousedown",{cal:r,trigger:this},h)}return false},h=function(r){if(r.target!=r.data.trigger&&!l(r.data.cal.get(0),r.target,r.data.cal.get(0))){if(r.data.cal.data("datepicker").onHide.apply(this,[r.data.cal.get(0)])!=false){r.data.cal.hide()}b(document).unbind("mousedown",h)}};return{init:function(r){r=b.extend({},g,r||{});f(r.locale);r.calendars=Math.max(1,parseInt(r.calendars,10)||1);r.mode=/single|multiple|range/.test(r.mode)?r.mode:"single";return this.each(function(){if(!b(this).data("datepicker")){r.el=this;if(r.date.constructor==String){r.date=e(r.date,r.format);r.date.setHours(0,0,0,0)}if(r.mode!="single"){if(r.date.constructor!=Array){r.date=[r.date.valueOf()];if(r.mode=="range"){r.date.push(((new Date(r.date[0])).setHours(23,59,59,0)).valueOf())}}else{for(var u=0;u<r.date.length;u++){r.date[u]=(e(r.date[u],r.format).setHours(0,0,0,0)).valueOf()}if(r.mode=="range"){r.date[1]=((new Date(r.date[1])).setHours(23,59,59,0)).valueOf()}}}else{r.date=r.date.valueOf()}if(!r.current){r.current=new Date()}else{r.current=e(r.current,r.format)}r.current.setDate(1);r.current.setHours(0,0,0,0);var w="datepicker_"+parseInt(Math.random()*1000),t;r.id=w;b(this).data("datepickerId",r.id);var v=b(k.wrapper).attr("id",w).bind("click",o).data("datepicker",r);if(r.className){v.addClass(r.className)}var s="";for(var u=0;u<r.calendars;u++){t=r.starts;if(u>0){s+=k.space}s+=tmpl(k.head.join(""),{week:r.locale.weekMin,prev:r.prev,next:r.next,day1:r.locale.daysMin[(t++)%7],day2:r.locale.daysMin[(t++)%7],day3:r.locale.daysMin[(t++)%7],day4:r.locale.daysMin[(t++)%7],day5:r.locale.daysMin[(t++)%7],day6:r.locale.daysMin[(t++)%7],day7:r.locale.daysMin[(t++)%7]})}v.find("tr:first").append(s).find("table").addClass(n[r.view]);p(v.get(0));if(r.flat){v.appendTo(this).show().css("position","relative");i(v.get(0))}else{v.appendTo(document.body);b(this).bind(r.eventName,m)}}})},showPicker:function(){return this.each(function(){if(b(this).data("datepickerId")){m.apply(this)}})},hidePicker:function(){return this.each(function(){if(b(this).data("datepickerId")){b("#"+b(this).data("datepickerId")).hide()}})},setDate:function(r,s){return this.each(function(){if(b(this).data("datepickerId")){var v=b("#"+b(this).data("datepickerId"));var t=v.data("datepicker");t.date=r;if(t.date.constructor==String){t.date=e(t.date,t.format);t.date.setHours(0,0,0,0)}if(t.mode!="single"){if(t.date.constructor!=Array){t.date=[t.date.valueOf()];if(t.mode=="range"){t.date.push(((new Date(t.date[0])).setHours(23,59,59,0)).valueOf())}}else{for(var u=0;u<t.date.length;u++){t.date[u]=(e(t.date[u],t.format).setHours(0,0,0,0)).valueOf()}if(t.mode=="range"){t.date[1]=((new Date(t.date[1])).setHours(23,59,59,0)).valueOf()}}}else{t.date=t.date.valueOf()}if(s){t.current=new Date(t.mode!="single"?t.date[0]:t.date)}p(v.get(0))}})},getDate:function(r){if(this.size()>0){return j(b("#"+b(this).data("datepickerId")).data("datepicker"))[r?0:1]}},clear:function(){return this.each(function(){if(b(this).data("datepickerId")){var s=b("#"+b(this).data("datepickerId"));var r=s.data("datepicker");if(r.mode!="single"){r.date=[];p(s.get(0))}}})},fixLayout:function(){return this.each(function(){if(b(this).data("datepickerId")){var s=b("#"+b(this).data("datepickerId"));var r=s.data("datepicker");if(r.flat){i(s.get(0))}}})}}}();b.fn.extend({DatePicker:a.init,DatePickerHide:a.hidePicker,DatePickerShow:a.showPicker,DatePickerSetDate:a.setDate,DatePickerGetDate:a.getDate,DatePickerClear:a.clear,DatePickerLayout:a.fixLayout})})(jQuery);(function(){var b={};this.tmpl=function a(e,d){var c=!/\W/.test(e)?b[e]=b[e]||a(document.getElementById(e).innerHTML):new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+e.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split("\t").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');");return d?c(d):c}})();

/**
 * jQuery custom checkboxes
 * Copyright (c) 2008 Khavilo Dmitry (http://widowmaker.kiev.ua/checkbox/)
 * @version 1.3.0 Beta 1
**/
(function($){var i=function(e){if(!e)var e=window.event;e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation()};$.fn.checkbox=function(f){try{document.execCommand('BackgroundImageCache',false,true)}catch(e){}var g={cls:'jquery-checkbox',empty:'/style/blank.gif'};g=$.extend(g,f||{});var h=function(a){var b=a.checked;var c=a.disabled;var d=$(a);if(a.stateInterval)clearInterval(a.stateInterval);a.stateInterval=setInterval(function(){if(a.disabled!=c)d.trigger((c=!!a.disabled)?'disable':'enable');if(a.checked!=b)d.trigger((b=!!a.checked)?'check':'uncheck')},10);return d};return this.each(function(){var a=this;var b=h(a);if(a.wrapper)a.wrapper.remove();a.wrapper=$('<span class="'+g.cls+'"><span class="mark"><img src="'+g.empty+'" /></span></span>');a.wrapperInner=a.wrapper.children('span:eq(0)');a.wrapper.hover(function(e){a.wrapperInner.addClass(g.cls+'-hover');i(e)},function(e){a.wrapperInner.removeClass(g.cls+'-hover');i(e)});b.css({position:'absolute',zIndex:-1,visibility:'hidden'}).after(a.wrapper);var c=false;if(b.attr('id')){c=$('label[for='+b.attr('id')+']');if(!c.length)c=false}if(!c){c=b.closest?b.closest('label'):b.parents('label:eq(0)');if(!c.length)c=false}if(c){c.hover(function(e){a.wrapper.trigger('mouseover',[e])},function(e){a.wrapper.trigger('mouseout',[e])});c.click(function(e){b.trigger('click',[e]);i(e);return false})}a.wrapper.click(function(e){b.trigger('click',[e]);i(e);return false});b.click(function(e){i(e)});b.bind('disable',function(){a.wrapperInner.addClass(g.cls+'-disabled')}).bind('enable',function(){a.wrapperInner.removeClass(g.cls+'-disabled')});b.bind('check',function(){a.wrapper.addClass(g.cls+'-checked')}).bind('uncheck',function(){a.wrapper.removeClass(g.cls+'-checked')});$('img',a.wrapper).bind('dragstart',function(){return false}).bind('mousedown',function(){return false});if(window.getSelection)a.wrapper.css('MozUserSelect','none');if(a.checked)a.wrapper.addClass(g.cls+'-checked');if(a.disabled)a.wrapperInner.addClass(g.cls+'-disabled')})}})(jQuery);

/*
* vertical news ticker
* Tadas Juozapaitis ( kasp3rito@gmail.com )
* http://plugins.jquery.com/project/vTicker
*/
(function(a){a.fn.vTicker=function(b){var c={speed:700,pause:4000,showItems:3,animation:"",mousePause:true,isPaused:false,direction:"up",height:0};var b=a.extend(c,b);moveUp=function(g,d,e){if(e.isPaused){return}var f=g.children("ul");var h=f.children("li:first").clone(true);if(e.height>0){d=f.children("li:first").height()}f.animate({top:"-="+d+"px"},e.speed,function(){a(this).children("li:first").remove();a(this).css("top","0px")});if(e.animation=="fade"){f.children("li:first").fadeOut(e.speed);if(e.height==0){f.children("li:eq("+e.showItems+")").hide().fadeIn(e.speed)}}h.appendTo(f)};moveDown=function(g,d,e){if(e.isPaused){return}var f=g.children("ul");var h=f.children("li:last").clone(true);if(e.height>0){d=f.children("li:first").height()}f.css("top","-"+d+"px").prepend(h);f.animate({top:0},e.speed,function(){a(this).children("li:last").remove()});if(e.animation=="fade"){if(e.height==0){f.children("li:eq("+e.showItems+")").fadeOut(e.speed)}f.children("li:first").hide().fadeIn(e.speed)}};return this.each(function(){var f=a(this);var e=0;f.css({overflow:"hidden",position:"relative"}).children("ul").css({position:"absolute",margin:0,padding:0}).children("li").css({margin:0,padding:0});if(b.height==0){f.children("ul").children("li").each(function(){if(a(this).height()>e){e=a(this).height()}});f.children("ul").children("li").each(function(){a(this).height(e)});f.height(e*b.showItems)}else{f.height(b.height)}var d=setInterval(function(){if(b.direction=="up"){moveUp(f,e,b)}else{moveDown(f,e,b)}},b.pause);if(b.mousePause){f.bind("mouseenter",function(){b.isPaused=true}).bind("mouseleave",function(){b.isPaused=false})}})}})(jQuery);

/* MAP Highlight */
(function(F){var B,C,J,M,L,I,G,E,H,A,K;B=document.namespaces;has_canvas=!!document.createElement("canvas").getContext;if(!(has_canvas||B)){F.fn.maphilight=function(){return this};return }if(has_canvas){G=function(P,O,N){if(O<=1){P.style.opacity=O;window.setTimeout(G,10,P,O+0.1,10)}};E=function(N){return Math.max(0,Math.min(parseInt(N,16),255))};H=function(N,O){return"rgba("+E(N.substr(0,2))+","+E(N.substr(2,2))+","+E(N.substr(4,2))+","+O+")"};C=function(N){var O=F('<canvas style="width:'+N.width+"px;height:"+N.height+'px;"></canvas>').get(0);O.getContext("2d").clearRect(0,0,O.width,O.height);return O};J=function(Q,N,T,P,O){var S,R=Q.getContext("2d");R.beginPath();if(N=="rect"){R.rect(T[0],T[1],T[2]-T[0],T[3]-T[1])}else{if(N=="poly"){R.moveTo(T[0],T[1]);for(S=2;S<T.length;S+=2){R.lineTo(T[S],T[S+1])}}else{if(N=="circ"){R.arc(T[0],T[1],T[2],0,Math.PI*2,false)}}}R.closePath();if(P.fill){R.fillStyle=H(P.fillColor,P.fillOpacity);R.fill()}if(P.stroke){R.strokeStyle=H(P.strokeColor,P.strokeOpacity);R.lineWidth=P.strokeWidth;R.stroke()}if(P.fade){G(Q,0)}};M=function(N){N.getContext("2d").clearRect(0,0,N.width,N.height)}}else{C=function(N){return F('<var style="zoom:1;overflow:hidden;display:block;width:'+N.width+"px;height:"+N.height+'px;"></var>').get(0)};J=function(O,R,S,V,N){var T,U,P,Q;T='<v:fill color="#'+V.fillColor+'" opacity="'+(V.fill?V.fillOpacity:0)+'" />';U=(V.stroke?'strokeweight="'+V.strokeWidth+'" stroked="t" strokecolor="#'+V.strokeColor+'"':'stroked="f"');P='<v:stroke opacity="'+V.strokeOpacity+'"/>';if(R=="rect"){Q=F('<v:rect name="'+N+'" filled="t" '+U+' style="zoom:1;margin:0;padding:0;display:block;position:absolute;left:'+S[0]+"px;top:"+S[1]+"px;width:"+(S[2]-S[0])+"px;height:"+(S[3]-S[1])+'px;"></v:rect>')}else{if(R=="poly"){Q=F('<v:shape name="'+N+'" filled="t" '+U+' coordorigin="0,0" coordsize="'+O.width+","+O.height+'" path="m '+S[0]+","+S[1]+" l "+S.join(",")+' x e" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:0px;left:0px;width:'+O.width+"px;height:"+O.height+'px;"></v:shape>')}else{if(R=="circ"){Q=F('<v:oval name="'+N+'" filled="t" '+U+' style="zoom:1;margin:0;padding:0;display:block;position:absolute;left:'+(S[0]-S[2])+"px;top:"+(S[1]-S[2])+"px;width:"+(S[2]*2)+"px;height:"+(S[2]*2)+'px;"></v:oval>')}}}Q.get(0).innerHTML=T+P;F(O).append(Q)};M=function(N){F(N).find("[name=highlighted]").remove()}}L=function(O){var N,P=O.getAttribute("coords").split(",");for(N=0;N<P.length;N++){P[N]=parseFloat(P[N])}return[O.getAttribute("shape").toLowerCase().substr(0,4),P]};K=function(P,O){var N=F(P);return F.extend({},O,F.metadata?N.metadata():false,N.data("maphilight"))};A=function(N){if(!N.complete){return false}if(typeof N.naturalWidth!="undefined"&&N.naturalWidth==0){return false}return true};I={position:"absolute",left:0,top:0,padding:0,border:0};var D=false;F.fn.maphilight=function(P){P=F.extend({},F.fn.maphilight.defaults,P);if(F.browser.msie&&!D){document.namespaces.add("v","urn:schemas-microsoft-com:vml");var O=document.createStyleSheet();var N=["shape","rect","oval","circ","fill","stroke","imagedata","group","textbox"];F.each(N,function(){O.addRule("v\\:"+this,"behavior: url(#default#VML); antialias:true")});D=true}return this.each(function(){var V,S,Z,R,U,W,Y,T,X;V=F(this);if(!A(this)){return window.setTimeout(function(){V.maphilight(P)},200)}Z=F.extend({},P,F.metadata?V.metadata():false,V.data("maphilight"));X=V.get(0).getAttribute("usemap");R=F('map[name="'+X.substr(1)+'"]');if(!(V.is("img")&&X&&R.size()>0)){return }if(V.hasClass("maphilighted")){var Q=V.parent();V.insertBefore(Q);Q.remove();F(R).unbind(".maphilight").find("area[coords]").unbind(".maphilight")}S=F("<div></div>").css({display:"block",background:"url("+this.src+")",position:"relative",padding:0,width:this.width,height:this.height});if(Z.wrapClass){if(Z.wrapClass===true){S.addClass(F(this).attr("class"))}else{S.addClass(Z.wrapClass)}}V.before(S).css("opacity",0).css(I).remove();if(F.browser.msie){V.css("filter","Alpha(opacity=0)")}S.append(V);U=C(this);F(U).css(I);U.height=this.height;U.width=this.width;Y=function(c){var a,b;b=K(this,Z);if(!b.neverOn&&!b.alwaysOn){a=L(this);J(U,a[0],a[1],b,"highlighted");if(b.groupBy&&F(this).attr(b.groupBy)){var d=this;R.find("area["+b.groupBy+"="+F(this).attr(b.groupBy)+"]").each(function(){if(this!=d){var f=K(this,Z);if(!f.neverOn&&!f.alwaysOn){var e=L(this);J(U,e[0],e[1],f,"highlighted")}}})}F(U).append("<v:rect></v:rect>")}};F(R).bind("alwaysOn.maphilight",function(){if(W){M(W)}if(!has_canvas){F(U).empty()}F(R).find("area[coords]").each(function(){var a,b;b=K(this,Z);if(b.alwaysOn){if(!W&&has_canvas){W=C(V.get());F(W).css(I);W.width=V.width();W.height=V.height();V.before(W)}a=L(this);if(has_canvas){J(W,a[0],a[1],b,"")}else{J(U,a[0],a[1],b,"")}}})});F(R).trigger("alwaysOn.maphilight").find("area[coords]").bind("mouseover.maphilight",Y).bind("mouseout.maphilight",function(a){M(U)});V.before(U);V.addClass("maphilighted")})};F.fn.maphilight.defaults={fill:true,fillColor:"000000",fillOpacity:0.2,stroke:true,strokeColor:"ff0000",strokeOpacity:1,strokeWidth:1,fade:true,alwaysOn:false,neverOn:false,groupBy:false,wrapClass:true}})(jQuery);

/*
 * Copyright (c) 2010 INSIGHT Internet Marketing Company LLC
 * Website: http://www.insight.am
 * E-mail:  info@insight.am
 */

var regions={'aragatsotn':{'en':'Aragatsotn','ru':'Арагацотн','hy':'Արագածոտն'},'ararat':{'en':'Ararat','ru':'Арарат','hy':'Արարատ'},'armavir':{'en':'Armavir','ru':'Армавир','hy':'Արմավիր'},'gegharkunik':{'en':'Gegharkunik','ru':'Гегаркуник','hy':'Գեղարքունիք'},'kotayk':{'en':'Kotayk','ru':'Котайк','hy':'Կոտայք'},'lori':{'en':'Lori','ru':'Лори','hy':'Լոռի'},'shirak':{'en':'Shirak','ru':'Ширак','hy':'Շիրակ'},'syunik':{'en':'Syunik','ru':'Сюник','hy':'Սյունիք'},'tavush':{'en':'Tavush','ru':'Тавуш','hy':'Տավուշ'},'vayotsdzor':{'en':'Vayots Dzor','ru':'Вайоц-Дзор','hy':'Վայոց Ձոր'},'yerevan':{'en':'Yerevan','ru':'Ереван','hy':'Երևան'}};

/* ######### POPUP ######### */
jQuery.fn.openpopup = function(){
    var popup = arguments[0] || {};
		
		if($("#popup-"+popup.ID).length>0){
			popup.exists=1;
		}else{
			popup.exists=0;
		}
		
		if(popup.modal){
			$("body").append('<div id="overlay"><div class="bg"></div></div>');
			$('#overlay div.bg').css({'-moz-opacity':'0.6', 'opacity':'0.6'}); //'filter':'alpha(opacity=60)',
		}
			
			if(popup.modal){
				if(popup.exists==0){
					$("body").append('<div id="popup-'+popup.ID+'" class="popup"><table cellspacing="0" cellpadding="0" class="bg"><tr><td class="lt"></td><td class="ct"></td><td class="rt"></td></tr><tr><td class="lm"></td><td class="cm">&nbsp;</td><td class="rm"></td></tr><tr><td class="lb"></td><td class="cb"></td><td class="rb"></td></tr></table><div class="close"></div></div>');
				}
				$("#popup-"+popup.ID+" .cm").html(popup.content);
			}
			else{
				if(popup.exists==0){
					$("body").append('<div id="popup-'+popup.ID+'" class="popup"><table cellspacing="0" cellpadding="0" class="bg"><tr><td class="lt"></td><td class="ct"></td><td class="rt"></td></tr><tr><td class="lm"></td><td class="cm">&nbsp;</td><td class="rm"></td></tr><tr><td class="lb"></td><td class="cb"></td><td class="rb"></td></tr></table><div class="content"></div><div class="close"></div></div>');
				}
				$("#popup-"+popup.ID+" .content").html(popup.content);
			}
		
		if(popup.exists==0){
			windowCSS = {
				width:popup.width+"px",
				height:popup.height+"px",
				position:'absolute',
				top:'50%',
				left:'50%',
				marginTop:(-1)*(popup.height)/2+"px",
				marginLeft:(-1)*(popup.width)/2+"px"
			}
			
			
			$('#popup-'+popup.ID).css(windowCSS);
			
			$('#popup-'+popup.ID+' .bg').css({width:popup.width+"px", height:popup.height+"px"});
			
			$('#popup-'+popup.ID+' .bg .ct').css({width:(popup.width-22)+"px"});
			$('#popup-'+popup.ID+' .bg .cb').css({width:(popup.width-22)+"px"});
			$('#popup-'+popup.ID+' .bg .lm').css({height:(popup.height-22)+"px"});
			$('#popup-'+popup.ID+' .bg .rm').css({height:(popup.height-22)+"px"});
			$('#popup-'+popup.ID+' .bg .cm').css({width:(popup.width-22)+"px", height:(popup.height-22)+"px"});
			
			if(!popup.modal){
				containerCSS = {
					width:(popup.width-4)+"px",
					height:(popup.height-4)+"px",
					position:'absolute',
					top:'1px',
					left:'1px'
				}
				$('#popup-'+popup.ID+' .content').css(containerCSS);
			}
			
			$('#popup-'+popup.ID).draggable();
		}
		
		if(popup.wall || popup.noclose){$('#popup-'+popup.ID+' .close').remove();}
		
		if(popup.modal){
			$("#overlay").fadeIn("normal", function(){$('#popup-'+popup.ID).appearpopup();});
			if(!popup.wall){
				$('#popup-'+popup.ID+' .close').click(function(){$('#popup-'+popup.ID).closepopup();});
				$("#overlay").click(function(){$('#popup-'+popup.ID).closepopup();});
			}
		}else{
			$('#popup-'+popup.ID).appearpopup(); //$("#overlay").fadeIn("normal", function(){$('#popup-'+popup.ID).appearpopup();});
			if(!popup.wall){
				$('#popup-'+popup.ID+' .close').live('click',function(){
					$('#popup-'+popup.ID).fadeOut("normal", function(){$('#popup-'+popup.ID).remove();});
					return false;
				});
				//$("#overlay").click(function(){$('#popup-'+popup.ID).closepopup();});
			}
		}
  };
  
  jQuery.fn.appearpopup = function(){
		$(this).fadeIn("normal");
	};
	
	jQuery.fn.disappearpopup = function(){
		$(this).fadeOut("normal", function(){$(this).remove();});
	};
  
  jQuery.fn.closepopup = function(){
		$("#overlay").fadeOut("normal", function(){$("#overlay").remove();}); /*, function(){$("#overlay").remove();}*/
		$(this).disappearpopup();
	};
/* ######### POPUP ######### */


function initializeMAP(){
	var yerevan = new google.maps.LatLng(40.197823, 44.516602);
	var browserSupportFlag =  new Boolean();
  var myOptions = {
    zoom: 11,
    center: yerevan,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  var map = new google.maps.Map(document.getElementById("map"), myOptions);
  
  var georssLayer = new google.maps.KmlLayer('http://www.finca.am/sitemap.kml');
	georssLayer.setMap(map);
}

jQuery.fn.inputtoggle = function(){
    var input = arguments[0] || {};
    var passive_color=input.passive_color || "#acb6ab";
    var active_color="#000";
    var hint=input.hint;
    //var input.field=input.field;
    
    if(!input.field.length){return "";}
    
    if((input.field.val()!=hint)&&(input.field.val()!='')){input.field.css({color:active_color,'font-style':'normal'});}
		else{input.field.val(hint);input.field.css({color:passive_color,'font-style':'normal'});}
		
		input.field.focus(function(){
			if(input.field.val()==hint){
				input.field.val('');
				input.field.css({color:active_color,'font-style':'normal'});
			}
		});
		
		input.field.blur(function(){
			if(input.field.val()==''){
				input.field.val(hint);
				input.field.css({color:passive_color,'font-style':'normal'});
			}
		});
};

$.expr[':'].external = function(obj){
    return !obj.href.match(/^mailto\:/) && (obj.hostname != location.hostname);
};
$.expr[':'].internal = function(obj){
    return obj.hostname == location.hostname;
};

$(document).ready(function(){
	var LANGUAGE=document.body.getAttribute('xml:lang');

	$("window").inputtoggle({field:$("#search .input"),hint:$("#search .input").attr("alt")});
	$('#login .checkbox').checkbox({cls:'jquery-safari-checkbox'});
	
	if($.browser.msie){
		$("#menu > li").hover(function(){
			$(this).addClass("hover");
			$(this).find("> a").addClass("hover");
			//$(this).find("> ul").stop().slideDown();
		},function(){
			$(this).removeClass("hover");
			$(this).find("> a").removeClass("hover");
			//$(this).find("> ul").stop().slideUp().hide(); 
		});
	}
	
	var startingSlide=parseInt($.cookie('slides'),10);
	if(!startingSlide>0){startingSlide=0;}
	var $slider =$('#slides').cycle({ 
		fx:      'fade', 
		speed:    700, 
		timeout:  7000,
		pause:1,
		startingSlide:startingSlide,
		after:function(curr, next, opts){
			$.cookie('slides', opts.currSlide)
		}
	});
	$("#body").css({'z-index':1});
	$("#header, #menu, #menu li ul").css({'z-index':100});
	$("#tabs li a").hover(function(){
		$slider.cycle($(this).parent().index());
		$slider.cycle("pause");
	},function(){
		$slider.cycle("resume");
	});	
	/*
	$("#tabs li a").click(function(){
		$slider.cycle($(this).parent().index()); 
    return false;
	});
	*/
	/*
	$('#body .news').vTicker({ 
		speed: 500,
		pause: 3000,
		animation: 'fade',
		mousePause: true,
		showItems: 3
	});
	*/
	$("#content a[href$='.jpg'], #content a[href$='.png'], #content a[href$='.gif']").attr({"rel":"content"});
	$("a[href$='.jpg'], a[href$='.png'], a[href$='.gif']").lightbox({fitToScreen:true,loopImages:true,imageClickClose:true,disableNavbarLinks:true});

	$('a:external').click(function(){
		var website=$(this).attr("href").replace("http://","").split('/');
		if(LANGUAGE=="hy"){var message="Ընկերությունը պատասխանատվություն չի կրում "+website[0]+" կայքի բովանդակության ստույգության և արժանահավատության, այնտեղ տեղադրված գովազդների, այդ կայքում տեղադրված տեղեկատվության օգտագործման հնարավոր հետևանքների համար: Սեղմեք «OK» կայքը այցելելու համար:";}
		else if(LANGUAGE=="ru"){var message="";}
		else{var message="The Company is not responsible for accuracy and reliability of "+website[0]+", placed advertisements, possible consequences of usage of the information of that website. Press «OK» to visit the site.";}
		
		var x=window.confirm(message);
		var val = false;
		if (x)
			val = true;
		else
			val = false;
		return val;
	});
	
	
	
	$("#login").submit(function(){
		/*
		$("#login input[name=username]").get(0).focus();
		
		if(LANGUAGE=="hy"){alert("Օգտվողի անունը և գաղտնաբառը չե՛ն համապատասխանում:");}
		else if(LANGUAGE=="ru"){alert("Неправильная пара логин/пароль!");}
		else{alert("Wrong username/password combination!");}
		*/
		//return false;
	});
	
	
	
	if($("#map").length>0){
		//$(".marzer").css({display:"none"});
		
		/*
		$("#branches").css({cursor:"pointer"});
		$("#branches").toggle(function(){
			$(".marzer").slideDown();
		},function(){
			$(".marzer").slideUp();
		});
		*/
		$('img[usemap]').maphilight({
			fill: true,
			fillColor: 'ffffff',
			fillOpacity: 0.2,

			stroke: true,
			strokeColor: 'ffffff',
			strokeOpacity: 1,
			strokeWidth: 1,
			
			fade: true,
			
			alwaysOn: false,
			neverOn: false,
			groupBy: false
		});
		
		$("area").click(function(){
			var marzID=$(this).attr("href").replace("#","");
			
			if($("#"+marzID).length>0){
				var text=$("#"+marzID).html();
			}else{
				var text="";
			}
			
			if(marzID=="yerevan"){
				$("window").openpopup({
					ID:'mymarz',
					width:300,
					height:380,
					content:text
				});
			}else{
				$("window").openpopup({
					ID:'mymarz',
					width:242,
					height:300,
					content:text
				});
			}
			//'<div class="title">'+regions[marzID][LANGUAGE]+'</div><div>'+text+'</div>'
		
			return false;

		});
	}
	
	if($(".continuation").length>0){
		$(".continuation a.more").click(function(){
			$(".continuation").removeClass("open");
			$(this).parents("div.continuation").addClass("open");
			
			return false;
		});
	}
	
	if($("#management").length>0){
		$("#management li div").css({"display":"none"});
		$("#management li h3").css({cursor:"pointer"});
		$("#management li h3").toggle(function(){
			$(this).addClass("open");
			$("div", $(this).parent()).slideDown();
		},function(){
			//$("#management li div").slideUp();
			$(this).removeClass();
			$("div", $(this).parent()).slideUp();
		});
	}
	
	if($("#board").length>0){
		$("#board li div").css({"display":"none"});
		$("#board li h3").css({cursor:"pointer"});
		$("#board li h3").toggle(function(){
			$(this).addClass("open");
			$("div", $(this).parent()).slideDown();
		},function(){
			//$("#board li div").slideUp();
			$(this).removeClass();
			$("div", $(this).parent()).slideUp();
		});
	}
	
	if($(".quarterly").length>0){
		$(".quarterly ul").hide();
		$(".quarterly h3").css({cursor:"pointer"});
		$(".quarterly ul").css({'list-style':"none", "margin-left":"0px"});
		$(".quarterly h3").toggle(function(){
			$(this).addClass("open");
			$("ul", $(this).parent()).slideDown();
		},function(){
			$(this).removeClass();
			$(".quarterly ul").slideUp();
		});
	}
	
	if($("#contact-us").length>0){
		$("#contact-us input").each(function(index) {
			if($(this).attr("alt").length>0){
				$("window").inputtoggle({field:$(this),hint:$(this).attr("alt")});
			}
		});
		$("#contact-us textarea").each(function(index) {
			if($(this).val().length>0){
				$("window").inputtoggle({field:$(this),hint:$(this).val()});
			}
		});
	}
	
	
	
	
	
	
	
	/*
	function positionFooter(){
		var margin_bottom = $("#body").css("margin-bottom").replace("px", "");
		var page_height = $(document.body).height() - margin_bottom+97;
		var window_height = $(window).height();
		var difference = window_height - page_height;
		if (difference < 0){difference = 0;}
 
		$("#body").css({
			"margin-bottom": difference + "px";
		})
	}
	positionFooter();
	
	$(window).resize(positionFooter);
	*/
	/*
	$("#navigation li a").css({'text-shadow': '1px 2px 3px rgba(0,0,0,0.3)'});
	$("#content, #sidebar").css({'text-shadow': '1px 1px 0 rgba(255,255,255,0.2)'});
	
	
	if($("#map").length>0){
		var script = document.createElement("script");
		script.type = "text/javascript";
		script.src = "http://maps.google.com/maps/api/js?sensor=false&callback=initializeMAP";
		document.body.appendChild(script);
	}
	
	
	if(!navigator.userAgent.toLowerCase().match(/iphone/)){
		$("#addresses .tel a").attr({"href":"#"});
		$("#addresses .tel a").click(function(){return false;});
	}
	
	if($('#paging').length>0){
		$('#paging').show();
		$('#content .page').hide();
		$('#content .page:first').show();
		
		$('#paging a').click(function(){
			var current=$('#content div.page').index($('#content .page:visible'));
			var max=$('#content div.page').length-1;
			
			var prev=0;
			var next=0;
			
			if(current==0){
				prev=max;
				next=1;
			}else if(current==max){
				prev=current-1;
				next=0;
			}else{
				prev=current-1;
				next=current+1;
			}
			
			if($(this).parent().attr("class")=="prev"){
				//$('html,body').animate({scrollTop: $("#content").offset().top},300,function(){
					$('#content div.page').eq(current).fadeOut(100);
					$('#content div.page').eq(prev).fadeIn(300);
				//});
				
			}else if($(this).parent().attr("class")=="next"){
				//$('html,body').animate({scrollTop: $("#content").offset().top},300,function(){
					$('#content div.page').eq(current).fadeOut(100);
					$('#content div.page').eq(next).fadeIn(300);
				//});
			}
			
			return false;
		});
	}
	
	if($("#form-Date").length>0){
		$('#form-Date').val((new Date()).format("yyyy/mm/dd"));
		$('#form-Date').DatePicker({
			format:'Y/m/d',
			date: (new Date()).format("yyyy/mm/dd"),
			position: 'right',
			locale: {
							days: ["Janday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
							daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
							daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
							months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
							monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
							weekMin: 'wk'
						},
			onBeforeShow: function(){
				$('#form-Date').DatePickerSetDate((new Date()).format("yyyy/mm/dd"), true);
			},
			onChange: function(formated, dates){
				$('#form-Date').val(formated);
				$('#form-Date').DatePickerHide();
			}
		});
	}
	*/
	
	/*
	if ($.browser.msie && $.browser.version == 6){
		if(LANGUAGE=="ru"){
			var updatemessage="Դուք օգտվում եք 2002թ. ստեղծված Internet Explorer-ի 6-րդ տարբերակից: Խնդրում ենք այն թարմացնել:";
		}else if(LANGUAGE=="ru"){
			var updatemessage="Вашему интернет браузеру уже 8 лет. Пожалуйста обновите.";
		}else{
			var updatemessage="Please update your 8 years old browser";
		}

		alert(updatemessage);
	}
	*/
	
	/*
	if ($.browser.msie && $.browser.version == 6){
		$("#toolbar").prepend('<div class="bg"></div>');
		$("#location").wrapInner('<div class="content"></div>');
		$("#location").prepend('<div class="bg"></div>');
		$("#header").prepend('<div id="banners-bg"></div>');
	}
	
	$("#menu li a span").css({'text-shadow': '1px 1px 2px rgba(0, 0, 0, 0.7)'});
	
	$('#location select').selectbox();
	*/
	
	/*
	
	
	var startingSlide=parseInt($.cookie('slides'),10);
	if(!startingSlide>0){startingSlide=0;}
	$('#slides ul').xcycle({ 
    fx:      'fade', 
    speed:    700, 
    timeout:  10000,
    startingSlide:startingSlide,
    after:function(curr, next, opts){
			$.cookie('slides', opts.currSlide)
    }
	});
	
	$("#slides .over, #logo, #body").css({'z-index':90});

	var startingreferences=parseInt($.cookie('references'),10);
	if(!startingreferences>0){startingreferences=0;}
	$('#references ul').cycle({ 
    fx:      'fade', 
    speed:    500, 
    timeout:  5000,
    startingSlide:startingreferences,
    cleartypeNoBg: true,
    after:function(curr, next, opts){
			$.cookie('references', opts.currSlide)
    }
	});

	$('#projects-progress ul.projects').cycle({ 
    fx:      'scrollHorz', 
    speed:    500,
    timeout:  0,
    prev:   '#projects-progress .prev a',
    next:   '#projects-progress .next a'
	});
	
	$('#projects-completed ul.projects').cycle({ 
    fx:      'scrollHorz', 
    speed:    500,
    timeout:  0,
    prev:   '#projects-completed .prev a',
    next:   '#projects-completed .next a'
	});
	
	var activeMENU=$("#menu > li").index($("#menu > li.active"));
	$("#header, #menu, #menu ul").css({'z-index':999});
	$("#menu > li").hover(
		function(){
			$("#menu > li").removeClass("active");
			$(this).addClass("active");
			$(this).children("ul").slideDown("fast");
			$(this).css({'z-index':999});
			if(!$.browser.msie){
				$(this).css({'opacity':0.95});
			}
		},
		function(){
			$("#menu > li").children("ul").stop(true,true).css({"display":"none"});
			$("#menu > li").removeClass("active");
			if(activeMENU>=0){
				$("#menu > li:eq("+activeMENU+")").addClass("active");
			}
		}
	);


	
	
	/ *
	$("#subscribe").submit(function(){
		if(($("#subscribe input[name=email]").val()==$("#subscribe input[name=email]").attr("alt"))||($("#subscribe input[name=email]").val().length==0)||(!$("#subscribe input[name=email]").val().match(/^([^@])+\@([^@])+\.([a-zA-Z0-9]{2,10})+$/))){
			$("#subscribe input[name=email]").get(0).focus();
			if(LANGUAGE=="hy"){alert("Խնդրում ենք մուտքագրել Ձեր էլ-փոստի հասցեն");}
			else if(LANGUAGE=="ru"){alert("Просим ввести адрес Вашей эл-почты");}
			else{alert("Please fill your email address");}
			return false;
		}
		
		var PARAMETERS={};
		PARAMETERS.action="subscribe";
		PARAMETERS.email=$("#subscribe input[name=email]").val();
		
		$.post("/ajax", PARAMETERS, function(response){
			if(response.success){
				if(LANGUAGE=="hy"){alert("Շնորհակալ ենք բաժանորդագրման համար:");}
				else if(LANGUAGE=="ru"){alert("Благодарим за подписку.");}
				else{alert("Thank you for subscription!");}
				
				$("#subscribe input[name=email]").val($("#subscribe input[name=email]").attr("alt"));
				$("#subscribe input[name=email]").css({'color':'#666', 'font-style':'italic'});
			}
			if(response.error){
				if(response.error=="subscribed"){
					if(LANGUAGE=="hy"){alert("Դուք արդեն բաժանորդագրվել եք:");}
					else if(LANGUAGE=="ru"){alert("Ваша эл-почта уже зарегистрирована в базе подписчиков.");}
					else{alert("You are already subscribed!");}
					
					$("#subscribe input[name=email]").val($("#subscribe input[name=email]").attr("alt"));
					$("#subscribe input[name=email]").css({'color':'#666', 'font-style':'italic'});
				}else{
					alert(response.error);
				}
			}
			if(response.focus){
				$("#subscribe "+response.focus).get(0).focus();
			}
		},"json");
		
		return false;
	});
	* /
	*/
});
