(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:"xy",duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),["iframe","#document","html","body"])!=-1;if(!i){return a}var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=="BackCompat"?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=="object"){b=j;j=0}if(typeof b=="function"){b={onAfter:b}}if(n=="max"){n=9000000000}b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue){j/=2}b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is("html,body");switch(typeof f){case"number":case"string":if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case"object":if(f.is||f.style){s=(f=d(f)).offset()}}d.each(b.axis.split(""),function(a,i){var e=i=="x"?"Left":"Top",h=e.toLowerCase(),c="scroll"+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css("margin"+e))||0;g[c]-=parseInt(f.css("border"+e+"Width"))||0}g[c]+=b.offset[h]||0;if(b.over[h]){g[c]+=f[i=="x"?"width":"height"]()*b.over[h]}}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=="%"?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c])){g[c]=g[c]<=0?0:Math.min(g[c],m)}if(!a&&b.queue){if(l!=g[c]){t(b.onAfterFirst)}delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=="x"?"Width":"Height",h="scroll"+e;if(!d(a).is("html,body")){return a[h]-d(a)[e.toLowerCase()]()}var c="client"+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=="object"?a:{top:a,left:a}}})(jQuery);(function($){var ver="2.99";if($.support==undefined){$.support={opacity:!($.browser.msie)}}function debug(s){$.fn.cycle.debug&&log(s)}function log(){window.console&&console.log&&console.log("[cycle] "+Array.prototype.join.call(arguments," "))}$.expr[":"].paused=function(el){return el.cyclePause};$.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.backwards);if(startTime){startTime+=(opts2.delay||0);if(startTime<10){startTime=10}debug("first timeout: "+startTime);this.cycleTimeout=setTimeout(function(){go(els,opts2,0,!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,!options.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]:[];if(!$.support.opacity&&opts.cleartype){opts.after.push(function(){removeFilter(this,opts)})}if(opts.continuous){opts.after.push(function(){go(els,opts,0,!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.cssAfter=opts.cssAfter||{};opts.cssFirst=opts.cssFirst||{};opts.animIn=opts.animIn||{};opts.animOut=opts.animOut||{};$slides.not(":eq("+first+")").css(opts.cssBefore);$($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=="none"?0: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){opts.after[0].apply(e0,[e0,e0,opts,true])}if(opts.next){$(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,1)})}if(opts.prev){$(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,0)})}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"){$s.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=0}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(){opts.busy=0;$.each(opts.after,function(i,o){if(p.cycleStop!=opts.stopCount){return}o.apply(next,[curr,next,opts,fwd])})};debug("tx firing("+fx+"); 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.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(opts.fx!="none"&&(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,1)};$.fn.cycle.prev=function(opts){advance(opts,0)};function advance(opts,moveForward){var val=moveForward?1:-1;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,moveForward);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&&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();if(typeof opts.cssBefore.opacity=="undefined"){opts.cssBefore.opacity=1}opts.cssBefore.display="block";if(opts.slideResize&&w!==false&&next.cycleW>0){opts.cssBefore.width=next.cycleW}if(opts.slideResize&&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,function(){cb()})};$l.animate(opts.animOut,speedOut,easeOut,function(){$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={activePagerClass:"activeSlide",after:null,allowPagerClickBubble:false,animIn:null,animOut:null,autostop:0,autostopCount:0,backwards:false,before:null,cleartype:!$.support.opacity,cleartypeNoBg:false,containerResize:1,continuous:0,cssAfter:null,cssBefore:null,delay:0,easeIn:null,easeOut:null,easing:null,end:null,fastOnEvent:0,fit:0,fx:"fade",fxFn:null,height:"auto",manualTrump:true,next:null,nowrap:0,onPagerEvent:null,onPrevNextEvent:null,pager:null,pagerAnchorBuilder:null,pagerEvent:"click.cycle",pause:0,pauseOnPagerHover:0,prev:null,prevNextEvent:"click.cycle",random:0,randomizeEffects:1,requeueOnImageNotLoaded:true,requeueTimeout:250,rev:0,shuffle:null,slideExpr:null,slideResize:1,speed:1000,speedIn:null,speedOut:null,startingSlide:0,sync:1,timeout:4000,timeoutFn:null,updateActivePagerLink:null}})(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.fadeout=function($cont,$slides,opts){$slides.not(":eq("+opts.currSlide+")").css({display:"block",opacity:1});opts.before.push(function(curr,next,opts,w,h,rev){$(curr).css("zIndex",opts.slideCount+(!rev===true?1:0));$(next).css("zIndex",opts.slideCount+(!rev===true?0:1))});opts.animIn.opacity=1;opts.animOut.opacity=0;opts.cssBefore.opacity=1;opts.cssBefore.display="block";opts.cssAfter.zIndex=0};$.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;opts.cssBefore.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;opts.cssBefore.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;opts.cssBefore.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;opts.cssBefore.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){if(opts.rev){fwd=!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){if(opts.rev){fwd=!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;opts.cssBefore.top=0;opts.cssBefore.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;opts.cssBefore.top=0;opts.cssBefore.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){if(opts.rev){fwd=!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()}})})};$.extend(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.animOut.width=next.cycleW});opts.cssFirst.top=0;opts.cssBefore.left=0;opts.cssBefore.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;opts.cssBefore.top=0;opts.cssBefore.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;opts.cssBefore.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});$.extend(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;$.extend(opts.animIn,{top:0,left:0,width:next.cycleW,height:next.cycleH});$.extend(opts.animOut,{width:0,height:0,top:curr.cycleH/2,left:curr.cycleW/2})});opts.cssFirst.top=0;opts.cssFirst.left=0;opts.cssBefore.width=0;opts.cssBefore.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;$.extend(opts.animIn,{top:0,left:0,width:next.cycleW,height:next.cycleH})});opts.cssBefore.width=0;opts.cssBefore.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;opts.cssBefore.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;opts.cssBefore.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;opts.cssBefore.left=w;opts.animIn.top=0;opts.animIn.left=0;opts.animOut.top=h;opts.animOut.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;opts.animIn.width=this.cycleW;opts.animOut.left=0});opts.cssBefore.top=0;opts.cssBefore.width=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;opts.animIn.height=this.cycleH;opts.animOut.top=0});opts.cssBefore.height=0;opts.cssBefore.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;opts.animIn.width=this.cycleW;opts.animOut.left=curr.cycleW/2;opts.animOut.width=0});opts.cssBefore.top=0;opts.cssBefore.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;opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH/2;opts.animOut.height=0});opts.cssBefore.height=0;opts.cssBefore.left=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;opts.animIn.top=0;opts.cssBefore.top=0;opts.cssBefore.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;opts.animIn.top=0;opts.cssBefore.top=0;opts.cssBefore.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){$.extend(opts.animOut,{left:w*2,top:-h/2,opacity:0})}else{opts.animOut.opacity=0}});opts.cssBefore.left=0;opts.cssBefore.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")})()});$.extend(opts.cssBefore,{display:"block",opacity:1,top:0,left:0});opts.animIn={left:0};opts.animOut={left:0}}})(jQuery);jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(x,t,b,c,d){return jQuery.easing[jQuery.easing.def](x,t,b,c,d)},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b},easeOutQuad:function(x,t,b,c,d){return -c*(t/=d)*(t-2)+b},easeInOutQuad:function(x,t,b,c,d){if((t/=d/2)<1){return c/2*t*t+b}return -c/2*((--t)*(t-2)-1)+b},easeInCubic:function(x,t,b,c,d){return c*(t/=d)*t*t+b},easeOutCubic:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b},easeInOutCubic:function(x,t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t+b}return c/2*((t-=2)*t*t+2)+b},easeInQuart:function(x,t,b,c,d){return c*(t/=d)*t*t*t+b},easeOutQuart:function(x,t,b,c,d){return -c*((t=t/d-1)*t*t*t-1)+b},easeInOutQuart:function(x,t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t*t+b}return -c/2*((t-=2)*t*t*t-2)+b},easeInQuint:function(x,t,b,c,d){return c*(t/=d)*t*t*t*t+b},easeOutQuint:function(x,t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b},easeInOutQuint:function(x,t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t*t*t+b}return c/2*((t-=2)*t*t*t*t+2)+b},easeInSine:function(x,t,b,c,d){return -c*Math.cos(t/d*(Math.PI/2))+c+b},easeOutSine:function(x,t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b},easeInOutSine:function(x,t,b,c,d){return -c/2*(Math.cos(Math.PI*t/d)-1)+b},easeInExpo:function(x,t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b},easeOutExpo:function(x,t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b},easeInOutExpo:function(x,t,b,c,d){if(t==0){return b}if(t==d){return b+c}if((t/=d/2)<1){return c/2*Math.pow(2,10*(t-1))+b}return c/2*(-Math.pow(2,-10*--t)+2)+b},easeInCirc:function(x,t,b,c,d){return -c*(Math.sqrt(1-(t/=d)*t)-1)+b},easeOutCirc:function(x,t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b},easeInOutCirc:function(x,t,b,c,d){if((t/=d/2)<1){return -c/2*(Math.sqrt(1-t*t)-1)+b}return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b},easeInElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0){return b}if((t/=d)==1){return b+c}if(!p){p=d*0.3}if(a<Math.abs(c)){a=c;var s=p/4}else{var s=p/(2*Math.PI)*Math.asin(c/a)}return -(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b},easeOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0){return b}if((t/=d)==1){return b+c}if(!p){p=d*0.3}if(a<Math.abs(c)){a=c;var s=p/4}else{var s=p/(2*Math.PI)*Math.asin(c/a)}return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b},easeInOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0){return b}if((t/=d/2)==2){return b+c}if(!p){p=d*(0.3*1.5)}if(a<Math.abs(c)){a=c;var s=p/4}else{var s=p/(2*Math.PI)*Math.asin(c/a)}if(t<1){return -0.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b}return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*0.5+c+b},easeInBack:function(x,t,b,c,d,s){if(s==undefined){s=1.70158}return c*(t/=d)*t*((s+1)*t-s)+b},easeOutBack:function(x,t,b,c,d,s){if(s==undefined){s=1.70158}return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},easeInOutBack:function(x,t,b,c,d,s){if(s==undefined){s=1.70158}if((t/=d/2)<1){return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b}return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b},easeInBounce:function(x,t,b,c,d){return c-jQuery.easing.easeOutBounce(x,d-t,0,c,d)+b},easeOutBounce:function(x,t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b}else{if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+0.75)+b}else{if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+0.9375)+b}else{return c*(7.5625*(t-=(2.625/2.75))*t+0.984375)+b}}}},easeInOutBounce:function(x,t,b,c,d){if(t<d/2){return jQuery.easing.easeInBounce(x,t*2,0,c,d)*0.5+b}return jQuery.easing.easeOutBounce(x,t*2-d,0,c,d)*0.5+c*0.5+b}});(function($,k,m,i,d){var e=$(i),g="waypoint.reached",b=function(o,n){o.element.trigger(g,n);if(o.options.triggerOnce){o.element[k]("destroy")}},h=function(p,o){var n=o.waypoints.length-1;while(n>=0&&o.waypoints[n].element[0]!==p[0]){n-=1}return n},f=[],l=function(n){$.extend(this,{element:$(n),oldScroll:-99999,waypoints:[],didScroll:false,didResize:false,doScroll:$.proxy(function(){var q=this.element.scrollTop(),p=q>this.oldScroll,s=this,r=$.grep(this.waypoints,function(u,t){return p?(u.offset>s.oldScroll&&u.offset<=q):(u.offset<=s.oldScroll&&u.offset>q)}),o=r.length;if(!this.oldScroll||!q){$[m]("refresh")}this.oldScroll=q;if(!o){return}if(!p){r.reverse()}$.each(r,function(u,t){if(t.options.continuous||u===o-1){b(t,[p?"down":"up"])}})},this)});$(n).scroll($.proxy(function(){if(!this.didScroll){this.didScroll=true;i.setTimeout($.proxy(function(){this.doScroll();this.didScroll=false},this),$[m].settings.scrollThrottle)}},this)).resize($.proxy(function(){if(!this.didResize){this.didResize=true;i.setTimeout($.proxy(function(){$[m]("refresh");this.didResize=false},this),$[m].settings.resizeThrottle)}},this));e.load($.proxy(function(){this.doScroll()},this))},j=function(n){var o=null;$.each(f,function(p,q){if(q.element[0]===n){o=q;return false}});return o},c={init:function(o,n){this.each(function(){var u=$.fn[k].defaults.context,q,t=$(this);if(n&&n.context){u=n.context}if(!$.isWindow(u)){u=t.closest(u)[0]}q=j(u);if(!q){q=new l(u);f.push(q)}var p=h(t,q),s=p<0?$.fn[k].defaults:q.waypoints[p].options,r=$.extend({},s,n);r.offset=r.offset==="bottom-in-view"?function(){var v=$.isWindow(u)?$[m]("viewportHeight"):$(u).height();return v-$(this).outerHeight()}:r.offset;if(p<0){q.waypoints.push({element:t,offset:t.offset().top,options:r})}else{q.waypoints[p].options=r}if(o){t.bind(g,o)}});$[m]("refresh");return this},remove:function(){return this.each(function(o,p){var n=$(p);$.each(f,function(r,s){var q=h(n,s);if(q>=0){s.waypoints.splice(q,1)}})})},destroy:function(){return this.unbind(g)[k]("remove")}},a={refresh:function(){$.each(f,function(r,s){var q=$.isWindow(s.element[0]),n=q?0:s.element.offset().top,p=q?$[m]("viewportHeight"):s.element.height(),o=q?0:s.element.scrollTop();$.each(s.waypoints,function(u,x){var t=x.options.offset,w=x.offset;if(typeof x.options.offset==="function"){t=x.options.offset.apply(x.element)}else{if(typeof x.options.offset==="string"){var v=parseFloat(x.options.offset);t=x.options.offset.indexOf("%")?Math.ceil(p*(v/100)):v}}x.offset=x.element.offset().top-n+o-t;if(s.oldScroll>w&&s.oldScroll<=x.offset){b(x,["up"])}else{if(s.oldScroll<w&&s.oldScroll>=x.offset){b(x,["down"])}}});s.waypoints.sort(function(u,t){return u.offset-t.offset})})},viewportHeight:function(){return(i.innerHeight?i.innerHeight:e.height())},aggregate:function(){var n=$();$.each(f,function(o,p){$.each(p.waypoints,function(q,r){n=n.add(r.element)})});return n}};$.fn[k]=function(n){if(c[n]){return c[n].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof n==="function"||!n){return c.init.apply(this,arguments)}else{if(typeof n==="object"){return c.init.apply(this,[null,n])}else{$.error("Method "+n+" does not exist on jQuery "+k)}}}};$.fn[k].defaults={continuous:true,offset:0,triggerOnce:false,context:i};$[m]=function(n){if(a[n]){return a[n].apply(this)}else{return a.aggregate()}};$[m].settings={resizeThrottle:200,scrollThrottle:100};e.load(function(){$[m]("refresh")})})(jQuery,"waypoint","waypoints",this);jQuery.cookie=function(key,value,options){if(arguments.length>1&&String(value)!=="[object Object]"){options=jQuery.extend({},options);if(value===null||value===undefined){options.expires=-1}if(typeof options.expires==="number"){var days=options.expires,t=options.expires=new Date();t.setDate(t.getDate()+days)}value=String(value);return(document.cookie=[encodeURIComponent(key),"=",options.raw?value:encodeURIComponent(value),options.expires?"; expires="+options.expires.toUTCString():"",options.path?"; path="+options.path:"",options.domain?"; domain="+options.domain:"",options.secure?"; secure":""].join(""))}options=value||{};var result,decode=options.raw?function(s){return s}:decodeURIComponent;return(result=new RegExp("(?:^|; )"+encodeURIComponent(key)+"=([^;]*)").exec(document.cookie))?decode(result[1]):null};(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);(function($){var l=location.href.replace(/#.*/,"");var g=$.localScroll=function(a){$("body").localScroll(a)};g.defaults={duration:1000,axis:"y",event:"click",stop:true,target:window,reset:true};g.hash=function(a){if(location.hash){a=$.extend({},g.defaults,a);a.hash=false;if(a.reset){var e=a.duration;delete a.duration;$(a.target).scrollTo(0,a);a.duration=e}i(0,location,a)}};$.fn.localScroll=function(b){b=$.extend({},g.defaults,b);return b.lazy?this.bind(b.event,function(a){var e=$([a.target,a.target.parentNode]).filter(d)[0];if(e){i(a,e,b)}}):this.find("a,area").filter(d).bind(b.event,function(a){i(a,this,b)}).end().end();function d(){return !!this.href&&!!this.hash&&this.href.replace(this.hash,"")==l&&(!b.filter||$(this).is(b.filter))}};function i(a,e,b){var d=e.hash.slice(1),f=document.getElementById(d)||document.getElementsByName(d)[0];if(!f){return}if(a){a.preventDefault()}var h=$(b.target);if(b.lock&&h.is(":animated")||b.onBefore&&b.onBefore.call(b,a,f,h)===false){return}if(b.stop){h.stop(true)}if(b.hash){var j=f.id==d?"id":"name",k=$("<a> </a>").attr(j,d).css({position:"absolute",top:$(window).scrollTop(),left:$(window).scrollLeft()});f[j]="";$("body").prepend(k);location=e.hash;k.remove();f[j]=d}h.scrollTo(f,b).trigger("notify.serialScroll",[f])}})(jQuery);
/*!
 * jQuery Form Plugin
 * version: 2.86 (08-OCT-2011)
 * @requires jQuery v1.3.2 or later
 *
 * Examples and documentation at: http://malsup.com/jquery/form/
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
(function($){$.fn.ajaxSubmit=function(options){if(!this.length){log("ajaxSubmit: skipping submit process - no element selected");return this}var method,action,url,$form=this;if(typeof options=="function"){options={success:options}}method=this.attr("method");action=this.attr("action");url=(typeof action==="string")?$.trim(action):"";url=url||window.location.href||"";if(url){url=(url.match(/^([^#]+)/)||[])[1]}options=$.extend(true,{url:url,success:$.ajaxSettings.success,type:method||"GET",iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},options);var veto={};this.trigger("form-pre-serialize",[this,options,veto]);if(veto.veto){log("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(options.beforeSerialize&&options.beforeSerialize(this,options)===false){log("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var traditional=options.traditional;if(traditional===undefined){traditional=$.ajaxSettings.traditional}var qx,n,v,a=this.formToArray(options.semantic);if(options.data){options.extraData=options.data;qx=$.param(options.data,traditional)}if(options.beforeSubmit&&options.beforeSubmit(a,this,options)===false){log("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[a,this,options,veto]);if(veto.veto){log("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}var q=$.param(a,traditional);if(qx){q=(q?(q+"&"+qx):qx)}if(options.type.toUpperCase()=="GET"){options.url+=(options.url.indexOf("?")>=0?"&":"?")+q;options.data=null}else{options.data=q}var callbacks=[];if(options.resetForm){callbacks.push(function(){$form.resetForm()})}if(options.clearForm){callbacks.push(function(){$form.clearForm()})}if(!options.dataType&&options.target){var oldSuccess=options.success||function(){};callbacks.push(function(data){var fn=options.replaceTarget?"replaceWith":"html";$(options.target)[fn](data).each(oldSuccess,arguments)})}else{if(options.success){callbacks.push(options.success)}}options.success=function(data,status,xhr){var context=options.context||options;for(var i=0,max=callbacks.length;i<max;i++){callbacks[i].apply(context,[data,status,xhr||$form,$form])}};var fileInputs=$("input:file",this).length>0;var mp="multipart/form-data";var multipart=($form.attr("enctype")==mp||$form.attr("encoding")==mp);if(options.iframe!==false&&(fileInputs||options.iframe||multipart)){if(options.closeKeepAlive){$.get(options.closeKeepAlive,function(){fileUpload(a)})}else{fileUpload(a)}}else{if($.browser.msie&&method=="get"&&typeof options.type==="undefined"){var ieMeth=$form[0].getAttribute("method");if(typeof ieMeth==="string"){options.type=ieMeth}}$.ajax(options)}this.trigger("form-submit-notify",[this,options]);return this;function fileUpload(a){var form=$form[0],el,i,s,g,id,$io,io,xhr,sub,n,timedOut,timeoutHandle;var useProp=!!$.fn.prop;if(a){if(useProp){for(i=0;i<a.length;i++){el=$(form[a[i].name]);el.prop("disabled",false)}}else{for(i=0;i<a.length;i++){el=$(form[a[i].name]);el.removeAttr("disabled")}}}if($(":input[name=submit],:input[id=submit]",form).length){alert('Error: Form elements must not have name or id of "submit".');return}s=$.extend(true,{},$.ajaxSettings,options);s.context=s.context||s;id="jqFormIO"+(new Date().getTime());if(s.iframeTarget){$io=$(s.iframeTarget);n=$io.attr("name");if(n==null){$io.attr("name",id)}else{id=n}}else{$io=$('<iframe name="'+id+'" src="'+s.iframeSrc+'" />');$io.css({position:"absolute",top:"-1000px",left:"-1000px"})}io=$io[0];xhr={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(status){var e=(status==="timeout"?"timeout":"aborted");log("aborting upload... "+e);this.aborted=1;$io.attr("src",s.iframeSrc);xhr.error=e;s.error&&s.error.call(s.context,xhr,e,status);g&&$.event.trigger("ajaxError",[xhr,s,e]);s.complete&&s.complete.call(s.context,xhr,e)}};g=s.global;if(g&&!$.active++){$.event.trigger("ajaxStart")}if(g){$.event.trigger("ajaxSend",[xhr,s])}if(s.beforeSend&&s.beforeSend.call(s.context,xhr,s)===false){if(s.global){$.active--}return}if(xhr.aborted){return}sub=form.clk;if(sub){n=sub.name;if(n&&!sub.disabled){s.extraData=s.extraData||{};s.extraData[n]=sub.value;if(sub.type=="image"){s.extraData[n+".x"]=form.clk_x;s.extraData[n+".y"]=form.clk_y}}}var CLIENT_TIMEOUT_ABORT=1;var SERVER_ABORT=2;function getDoc(frame){var doc=frame.contentWindow?frame.contentWindow.document:frame.contentDocument?frame.contentDocument:frame.document;return doc}function doSubmit(){var t=$form.attr("target"),a=$form.attr("action");form.setAttribute("target",id);if(!method){form.setAttribute("method","POST")}if(a!=s.url){form.setAttribute("action",s.url)}if(!s.skipEncodingOverride&&(!method||/post/i.test(method))){$form.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"})}if(s.timeout){timeoutHandle=setTimeout(function(){timedOut=true;cb(CLIENT_TIMEOUT_ABORT)},s.timeout)}function checkState(){try{var state=getDoc(io).readyState;log("state = "+state);if(state.toLowerCase()=="uninitialized"){setTimeout(checkState,50)}}catch(e){log("Server abort: ",e," (",e.name,")");cb(SERVER_ABORT);timeoutHandle&&clearTimeout(timeoutHandle);timeoutHandle=undefined}}var extraInputs=[];try{if(s.extraData){for(var n in s.extraData){extraInputs.push($('<input type="hidden" name="'+n+'" />').attr("value",s.extraData[n]).appendTo(form)[0])}}if(!s.iframeTarget){$io.appendTo("body");io.attachEvent?io.attachEvent("onload",cb):io.addEventListener("load",cb,false)}setTimeout(checkState,15);form.submit()}finally{form.setAttribute("action",a);if(t){form.setAttribute("target",t)}else{$form.removeAttr("target")}$(extraInputs).remove()}}if(s.forceSync){doSubmit()}else{setTimeout(doSubmit,10)}var data,doc,domCheckCount=50,callbackProcessed;function cb(e){if(xhr.aborted||callbackProcessed){return}try{doc=getDoc(io)}catch(ex){log("cannot access response document: ",ex);e=SERVER_ABORT}if(e===CLIENT_TIMEOUT_ABORT&&xhr){xhr.abort("timeout");return}else{if(e==SERVER_ABORT&&xhr){xhr.abort("server abort");return}}if(!doc||doc.location.href==s.iframeSrc){if(!timedOut){return}}io.detachEvent?io.detachEvent("onload",cb):io.removeEventListener("load",cb,false);var status="success",errMsg;try{if(timedOut){throw"timeout"}var isXml=s.dataType=="xml"||doc.XMLDocument||$.isXMLDoc(doc);log("isXml="+isXml);if(!isXml&&window.opera&&(doc.body==null||doc.body.innerHTML=="")){if(--domCheckCount){log("requeing onLoad callback, DOM not available");setTimeout(cb,250);return}}var docRoot=doc.body?doc.body:doc.documentElement;xhr.responseText=docRoot?docRoot.innerHTML:null;xhr.responseXML=doc.XMLDocument?doc.XMLDocument:doc;if(isXml){s.dataType="xml"}xhr.getResponseHeader=function(header){var headers={"content-type":s.dataType};return headers[header]};if(docRoot){xhr.status=Number(docRoot.getAttribute("status"))||xhr.status;xhr.statusText=docRoot.getAttribute("statusText")||xhr.statusText}var dt=(s.dataType||"").toLowerCase();var scr=/(json|script|text)/.test(dt);if(scr||s.textarea){var ta=doc.getElementsByTagName("textarea")[0];if(ta){xhr.responseText=ta.value;xhr.status=Number(ta.getAttribute("status"))||xhr.status;xhr.statusText=ta.getAttribute("statusText")||xhr.statusText}else{if(scr){var pre=doc.getElementsByTagName("pre")[0];var b=doc.getElementsByTagName("body")[0];if(pre){xhr.responseText=pre.textContent?pre.textContent:pre.innerText}else{if(b){xhr.responseText=b.textContent?b.textContent:b.innerText}}}}}else{if(dt=="xml"&&!xhr.responseXML&&xhr.responseText!=null){xhr.responseXML=toXml(xhr.responseText)}}try{data=httpData(xhr,dt,s)}catch(e){status="parsererror";xhr.error=errMsg=(e||status)}}catch(e){log("error caught: ",e);status="error";xhr.error=errMsg=(e||status)}if(xhr.aborted){log("upload aborted");status=null}if(xhr.status){status=(xhr.status>=200&&xhr.status<300||xhr.status===304)?"success":"error"}if(status==="success"){s.success&&s.success.call(s.context,data,"success",xhr);g&&$.event.trigger("ajaxSuccess",[xhr,s])}else{if(status){if(errMsg==undefined){errMsg=xhr.statusText}s.error&&s.error.call(s.context,xhr,status,errMsg);g&&$.event.trigger("ajaxError",[xhr,s,errMsg])}}g&&$.event.trigger("ajaxComplete",[xhr,s]);if(g&&!--$.active){$.event.trigger("ajaxStop")}s.complete&&s.complete.call(s.context,xhr,status);callbackProcessed=true;if(s.timeout){clearTimeout(timeoutHandle)}setTimeout(function(){if(!s.iframeTarget){$io.remove()}xhr.responseXML=null},100)}var toXml=$.parseXML||function(s,doc){if(window.ActiveXObject){doc=new ActiveXObject("Microsoft.XMLDOM");doc.async="false";doc.loadXML(s)}else{doc=(new DOMParser()).parseFromString(s,"text/xml")}return(doc&&doc.documentElement&&doc.documentElement.nodeName!="parsererror")?doc:null};var parseJSON=$.parseJSON||function(s){return window["eval"]("("+s+")")};var httpData=function(xhr,type,s){var ct=xhr.getResponseHeader("content-type")||"",xml=type==="xml"||!type&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.nodeName==="parsererror"){$.error&&$.error("parsererror")}if(s&&s.dataFilter){data=s.dataFilter(data,type)}if(typeof data==="string"){if(type==="json"||!type&&ct.indexOf("json")>=0){data=parseJSON(data)}else{if(type==="script"||!type&&ct.indexOf("javascript")>=0){$.globalEval(data)}}}return data}}};$.fn.ajaxForm=function(options){if(this.length===0){var o={s:this.selector,c:this.context};if(!$.isReady&&o.s){log("DOM not ready, queuing ajaxForm");$(function(){$(o.s,o.c).ajaxForm(options)});return this}log("terminating; zero elements found by selector"+($.isReady?"":" (DOM not ready)"));return this}return this.ajaxFormUnbind().bind("submit.form-plugin",function(e){if(!e.isDefaultPrevented()){e.preventDefault();$(this).ajaxSubmit(options)}}).bind("click.form-plugin",function(e){var target=e.target;var $el=$(target);if(!($el.is(":submit,input:image"))){var t=$el.closest(":submit");if(t.length==0){return}target=t[0]}var form=this;form.clk=target;if(target.type=="image"){if(e.offsetX!=undefined){form.clk_x=e.offsetX;form.clk_y=e.offsetY}else{if(typeof $.fn.offset=="function"){var offset=$el.offset();form.clk_x=e.pageX-offset.left;form.clk_y=e.pageY-offset.top}else{form.clk_x=e.pageX-target.offsetLeft;form.clk_y=e.pageY-target.offsetTop}}}setTimeout(function(){form.clk=form.clk_x=form.clk_y=null},100)})};$.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")};$.fn.formToArray=function(semantic){var a=[];if(this.length===0){return a}var form=this[0];var els=semantic?form.getElementsByTagName("*"):form.elements;if(!els){return a}var i,j,n,v,el,max,jmax;for(i=0,max=els.length;i<max;i++){el=els[i];n=el.name;if(!n){continue}if(semantic&&form.clk&&el.type=="image"){if(!el.disabled&&form.clk==el){a.push({name:n,value:$(el).val()});a.push({name:n+".x",value:form.clk_x},{name:n+".y",value:form.clk_y})}continue}v=$.fieldValue(el,true);if(v&&v.constructor==Array){for(j=0,jmax=v.length;j<jmax;j++){a.push({name:n,value:v[j]})}}else{if(v!==null&&typeof v!="undefined"){a.push({name:n,value:v})}}}if(!semantic&&form.clk){var $input=$(form.clk),input=$input[0];n=input.name;if(n&&!input.disabled&&input.type=="image"){a.push({name:n,value:$input.val()});a.push({name:n+".x",value:form.clk_x},{name:n+".y",value:form.clk_y})}}return a};$.fn.formSerialize=function(semantic){return $.param(this.formToArray(semantic))};$.fn.fieldSerialize=function(successful){var a=[];this.each(function(){var n=this.name;if(!n){return}var v=$.fieldValue(this,successful);if(v&&v.constructor==Array){for(var i=0,max=v.length;i<max;i++){a.push({name:n,value:v[i]})}}else{if(v!==null&&typeof v!="undefined"){a.push({name:this.name,value:v})}}});return $.param(a)};$.fn.fieldValue=function(successful){for(var val=[],i=0,max=this.length;i<max;i++){var el=this[i];var v=$.fieldValue(el,successful);if(v===null||typeof v=="undefined"||(v.constructor==Array&&!v.length)){continue}v.constructor==Array?$.merge(val,v):val.push(v)}return val};$.fieldValue=function(el,successful){var n=el.name,t=el.type,tag=el.tagName.toLowerCase();if(successful===undefined){successful=true}if(successful&&(!n||el.disabled||t=="reset"||t=="button"||(t=="checkbox"||t=="radio")&&!el.checked||(t=="submit"||t=="image")&&el.form&&el.form.clk!=el||tag=="select"&&el.selectedIndex==-1)){return null}if(tag=="select"){var index=el.selectedIndex;if(index<0){return null}var a=[],ops=el.options;var one=(t=="select-one");var max=(one?index+1:ops.length);for(var i=(one?index:0);i<max;i++){var op=ops[i];if(op.selected){var v=op.value;if(!v){v=(op.attributes&&op.attributes.value&&!(op.attributes.value.specified))?op.text:op.value}if(one){return v}a.push(v)}}return a}return $(el).val()};$.fn.clearForm=function(){return this.each(function(){$("input,select,textarea",this).clearFields()})};$.fn.clearFields=$.fn.clearInputs=function(){var re=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var t=this.type,tag=this.tagName.toLowerCase();if(re.test(t)||tag=="textarea"){this.value=""}else{if(t=="checkbox"||t=="radio"){this.checked=false}else{if(tag=="select"){this.selectedIndex=-1}}}})};$.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset()}})};$.fn.enable=function(b){if(b===undefined){b=true}return this.each(function(){this.disabled=!b})};$.fn.selected=function(select){if(select===undefined){select=true}return this.each(function(){var t=this.type;if(t=="checkbox"||t=="radio"){this.checked=select}else{if(this.tagName.toLowerCase()=="option"){var $sel=$(this).parent("select");if(select&&$sel[0]&&$sel[0].type=="select-one"){$sel.find("option").selected(false)}this.selected=select}}})};$.fn.ajaxSubmit.debug=false;function log(){if(!$.fn.ajaxSubmit.debug){return}var msg="[jquery.form] "+Array.prototype.join.call(arguments,"");if(window.console&&window.console.log){window.console.log(msg)}else{if(window.opera&&window.opera.postError){window.opera.postError(msg)}}}})(jQuery);(function(c){c.extend(c.fn,{validate:function(a){if(this.length){var b=c.data(this[0],"validator");if(b){return b}b=new c.validator(a,this[0]);c.data(this[0],"validator",b);if(b.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){b.cancelSubmit=true});b.settings.submitHandler&&this.find("input, button").filter(":submit").click(function(){b.submitButton=this});this.submit(function(d){function e(){if(b.settings.submitHandler){if(b.submitButton){var f=c("<input type='hidden'/>").attr("name",b.submitButton.name).val(b.submitButton.value).appendTo(b.currentForm)}b.settings.submitHandler.call(b,b.currentForm);b.submitButton&&f.remove();return false}return true}b.settings.debug&&d.preventDefault();if(b.cancelSubmit){b.cancelSubmit=false;return e()}if(b.form()){if(b.pendingRequest){b.formSubmitted=true;return false}return e()}else{b.focusInvalid();return false}})}return b}else{a&&a.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing")}},valid:function(){if(c(this[0]).is("form")){return this.validate().form()}else{var a=true,b=c(this[0].form).validate();this.each(function(){a&=b.element(this)});return a}},removeAttrs:function(a){var b={},d=this;c.each(a.split(/\s/),function(e,f){b[f]=d.attr(f);d.removeAttr(f)});return b},rules:function(a,b){var d=this[0];if(a){var e=c.data(d.form,"validator").settings,f=e.rules,g=c.validator.staticRules(d);switch(a){case"add":c.extend(g,c.validator.normalizeRule(b));f[d.name]=g;if(b.messages){e.messages[d.name]=c.extend(e.messages[d.name],b.messages)}break;case"remove":if(!b){delete f[d.name];return g}var h={};c.each(b.split(/\s/),function(j,i){h[i]=g[i];delete g[i]});return h}}d=c.validator.normalizeRules(c.extend({},c.validator.metadataRules(d),c.validator.classRules(d),c.validator.attributeRules(d),c.validator.staticRules(d)),d);if(d.required){e=d.required;delete d.required;d=c.extend({required:e},d)}return d}});c.extend(c.expr[":"],{blank:function(a){return !c.trim(""+a.value)},filled:function(a){return !!c.trim(""+a.value)},unchecked:function(a){return !a.checked}});c.validator=function(a,b){this.settings=c.extend(true,{},c.validator.defaults,a);this.currentForm=b;this.init()};c.validator.format=function(a,b){if(arguments.length==1){return function(){var d=c.makeArray(arguments);d.unshift(a);return c.validator.format.apply(this,d)}}if(arguments.length>2&&b.constructor!=Array){b=c.makeArray(arguments).slice(1)}if(b.constructor!=Array){b=[b]}c.each(b,function(d,e){a=a.replace(RegExp("\\{"+d+"\\}","g"),e)});return a};c.extend(c.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:c([]),errorLabelContainer:c([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(a){this.lastActive=a;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass);this.addWrapper(this.errorsFor(a)).hide()}},onfocusout:function(a){if(!this.checkable(a)&&(a.name in this.submitted||!this.optional(a))){this.element(a)}},onkeyup:function(a){if(a.name in this.submitted||a==this.lastElement){this.element(a)}},onclick:function(a){if(a.name in this.submitted){this.element(a)}else{a.parentNode.name in this.submitted&&this.element(a.parentNode)}},highlight:function(a,b,d){a.type==="radio"?this.findByName(a.name).addClass(b).removeClass(d):c(a).addClass(b).removeClass(d)},unhighlight:function(a,b,d){a.type==="radio"?this.findByName(a.name).removeClass(b).addClass(d):c(a).removeClass(b).addClass(d)}},setDefaults:function(a){c.extend(c.validator.defaults,a)},messages:{required:"Dit veld is verplicht.",remote:"Please fix this field.",email:"Het opgegeven e-mailadres is ongeldig.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:c.validator.format("Please enter no more than {0} characters."),minlength:c.validator.format("Please enter at least {0} characters."),rangelength:c.validator.format("Please enter a value between {0} and {1} characters long."),range:c.validator.format("Please enter a value between {0} and {1}."),max:c.validator.format("Please enter a value less than or equal to {0}."),min:c.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){function a(e){var f=c.data(this[0].form,"validator");e="on"+e.type.replace(/^validate/,"");f.settings[e]&&f.settings[e].call(f,this[0])}this.labelContainer=c(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||c(this.currentForm);this.containers=c(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var b=this.groups={};c.each(this.settings.groups,function(e,f){c.each(f.split(/\s/),function(g,h){b[h]=e})});var d=this.settings.rules;c.each(d,function(e,f){d[e]=c.validator.normalizeRule(f)});c(this.currentForm).validateDelegate(":text, :password, :file, select, textarea","focusin focusout keyup",a).validateDelegate(":radio, :checkbox, select, option","click",a);this.settings.invalidHandler&&c(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){this.checkForm();c.extend(this.submitted,this.errorMap);this.invalid=c.extend({},this.errorMap);this.valid()||c(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++){this.check(b[a])}return this.valid()},element:function(a){this.lastElement=a=this.clean(a);this.prepareElement(a);this.currentElements=c(a);var b=this.check(a);if(b){delete this.invalid[a.name]}else{this.invalid[a.name]=true}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers)}this.showErrors();return b},showErrors:function(a){if(a){c.extend(this.errorMap,a);this.errorList=[];for(var b in a){this.errorList.push({message:a[b],element:this.findByName(b)[0]})}this.successList=c.grep(this.successList,function(d){return !(d.name in a)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){c.fn.resetForm&&c(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b=0,d;for(d in a){b++}return b},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return this.size()==0},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid){try{c(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(a){}}},findLastActive:function(){var a=this.lastActive;return a&&c.grep(this.errorList,function(b){return b.element.name==a.name}).length==1&&a},elements:function(){var a=this,b={};return c(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&a.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in b||!a.objectLength(c(this).rules())){return false}return b[this.name]=true})},clean:function(a){return c(a)[0]},errors:function(){return c(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext)},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=c([]);this.toHide=c([]);this.currentElements=c([])},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset();this.toHide=this.errorsFor(a)},check:function(a){a=this.clean(a);if(this.checkable(a)){a=this.findByName(a.name).not(this.settings.ignore)[0]}var b=c(a).rules(),d=false,e;for(e in b){var f={method:e,parameters:b[e]};try{var g=c.validator.methods[e].call(this,a.value.replace(/\r/g,""),a,f.parameters);if(g=="dependency-mismatch"){d=true}else{d=false;if(g=="pending"){this.toHide=this.toHide.not(this.errorsFor(a));return}if(!g){this.formatAndAdd(a,f);return false}}}catch(h){this.settings.debug&&window.console&&console.log("exception occured when checking element "+a.id+", check the '"+f.method+"' method",h);throw h}}if(!d){this.objectLength(b)&&this.successList.push(a);return true}},customMetaMessage:function(a,b){if(c.metadata){var d=this.settings.meta?c(a).metadata()[this.settings.meta]:c(a).metadata();return d&&d.messages&&d.messages[b]}},customMessage:function(a,b){var d=this.settings.messages[a];return d&&(d.constructor==String?d:d[b])},findDefined:function(){for(var a=0;a<arguments.length;a++){if(arguments[a]!==undefined){return arguments[a]}}},defaultMessage:function(a,b){return this.findDefined(this.customMessage(a.name,b),this.customMetaMessage(a,b),!this.settings.ignoreTitle&&a.title||undefined,c.validator.messages[b],"<strong>Warning: No message defined for "+a.name+"</strong>")},formatAndAdd:function(a,b){var d=this.defaultMessage(a,b.method),e=/\$?\{(\d+)\}/g;if(typeof d=="function"){d=d.call(this,b.parameters,a)}else{if(e.test(d)){d=jQuery.format(d.replace(e,"{$1}"),b.parameters)}}this.errorList.push({message:d,element:a});this.errorMap[a.name]=d;this.submitted[a.name]=d},addWrapper:function(a){if(this.settings.wrapper){a=a.add(a.parent(this.settings.wrapper))}return a},defaultShowErrors:function(){for(var a=0;this.errorList[a];a++){var b=this.errorList[a];this.settings.highlight&&this.settings.highlight.call(this,b.element,this.settings.errorClass,this.settings.validClass);this.showLabel(b.element,b.message)}if(this.errorList.length){this.toShow=this.toShow.add(this.containers)}if(this.settings.success){for(a=0;this.successList[a];a++){this.showLabel(this.successList[a])}}if(this.settings.unhighlight){a=0;for(b=this.validElements();b[a];a++){this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass)}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return c(this.errorList).map(function(){return this.element})},showLabel:function(a,b){var d=this.errorsFor(a);if(d.length){d.removeClass().addClass(this.settings.errorClass);d.attr("generated")&&d.html(b)}else{d=c("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(a),generated:true}).addClass(this.settings.errorClass).html(b||"");if(this.settings.wrapper){d=d.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()}this.labelContainer.append(d).length||(this.settings.errorPlacement?this.settings.errorPlacement(d,c(a)):d.insertAfter(a))}if(!b&&this.settings.success){d.text("");typeof this.settings.success=="string"?d.addClass(this.settings.success):this.settings.success(d)}this.toShow=this.toShow.add(d)},errorsFor:function(a){var b=this.idOrName(a);return this.errors().filter(function(){return c(this).attr("for")==b})},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(a){var b=this.currentForm;return c(document.getElementsByName(a)).map(function(d,e){return e.form==b&&e.name==a&&e||null})},getLength:function(a,b){switch(b.nodeName.toLowerCase()){case"select":return c("option:selected",b).length;case"input":if(this.checkable(b)){return this.findByName(b.name).filter(":checked").length}}return a.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):true},dependTypes:{"boolean":function(a){return a},string:function(a,b){return !!c(a,b.form).length},"function":function(a,b){return a(b)}},optional:function(a){return !c.validator.methods.required.call(this,c.trim(a.value),a)&&"dependency-mismatch"},startRequest:function(a){if(!this.pending[a.name]){this.pendingRequest++;this.pending[a.name]=true}},stopRequest:function(a,b){this.pendingRequest--;if(this.pendingRequest<0){this.pendingRequest=0}delete this.pending[a.name];if(b&&this.pendingRequest==0&&this.formSubmitted&&this.form()){c(this.currentForm).submit();this.formSubmitted=false}else{if(!b&&this.pendingRequest==0&&this.formSubmitted){c(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=false}}},previousValue:function(a){return c.data(a,"previousValue")||c.data(a,"previousValue",{old:null,valid:true,message:this.defaultMessage(a,"remote")})}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(a,b){a.constructor==String?this.classRuleSettings[a]=b:c.extend(this.classRuleSettings,a)},classRules:function(a){var b={};(a=c(a).attr("class"))&&c.each(a.split(" "),function(){this in c.validator.classRuleSettings&&c.extend(b,c.validator.classRuleSettings[this])});return b},attributeRules:function(a){var b={};a=c(a);for(var d in c.validator.methods){var e=a.attr(d);if(e){b[d]=e}}b.maxlength&&/-1|2147483647|524288/.test(b.maxlength)&&delete b.maxlength;return b},metadataRules:function(a){if(!c.metadata){return{}}var b=c.data(a.form,"validator").settings.meta;return b?c(a).metadata()[b]:c(a).metadata()},staticRules:function(a){var b={},d=c.data(a.form,"validator");if(d.settings.rules){b=c.validator.normalizeRule(d.settings.rules[a.name])||{}}return b},normalizeRules:function(a,b){c.each(a,function(d,e){if(e===false){delete a[d]}else{if(e.param||e.depends){var f=true;switch(typeof e.depends){case"string":f=!!c(e.depends,b.form).length;break;case"function":f=e.depends.call(b,b)}if(f){a[d]=e.param!==undefined?e.param:true}else{delete a[d]}}}});c.each(a,function(d,e){a[d]=c.isFunction(e)?e(b):e});c.each(["minlength","maxlength","min","max"],function(){if(a[this]){a[this]=Number(a[this])}});c.each(["rangelength","range"],function(){if(a[this]){a[this]=[Number(a[this][0]),Number(a[this][1])]}});if(c.validator.autoCreateRanges){if(a.min&&a.max){a.range=[a.min,a.max];delete a.min;delete a.max}if(a.minlength&&a.maxlength){a.rangelength=[a.minlength,a.maxlength];delete a.minlength;delete a.maxlength}}a.messages&&delete a.messages;return a},normalizeRule:function(a){if(typeof a=="string"){var b={};c.each(a.split(/\s/),function(){b[this]=true});a=b}return a},addMethod:function(a,b,d){c.validator.methods[a]=b;c.validator.messages[a]=d!=undefined?d:c.validator.messages[a];b.length<3&&c.validator.addClassRules(a,c.validator.normalizeRule(a))},methods:{required:function(a,b,d){if(!this.depend(d,b)){return"dependency-mismatch"}switch(b.nodeName.toLowerCase()){case"select":return(a=c(b).val())&&a.length>0;case"input":if(this.checkable(b)){return this.getLength(a,b)>0}default:return c.trim(a).length>0}},remote:function(a,b,d){if(this.optional(b)){return"dependency-mismatch"}var e=this.previousValue(b);this.settings.messages[b.name]||(this.settings.messages[b.name]={});e.originalMessage=this.settings.messages[b.name].remote;this.settings.messages[b.name].remote=e.message;d=typeof d=="string"&&{url:d}||d;if(this.pending[b.name]){return"pending"}if(e.old===a){return e.valid}e.old=a;var f=this;this.startRequest(b);var g={};g[b.name]=a;c.ajax(c.extend(true,{url:d,mode:"abort",port:"validate"+b.name,dataType:"json",data:g,success:function(h){f.settings.messages[b.name].remote=e.originalMessage;var j=h===true;if(j){var i=f.formSubmitted;f.prepareElement(b);f.formSubmitted=i;f.successList.push(b);f.showErrors()}else{i={};h=h||f.defaultMessage(b,"remote");i[b.name]=e.message=c.isFunction(h)?h(a):h;f.showErrors(i)}e.valid=j;f.stopRequest(b,j)}},d));return"pending"},minlength:function(a,b,d){return this.optional(b)||this.getLength(c.trim(a),b)>=d},maxlength:function(a,b,d){return this.optional(b)||this.getLength(c.trim(a),b)<=d},rangelength:function(a,b,d){a=this.getLength(c.trim(a),b);return this.optional(b)||a>=d[0]&&a<=d[1]},min:function(a,b,d){return this.optional(b)||a>=d},max:function(a,b,d){return this.optional(b)||a<=d},range:function(a,b,d){return this.optional(b)||a>=d[0]&&a<=d[1]},email:function(a,b){return this.optional(b)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(a)},url:function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a))},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b)){return"dependency-mismatch"}if(/[^0-9-]+/.test(a)){return false}var d=0,e=0,f=false;a=a.replace(/\D/g,"");for(var g=a.length-1;g>=0;g--){e=a.charAt(g);e=parseInt(e,10);if(f){if((e*=2)>9){e-=9}}d+=e;f=!f}return d%10==0},accept:function(a,b,d){d=typeof d=="string"?d.replace(/,/g,"|"):"png|jpe?g|gif";return this.optional(b)||a.match(RegExp(".("+d+")$","i"))},equalTo:function(a,b,d){d=c(d).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){c(b).valid()});return a==d.val()}}});c.format=c.validator.format})(jQuery);(function(c){var a={};if(c.ajaxPrefilter){c.ajaxPrefilter(function(d,e,f){e=d.port;if(d.mode=="abort"){a[e]&&a[e].abort();a[e]=f}})}else{var b=c.ajax;c.ajax=function(d){var e=("port" in d?d:c.ajaxSettings).port;if(("mode" in d?d:c.ajaxSettings).mode=="abort"){a[e]&&a[e].abort();return a[e]=b.apply(this,arguments)}return b.apply(this,arguments)}}})(jQuery);(function(c){!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.handle.call(this,e)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)},handler:function(e){arguments[0]=c.event.fix(e);arguments[0].type=b;return c.event.handle.apply(this,arguments)}}});c.extend(c.fn,{validateDelegate:function(a,b,d){return this.bind(b,function(e){var f=c(e.target);if(f.is(a)){return d.apply(f,arguments)}})}})})(jQuery);(function($){$.fn.swipe=function(options){if(!this){return false}var defaults={fingers:1,threshold:75,swipe:null,swipeLeft:null,swipeRight:null,swipeUp:null,swipeDown:null,swipeStatus:null,click:null,triggerOnTouchEnd:true,allowPageScroll:"auto"};var LEFT="left";var RIGHT="right";var UP="up";var DOWN="down";var NONE="none";var HORIZONTAL="horizontal";var VERTICAL="vertical";var AUTO="auto";var PHASE_START="start";var PHASE_MOVE="move";var PHASE_END="end";var PHASE_CANCEL="cancel";var phase="start";if(options.allowPageScroll==undefined&&(options.swipe!=undefined||options.swipeStatus!=undefined)){options.allowPageScroll=NONE}if(options){$.extend(defaults,options)}return this.each(function(){var $this=$(this);var triggerElementID=null;var fingerCount=0;var start={x:0,y:0};var end={x:0,y:0};var delta={x:0,y:0};function touchStart(event){phase=PHASE_START;fingerCount=event.touches.length;distance=0;direction=null;if(fingerCount==defaults.fingers){start.x=end.x=event.touches[0].pageX;start.y=end.y=event.touches[0].pageY;if(defaults.swipeStatus){triggerHandler(event,phase)}}else{touchCancel(event)}}function touchMove(event){if(phase==PHASE_END||phase==PHASE_CANCEL){return}end.x=event.touches[0].pageX;end.y=event.touches[0].pageY;direction=caluculateDirection();fingerCount=event.touches.length;phase=PHASE_MOVE;validateDefaultEvent(event,direction);if(fingerCount==defaults.fingers){distance=caluculateDistance();if(defaults.swipeStatus){triggerHandler(event,phase,direction,distance)}if(!defaults.triggerOnTouchEnd){if(distance>=defaults.threshold){phase=PHASE_END;triggerHandler(event,phase);touchCancel(event)}}}else{phase=PHASE_CANCEL;triggerHandler(event,phase);touchCancel(event)}}function touchEnd(event){event.preventDefault();distance=caluculateDistance();direction=caluculateDirection();if(defaults.triggerOnTouchEnd){phase=PHASE_END;if(fingerCount==defaults.fingers&&end.x!=0){if(distance>=defaults.threshold){triggerHandler(event,phase);touchCancel(event)}else{phase=PHASE_CANCEL;triggerHandler(event,phase);touchCancel(event)}}else{phase=PHASE_CANCEL;triggerHandler(event,phase);touchCancel(event)}}else{if(phase==PHASE_MOVE){phase=PHASE_CANCEL;triggerHandler(event,phase);touchCancel(event)}}}function touchCancel(event){fingerCount=0;start.x=0;start.y=0;end.x=0;end.y=0;delta.x=0;delta.y=0}function triggerHandler(event,phase){if(defaults.swipeStatus){defaults.swipeStatus.call($this,event,phase,direction||null,distance||0)}if(phase==PHASE_CANCEL){if(defaults.click&&fingerCount==1&&(isNaN(distance)||distance==0)){defaults.click.call($this,event,event.target)}}if(phase==PHASE_END){if(defaults.swipe){defaults.swipe.call($this,event,direction,distance)}switch(direction){case LEFT:if(defaults.swipeLeft){defaults.swipeLeft.call($this,event,direction,distance)}break;case RIGHT:if(defaults.swipeRight){defaults.swipeRight.call($this,event,direction,distance)}break;case UP:if(defaults.swipeUp){defaults.swipeUp.call($this,event,direction,distance)}break;case DOWN:if(defaults.swipeDown){defaults.swipeDown.call($this,event,direction,distance)}break}}}function validateDefaultEvent(event,direction){if(defaults.allowPageScroll==NONE){event.preventDefault()}else{var auto=defaults.allowPageScroll==AUTO;switch(direction){case LEFT:if((defaults.swipeLeft&&auto)||(!auto&&defaults.allowPageScroll!=HORIZONTAL)){event.preventDefault()}break;case RIGHT:if((defaults.swipeRight&&auto)||(!auto&&defaults.allowPageScroll!=HORIZONTAL)){event.preventDefault()}break;case UP:if((defaults.swipeUp&&auto)||(!auto&&defaults.allowPageScroll!=VERTICAL)){event.preventDefault()}break;case DOWN:if((defaults.swipeDown&&auto)||(!auto&&defaults.allowPageScroll!=VERTICAL)){event.preventDefault()}break}}}function caluculateDistance(){return Math.round(Math.sqrt(Math.pow(end.x-start.x,2)+Math.pow(end.y-start.y,2)))}function caluculateAngle(){var X=start.x-end.x;var Y=end.y-start.y;var r=Math.atan2(Y,X);var angle=Math.round(r*180/Math.PI);if(angle<0){angle=360-Math.abs(angle)}return angle}function caluculateDirection(){var angle=caluculateAngle();if((angle<=45)&&(angle>=0)){return LEFT}else{if((angle<=360)&&(angle>=315)){return LEFT}else{if((angle>=135)&&(angle<=225)){return RIGHT}else{if((angle>45)&&(angle<135)){return DOWN}else{return UP}}}}}try{this.addEventListener("touchstart",touchStart,false);this.addEventListener("touchmove",touchMove,false);this.addEventListener("touchend",touchEnd,false);this.addEventListener("touchcancel",touchCancel,false)}catch(e){}})}})(jQuery);(function(window,undefined){var History=window.History=window.History||{},jQuery=window.jQuery;if(typeof History.Adapter!=="undefined"){throw new Error("History.js Adapter has already been loaded...")}History.Adapter={bind:function(el,event,callback){jQuery(el).bind(event,callback)},trigger:function(el,event){jQuery(el).trigger(event)},onDomLoad:function(callback){jQuery(callback)}};if(typeof History.init!=="undefined"){History.init()}})(window);(function(window,undefined){var console=window.console||undefined,document=window.document,navigator=window.navigator,amplify=window.amplify||false,setTimeout=window.setTimeout,clearTimeout=window.clearTimeout,setInterval=window.setInterval,clearInterval=window.clearInterval,JSON=window.JSON,History=window.History=window.History||{},history=window.history;JSON.stringify=JSON.stringify||JSON.encode;JSON.parse=JSON.parse||JSON.decode;if(typeof History.init!=="undefined"){throw new Error("History.js Core has already been loaded...")}History.init=function(){if(typeof History.Adapter==="undefined"){return false}if(typeof History.initCore!=="undefined"){History.initCore()}if(typeof History.initHtml4!=="undefined"){History.initHtml4()}return true};History.initCore=function(){if(typeof History.initCore.initialized!=="undefined"){return false}else{History.initCore.initialized=true}History.options=History.options||{};History.options.hashChangeInterval=History.options.hashChangeInterval||100;History.options.safariPollInterval=History.options.safariPollInterval||500;History.options.doubleCheckInterval=History.options.doubleCheckInterval||500;History.options.storeInterval=History.options.storeInterval||1000;History.options.busyDelay=History.options.busyDelay||250;History.options.debug=History.options.debug||false;History.options.initialTitle=History.options.initialTitle||document.title;History.intervalList=[];History.clearAllIntervals=function(){var i,il=History.intervalList;if(typeof il!=="undefined"&&il!==null){for(i=0;i<il.length;i++){clearInterval(il[i])}History.intervalList=null}};History.Adapter.bind(window,"beforeunload",History.clearAllIntervals);History.Adapter.bind(window,"unload",History.clearAllIntervals);History.debug=function(){if((History.options.debug||false)){History.log.apply(History,arguments)}};History.log=function(){var consoleExists=!(typeof console==="undefined"||typeof console.log==="undefined"||typeof console.log.apply==="undefined"),textarea=document.getElementById("log"),message,i,n;if(consoleExists){var args=Array.prototype.slice.call(arguments);message=args.shift();if(typeof console.debug!=="undefined"){console.debug.apply(console,[message,args])}else{console.log.apply(console,[message,args])}}else{message=("\n"+arguments[0]+"\n")}for(i=1,n=arguments.length;i<n;++i){var arg=arguments[i];if(typeof arg==="object"&&typeof JSON!=="undefined"){try{arg=JSON.stringify(arg)}catch(Exception){}}message+="\n"+arg+"\n"}if(textarea){textarea.value+=message+"\n-----\n";textarea.scrollTop=textarea.scrollHeight-textarea.clientHeight}else{if(!consoleExists){alert(message)}}return true};History.getInternetExplorerMajorVersion=function(){var result=History.getInternetExplorerMajorVersion.cached=(typeof History.getInternetExplorerMajorVersion.cached!=="undefined")?History.getInternetExplorerMajorVersion.cached:(function(){var v=3,div=document.createElement("div"),all=div.getElementsByTagName("i");while((div.innerHTML="<!--[if gt IE "+(++v)+"]><i></i><![endif]-->")&&all[0]){}return(v>4)?v:false})();return result};History.isInternetExplorer=function(){var result=History.isInternetExplorer.cached=(typeof History.isInternetExplorer.cached!=="undefined")?History.isInternetExplorer.cached:Boolean(History.getInternetExplorerMajorVersion());return result};History.emulated={pushState:!Boolean(window.history&&window.history.pushState&&window.history.replaceState&&!((/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i).test(navigator.userAgent)||(/AppleWebKit\/5([0-2]|3[0-2])/i).test(navigator.userAgent))),hashChange:Boolean(!(("onhashchange" in window)||("onhashchange" in document))||(History.isInternetExplorer()&&History.getInternetExplorerMajorVersion()<8))};History.enabled=!History.emulated.pushState;History.bugs={setHash:Boolean(!History.emulated.pushState&&navigator.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(navigator.userAgent)),safariPoll:Boolean(!History.emulated.pushState&&navigator.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(navigator.userAgent)),ieDoubleCheck:Boolean(History.isInternetExplorer()&&History.getInternetExplorerMajorVersion()<8),hashEscape:Boolean(History.isInternetExplorer()&&History.getInternetExplorerMajorVersion()<7)};History.isEmptyObject=function(obj){for(var name in obj){return false}return true};History.cloneObject=function(obj){var hash,newObj;if(obj){hash=JSON.stringify(obj);newObj=JSON.parse(hash)}else{newObj={}}return newObj};History.getRootUrl=function(){var rootUrl=document.location.protocol+"//"+(document.location.hostname||document.location.host);if(document.location.port||false){rootUrl+=":"+document.location.port}rootUrl+="/";return rootUrl};History.getBaseHref=function(){var baseElements=document.getElementsByTagName("base"),baseElement=null,baseHref="";if(baseElements.length===1){baseElement=baseElements[0];baseHref=baseElement.href.replace(/[^\/]+$/,"")}baseHref=baseHref.replace(/\/+$/,"");if(baseHref){baseHref+="/"}return baseHref};History.getBaseUrl=function(){var baseUrl=History.getBaseHref()||History.getBasePageUrl()||History.getRootUrl();return baseUrl};History.getPageUrl=function(){var State=History.getState(false,false),stateUrl=(State||{}).url||document.location.href;var pageUrl=stateUrl.replace(/\/+$/,"").replace(/[^\/]+$/,function(part,index,string){return(/\./).test(part)?part:part+"/"});return pageUrl};History.getBasePageUrl=function(){var basePageUrl=document.location.href.replace(/[#\?].*/,"").replace(/[^\/]+$/,function(part,index,string){return(/[^\/]$/).test(part)?"":part}).replace(/\/+$/,"")+"/";return basePageUrl};History.getFullUrl=function(url,allowBaseHref){var fullUrl=url,firstChar=url.substring(0,1);allowBaseHref=(typeof allowBaseHref==="undefined")?true:allowBaseHref;if(/[a-z]+\:\/\//.test(url)){}else{if(firstChar==="/"){fullUrl=History.getRootUrl()+url.replace(/^\/+/,"")}else{if(firstChar==="#"){fullUrl=History.getPageUrl().replace(/#.*/,"")+url}else{if(firstChar==="?"){fullUrl=History.getPageUrl().replace(/[\?#].*/,"")+url}else{if(allowBaseHref){fullUrl=History.getBaseUrl()+url.replace(/^(\.\/)+/,"")}else{fullUrl=History.getBasePageUrl()+url.replace(/^(\.\/)+/,"")}}}}}return fullUrl.replace(/\#$/,"")};History.getShortUrl=function(url){var shortUrl=url,baseUrl=History.getBaseUrl(),rootUrl=History.getRootUrl();if(History.emulated.pushState){shortUrl=shortUrl.replace(baseUrl,"")}shortUrl=shortUrl.replace(rootUrl,"/");if(History.isTraditionalAnchor(shortUrl)){shortUrl="./"+shortUrl}shortUrl=shortUrl.replace(/^(\.\/)+/g,"./").replace(/\#$/,"");return shortUrl};History.store=amplify?(amplify.store("History.store")||{}):{};History.store.idToState=History.store.idToState||{};History.store.urlToId=History.store.urlToId||{};History.store.stateToId=History.store.stateToId||{};History.idToState=History.idToState||{};History.stateToId=History.stateToId||{};History.urlToId=History.urlToId||{};History.storedStates=History.storedStates||[];History.savedStates=History.savedStates||[];History.getState=function(friendly,create){if(typeof friendly==="undefined"){friendly=true}if(typeof create==="undefined"){create=true}var State=History.getLastSavedState();if(!State&&create){State=History.createStateObject()}if(friendly){State=History.cloneObject(State);State.url=State.cleanUrl||State.url}return State};History.getIdByState=function(newState){var id=History.extractId(newState.url);if(!id){var str=History.getStateString(newState);if(typeof History.stateToId[str]!=="undefined"){id=History.stateToId[str]}else{if(typeof History.store.stateToId[str]!=="undefined"){id=History.store.stateToId[str]}else{while(true){id=String(Math.floor(Math.random()*1000));if(typeof History.idToState[id]==="undefined"&&typeof History.store.idToState[id]==="undefined"){break}}History.stateToId[str]=id;History.idToState[id]=newState}}}return id};History.normalizeState=function(oldState){if(!oldState||(typeof oldState!=="object")){oldState={}}if(typeof oldState.normalized!=="undefined"){return oldState}if(!oldState.data||(typeof oldState.data!=="object")){oldState.data={}}var newState={};newState.normalized=true;newState.title=oldState.title||"";newState.url=History.getFullUrl(History.unescapeString(oldState.url||document.location.href));newState.hash=History.getShortUrl(newState.url);newState.data=History.cloneObject(oldState.data);newState.id=History.getIdByState(newState);newState.cleanUrl=newState.url.replace(/\??\&_suid.*/,"");newState.url=newState.cleanUrl;var dataNotEmpty=!History.isEmptyObject(newState.data);if(newState.title||dataNotEmpty){newState.hash=History.getShortUrl(newState.url).replace(/\??\&_suid.*/,"");if(!/\?/.test(newState.hash)){newState.hash+="?"}newState.hash+="&_suid="+newState.id}newState.hashedUrl=History.getFullUrl(newState.hash);if((History.emulated.pushState||History.bugs.safariPoll)&&History.hasUrlDuplicate(newState)){newState.url=newState.hashedUrl}return newState};History.createStateObject=function(data,title,url){var State={data:data,title:title,url:url};State=History.normalizeState(State);return State};History.getStateById=function(id){id=String(id);var State=History.idToState[id]||History.store.idToState[id]||undefined;return State};History.getStateString=function(passedState){var State=History.normalizeState(passedState);var cleanedState={data:State.data,title:passedState.title,url:passedState.url};var str=JSON.stringify(cleanedState);return str};History.getStateId=function(passedState){var State=History.normalizeState(passedState);var id=State.id;return id};History.getHashByState=function(passedState){var hash,State=History.normalizeState(passedState);hash=State.hash;return hash};History.extractId=function(url_or_hash){var id;var parts,url;parts=/(.*)\&_suid=([0-9]+)$/.exec(url_or_hash);url=parts?(parts[1]||url_or_hash):url_or_hash;id=parts?String(parts[2]||""):"";return id||false};History.isTraditionalAnchor=function(url_or_hash){var isTraditional=!(/[\/\?\.]/.test(url_or_hash));return isTraditional};History.extractState=function(url_or_hash,create){var State=null;create=create||false;var id=History.extractId(url_or_hash);if(id){State=History.getStateById(id)}if(!State){var url=History.getFullUrl(url_or_hash);id=History.getIdByUrl(url)||false;if(id){State=History.getStateById(id)}if(!State&&create&&!History.isTraditionalAnchor(url_or_hash)){State=History.createStateObject(null,null,url)}}return State};History.getIdByUrl=function(url){var id=History.urlToId[url]||History.store.urlToId[url]||undefined;return id};History.getLastSavedState=function(){return History.savedStates[History.savedStates.length-1]||undefined};History.getLastStoredState=function(){return History.storedStates[History.storedStates.length-1]||undefined};History.hasUrlDuplicate=function(newState){var hasDuplicate=false;var oldState=History.extractState(newState.url);hasDuplicate=oldState&&oldState.id!==newState.id;return hasDuplicate};History.storeState=function(newState){History.urlToId[newState.url]=newState.id;History.storedStates.push(History.cloneObject(newState));return newState};History.isLastSavedState=function(newState){var isLast=false;if(History.savedStates.length){var newId=newState.id,oldState=History.getLastSavedState(),oldId=oldState.id;isLast=(newId===oldId)}return isLast};History.saveState=function(newState){if(History.isLastSavedState(newState)){return false}History.savedStates.push(History.cloneObject(newState));return true};History.getStateByIndex=function(index){var State=null;if(typeof index==="undefined"){State=History.savedStates[History.savedStates.length-1]}else{if(index<0){State=History.savedStates[History.savedStates.length+index]}else{State=History.savedStates[index]}}return State};History.getHash=function(){var hash=History.unescapeHash(document.location.hash);return hash};History.unescapeString=function(str){var result=str;var tmp;while(true){tmp=window.unescape(result);if(tmp===result){break}result=tmp}return result};History.unescapeHash=function(hash){var result=History.normalizeHash(hash);result=History.unescapeString(result);return result};History.normalizeHash=function(hash){var result=hash.replace(/[^#]*#/,"").replace(/#.*/,"");return result};History.setHash=function(hash,queue){if(queue!==false&&History.busy()){History.pushQueue({scope:History,callback:History.setHash,args:arguments,queue:queue});return false}var adjustedHash=History.escapeHash(hash);History.busy(true);var State=History.extractState(hash,true);if(State&&!History.emulated.pushState){History.pushState(State.data,State.title,State.url,false)}else{if(document.location.hash!==adjustedHash){if(History.bugs.setHash){var pageUrl=History.getPageUrl();History.pushState(null,null,pageUrl+"#"+adjustedHash,false)}else{document.location.hash=adjustedHash}}}return History};History.escapeHash=function(hash){var result=History.normalizeHash(hash);result=window.escape(result);if(!History.bugs.hashEscape){result=result.replace(/\%21/g,"!").replace(/\%26/g,"&").replace(/\%3D/g,"=").replace(/\%3F/g,"?")}return result};History.getHashByUrl=function(url){var hash=String(url).replace(/([^#]*)#?([^#]*)#?(.*)/,"$2");hash=History.unescapeHash(hash);return hash};History.setTitle=function(newState){var title=newState.title;if(!title){var firstState=History.getStateByIndex(0);if(firstState&&firstState.url===newState.url){title=firstState.title||History.options.initialTitle}}try{document.getElementsByTagName("title")[0].innerHTML=title.replace("<","&lt;").replace(">","&gt;").replace(" & "," &amp; ")}catch(Exception){}document.title=title;return History};History.queues=[];History.busy=function(value){if(typeof value!=="undefined"){History.busy.flag=value}else{if(typeof History.busy.flag==="undefined"){History.busy.flag=false}}if(!History.busy.flag){clearTimeout(History.busy.timeout);var fireNext=function(){if(History.busy.flag){return}for(var i=History.queues.length-1;i>=0;--i){var queue=History.queues[i];if(queue.length===0){continue}var item=queue.shift();History.fireQueueItem(item);History.busy.timeout=setTimeout(fireNext,History.options.busyDelay)}};History.busy.timeout=setTimeout(fireNext,History.options.busyDelay)}return History.busy.flag};History.fireQueueItem=function(item){return item.callback.apply(item.scope||History,item.args||[])};History.pushQueue=function(item){History.queues[item.queue||0]=History.queues[item.queue||0]||[];History.queues[item.queue||0].push(item);return History};History.queue=function(item,queue){if(typeof item==="function"){item={callback:item}}if(typeof queue!=="undefined"){item.queue=queue}if(History.busy()){History.pushQueue(item)}else{History.fireQueueItem(item)}return History};History.clearQueue=function(){History.busy.flag=false;History.queues=[];return History};History.stateChanged=false;History.doubleChecker=false;History.doubleCheckComplete=function(){History.stateChanged=true;History.doubleCheckClear();return History};History.doubleCheckClear=function(){if(History.doubleChecker){clearTimeout(History.doubleChecker);History.doubleChecker=false}return History};History.doubleCheck=function(tryAgain){History.stateChanged=false;History.doubleCheckClear();if(History.bugs.ieDoubleCheck){History.doubleChecker=setTimeout(function(){History.doubleCheckClear();if(!History.stateChanged){tryAgain()}return true},History.options.doubleCheckInterval)}return History};History.safariStatePoll=function(){var urlState=History.extractState(document.location.href),newState;if(!History.isLastSavedState(urlState)){newState=urlState}else{return}if(!newState){newState=History.createStateObject()}History.Adapter.trigger(window,"popstate");return History};History.back=function(queue){if(queue!==false&&History.busy()){History.pushQueue({scope:History,callback:History.back,args:arguments,queue:queue});return false}History.busy(true);History.doubleCheck(function(){History.back(false)});history.go(-1);return true};History.forward=function(queue){if(queue!==false&&History.busy()){History.pushQueue({scope:History,callback:History.forward,args:arguments,queue:queue});return false}History.busy(true);History.doubleCheck(function(){History.forward(false)});history.go(1);return true};History.go=function(index,queue){var i;if(index>0){for(i=1;i<=index;++i){History.forward(queue)}}else{if(index<0){for(i=-1;i>=index;--i){History.back(queue)}}else{throw new Error("History.go: History.go requires a positive or negative integer passed.")}}return History};History.saveState(History.storeState(History.extractState(document.location.href,true)));if(amplify){History.onUnload=function(){var currentStore=amplify.store("History.store")||{},item;currentStore.idToState=currentStore.idToState||{};currentStore.urlToId=currentStore.urlToId||{};currentStore.stateToId=currentStore.stateToId||{};for(item in History.idToState){if(!History.idToState.hasOwnProperty(item)){continue}currentStore.idToState[item]=History.idToState[item]}for(item in History.urlToId){if(!History.urlToId.hasOwnProperty(item)){continue}currentStore.urlToId[item]=History.urlToId[item]}for(item in History.stateToId){if(!History.stateToId.hasOwnProperty(item)){continue}currentStore.stateToId[item]=History.stateToId[item]}History.store=currentStore;amplify.store("History.store",currentStore)};History.intervalList.push(setInterval(History.onUnload,History.options.storeInterval));History.Adapter.bind(window,"beforeunload",History.onUnload);History.Adapter.bind(window,"unload",History.onUnload)}if(History.emulated.pushState){var emptyFunction=function(){};History.pushState=History.pushState||emptyFunction;History.replaceState=History.replaceState||emptyFunction}else{History.onPopState=function(event){History.doubleCheckComplete();var currentHash=History.getHash();if(currentHash){var currentState=History.extractState(currentHash||document.location.href,true);if(currentState){History.replaceState(currentState.data,currentState.title,currentState.url,false)}else{History.Adapter.trigger(window,"anchorchange");History.busy(false)}History.expectedStateId=false;return false}var newState=false;event=event||{};if(typeof event.state==="undefined"){if(typeof event.originalEvent!=="undefined"&&typeof event.originalEvent.state!=="undefined"){event.state=event.originalEvent.state||false}else{if(typeof event.event!=="undefined"&&typeof event.event.state!=="undefined"){event.state=event.event.state||false}}}event.state=(event.state||false);if(event.state){newState=History.getStateById(event.state)}else{if(History.expectedStateId){newState=History.getStateById(History.expectedStateId)}else{newState=History.extractState(document.location.href)}}if(!newState){newState=History.createStateObject(null,null,document.location.href)}History.expectedStateId=false;if(History.isLastSavedState(newState)){History.busy(false);return false}History.storeState(newState);History.saveState(newState);History.setTitle(newState);History.Adapter.trigger(window,"statechange");History.busy(false);return true};History.Adapter.bind(window,"popstate",History.onPopState);History.pushState=function(data,title,url,queue){if(History.getHashByUrl(url)&&History.emulated.pushState){throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).")}if(queue!==false&&History.busy()){History.pushQueue({scope:History,callback:History.pushState,args:arguments,queue:queue});return false}History.busy(true);var newState=History.createStateObject(data,title,url);if(History.isLastSavedState(newState)){History.busy(false)}else{History.storeState(newState);History.expectedStateId=newState.id;history.pushState(newState.id,newState.title,newState.url);History.Adapter.trigger(window,"popstate")}return true};History.replaceState=function(data,title,url,queue){if(History.getHashByUrl(url)&&History.emulated.pushState){throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).")}if(queue!==false&&History.busy()){History.pushQueue({scope:History,callback:History.replaceState,args:arguments,queue:queue});return false}History.busy(true);var newState=History.createStateObject(data,title,url);if(History.isLastSavedState(newState)){History.busy(false)}else{History.storeState(newState);History.expectedStateId=newState.id;history.replaceState(newState.id,newState.title,newState.url);History.Adapter.trigger(window,"popstate")}return true};if(History.bugs.safariPoll){History.intervalList.push(setInterval(History.safariStatePoll,History.options.safariPollInterval))}if(navigator.vendor==="Apple Computer, Inc."||(navigator.appCodeName||"")==="Mozilla"){History.Adapter.bind(window,"hashchange",function(){History.Adapter.trigger(window,"popstate")});if(History.getHash()){History.Adapter.onDomLoad(function(){History.Adapter.trigger(window,"hashchange")})}}}};History.init()})(window);var odc=odc||{};odc.Historian={};$.extend(odc.Historian,{init:function(){if(!History.enabled){return false}this.watchStateChanges();this.toggleSubnavBasedOnUrl(window.location.pathname)},trackStateChange:function(options){this.ignoreStateChanges();var url=options.url,title=options.title;url=url.replace("/page","");History.pushState({},title,url);this.logAnalytics(url);this.toggleSubnavBasedOnUrl(window.location.pathname);this.watchStateChanges()},watchStateChanges:function(){History.Adapter.bind(window,"statechange",$.proxy(this.stateChanged,this))},ignoreStateChanges:function(){$(window).unbind("statechange",this.stateChanged)},stateChanged:function(){var state=History.getState();var url=History.getShortUrl(state.url);var item=$('.slide[data-url="'+url+'"]');var itemCard=item.closest(".card");if(itemCard.attr("id")==$(".card.active").attr("id")){itemCard.scrollTo(item,800)}else{$("html,body").scrollTo(item,800)}itemCard.find(".slide").removeClass("active");item.addClass("active");this.toggleSubnavBasedOnUrl(url);this.logAnalytics(url)},toggleSubnavBasedOnUrl:function(url){if(url.match(/\/about\//)){$("ul.sub-nav").each(function(){$(this).animate({width:"show"})})}else{$("ul.sub-nav").each(function(){$(this).animate({width:"hide"})})}this.markNavigationLink(url)},markNavigationLink:function(url){$("#main_navigation a").removeClass("active");if(url.match(/\/work\//)){$("#main_navigation .work-link").addClass("active")}else{$("#main_navigation a[href='"+url+"']").addClass("active")}},logAnalytics:function(url){if(window._gaq){window._gaq.push["_trackPageView",url]}},});var odc=odc||{};odc.ContentLoader={};$.extend(odc.ContentLoader,{init:function(){this.container=$("#all-cards");$(".slide[data-url='"+window.location.pathname+"']").closest(".card").addClass("active");this.loadProjects();this.loadTop();this.scrollToSelectedProject()},scrollToSelectedProject:function(){if(match=window.location.pathname.match(/\/work\/(.+)\/\d+/)){$("html,body").scrollTo("#"+match[1]);$(".card").removeClass("active");$("#"+match[1]).addClass("active")}},loadTop:function(){var self=this;if(0==$(".card.top").length){$.get("/page/",function(data){var item=$(data);self.container.prepend(item);item.removeClass("active");item.find("div.inner").fadeIn();self.scrollToSelectedProject();self.markFirstTopSlideActive();$.waypoints("refresh")})}else{self.markFirstTopSlideActive()}},markFirstTopSlideActive:function(){$(".card.top .slide").addClass("active")},loadProjects:function(){if(this.container.length>0){var workCards=this.container.find(".work");workCards.each(function(idx,element){element=$(element);$.get("page/home/"+element.attr("id"),function(data){var item=$(data).find(".slide").first();element.append(item).removeClass("unloaded");item.find("div.inner").fadeIn(1500);$(element).find("a.next-area").hide();element.find(".slide").addClass("active");if(idx==workCards.length-1){odc.WorkScroller.setupWaypoints()}})})}else{$(".slide").addClass("active")}},});var odc=odc||{};odc.WorkScroller={};$.extend(odc.WorkScroller,{init:function(options){$.localScroll();var defaults={scrollSpeed:600,afterScroll:$.noop,};this.options=$.extend(defaults,options);this.setupEventHandlers()},setupEventHandlers:function(){$("#follow-tab").live("click",$.proxy(this.handleFollowTabClick,this));$("#follow-tab").live("hover",this.bounceFollowTab);$(".work-link").live("click",$.proxy(this.handleWorkLinkClick,this))},handleFollowTabClick:function(evt){evt.preventDefault();this.scrollToNew()},handleWorkLinkClick:function(evt){evt.preventDefault();$("ul.sub-nav").each(function(){$(this).animate({width:"hide"})});if($(".card.top").hasClass("active")){$.scrollTo($(".card.top").next(".card"),this.options.scrollSpeed)}},bounceFollowTab:function(){if("0px"==$("#follow-tab").css("bottom")){$("#follow-tab").animate({bottom:"-5px"})}else{$("#follow-tab").animate({bottom:"0"})}},scrollToNew:function(){$("#all-cards, #outro").fadeIn(this.options.scrollSpeed/2);var nextCard=$(".card.active").next();if(nextCard.length>0){$("html, body").scrollTo(nextCard,this.options.scrollSpeed,{axis:"y"});this.options.afterScroll(nextCard)}},scrollToLast:function(){var previousCard=$(".card.active").prev();if(previousCard.length>0){$("html, body").scrollTo(previousCard,this.options.scrollSpeed,{axis:"y"});this.options.afterScroll(previousCard)}},setupWaypoints:function(){var self=this;var followTab=$("#follow-tab");var followTabText=followTab.find("span");$(".card").waypoint(function(evt,direction){$(".card").removeClass("active");followTab.fadeIn(self.options.scrollSpeed/2);var thisCard=$(evt.target);if("down"==direction){thisCard.addClass("active");followTabText.html(thisCard.next(".card").data("title"));if(thisCard.hasClass("top")){followTabText.html(thisCard.data("title"))}if(thisCard.hasClass("bottom")){followTab.fadeOut(self.options.scrollSpeed/2)}}else{var previousCard=thisCard.prev(".card");previousCard.addClass("active");followTabText.html(thisCard.data("title"));if(previousCard.hasClass("top")){followTabText.html(previousCard.data("title"))}}},{offset:100});$(".card").waypoint(function(evt,direction){var card=$(this);if("up"==direction){card=card.prev(".card")}if(!card.hasClass("bottom")){self.trackStateChange(card)}})},trackStateChange:function(item){var item=$(item);var options={url:item.find(".slide.active").data("url"),title:item.find(".slide.active header").text(),};odc.Historian.trackStateChange(options)}});var odc=odc||{};odc.SlideScroller={};$.extend(odc.SlideScroller,{init:function(options){var defaults={scrollSpeed:800,afterSlideLoaded:$.noop,afterScroll:$.noop,};this.options=$.extend(defaults,options);this.setCurrentIndex();this.setupEventHandlers()},setCurrentIndex:function(){var links=$("a.goto-section").map(function(i,val){return $(val).attr("href")});this.currentIndex=links.toArray().indexOf(window.location.pathname);if(this.currentIndex<0){this.currentIndex=0}},setupEventHandlers:function(){$(".next-section").live("click",$.proxy(this.nextSection,this));$(".previous-section").live("click",$.proxy(this.previousSection,this));$(".goto-section").live("click",$.proxy(this.gotoSection,this))},nextSection:function(evt){evt.preventDefault();var container=$(evt.target).closest(".card");var urls=new Array($(evt.target).attr("href"));var initializationCallback=$.proxy(this.initializeNextSlide,this);var scrollingCallback=$.proxy(this.scrollNextSlide,this);this.loadContainerWithUrls(container,urls,"next",initializationCallback,scrollingCallback);if(container.hasClass("top")){this.currentIndex++}},previousSection:function(evt){evt.preventDefault();var container=$(evt.target).closest(".card");var urls=new Array($(evt.target).attr("href"));var initializationCallback=$.proxy(this.initializePreviousSlide,this);var scrollingCallback=$.proxy(this.scrollPreviousSlide,this);this.loadContainerWithUrls(container,urls,"prev",initializationCallback,scrollingCallback);if(container.hasClass("top")){this.currentIndex--}},gotoSection:function(evt){var self=this;evt.preventDefault();if(!$(".card.active").hasClass("top")){$(".card").animate({opacity:0},this.options.scrollSpeed/2);$(".card").promise().done(function(){$("html,body").scrollTo(document.body,function(){$(".card").animate({opacity:1},self.options.scrollSpeed);$(".card").promise().done(function(){self.moveSections(evt)})})})}else{self.moveSections(evt)}},moveSections:function(evt){var links=$("#main_navigation a.goto-section").map(function(i,val){return $(val).attr("href")});var index=links.toArray().indexOf($(evt.target).attr("href"));var container=$(".card").first();if(index==this.currentIndex){}else{if(index>this.currentIndex){var urls=links.toArray().slice(this.currentIndex+1,index+1);var initializationCallback=$.proxy(this.initializeNextSlide,this);var scrollingCallback=$.proxy(this.scrollNextSlide,this);this.loadContainerWithUrls(container,urls,"next",initializationCallback,scrollingCallback)}else{var urls=links.toArray().slice(index,this.currentIndex).reverse();var initializationCallback=$.proxy(this.initializePreviousSlide,this);var scrollingCallback=$.proxy(this.scrollPreviousSlide,this);this.loadContainerWithUrls(container,urls,"prev",initializationCallback,scrollingCallback)}}this.currentIndex=index},loadContainerWithUrls:function(container,urls,direction,initializationCallback,scrollingCallback){var self=this;var slides=container.find(".slide");var activeSlide=container.find(".slide.active");slides.removeClass("active");url=urls.shift();var item=activeSlide[direction](".slide");if(0==item.length){$.get("/page"+url,function(data){var item=$(data).find(".slide").first();item.addClass("active");var shouldScroll=(0==urls.length);initializationCallback(container,item,shouldScroll,scrollingCallback);self.options.afterSlideLoaded();if(urls.length>0){self.loadContainerWithUrls(container,urls,direction,initializationCallback,scrollingCallback)}else{self.trackStateChange(item,url)}})}else{item.addClass("active");if(urls.length>0){self.loadContainerWithUrls(container,urls,direction,initializationCallback,scrollingCallback)}else{scrollingCallback(container,item,false);self.trackStateChange(item,url)}}},initializeNextSlide:function(container,item,shouldScroll,scrollingCallback){var position=100*container.find(".slide").length;item.css({left:position+"%"});container.append(item);$(item).find("div.inner").show();$(item).find("a.next-area").remove();if(shouldScroll){scrollingCallback(container,item)}},scrollNextSlide:function(container,item,justLoaded){container.scrollTo(item,this.options.scrollSpeed);this.options.afterScroll(item)},initializePreviousSlide:function(container,item,shouldScroll,scrollingCallback){item.css({left:this.minimumLeft(container)-100+"%"});container.prepend(item);$(item).find("div.inner").show();$(item).find("a.next-area").remove();if(shouldScroll){scrollingCallback(container,item,true)}},scrollPreviousSlide:function(container,item,justLoaded){var self=this;if(justLoaded){container.find(".slide").each(function(){var left=parseInt($(this).css("left"))-self.minimumLeft(container);$(this).animate({left:left+"%"},self.options.scrollSpeed)})}container.scrollTo(item,this.options.scrollSpeed);this.options.afterScroll(item)},minimumLeft:function(container){var minimumLeft=0;container.find(".slide").each(function(){var left=parseInt($(this).css("left"));if(left<minimumLeft){minimumLeft=left}});return minimumLeft},trackStateChange:function(item,url){odc.Historian.trackStateChange({title:item.find("header").text(),url:url,})}});var odc=odc||{};odc.KeyboardNavigator={};$.extend(odc.KeyboardNavigator,{init:function(){this.setupEventHandlers();this.usableForms();this.fireNotification()},setupEventHandlers:function(){odc.observeKeyDown=true;$(document).keydown(this.handleLeftAndRight);$(document).keydown(this.handleUpAndDown);$("#all-cards").swipe({threshold:75,swipeLeft:this.handleSwipeLeft,swipeRight:this.handleSwipeRight,swipeUp:this.handleSwipeUp,swipeDown:this.handleSwipeDown,allowPageScroll:"none",})},handleSwipeLeft:function(evt,direction,distance){$(".card.active .slide.active .next-section").first().click()},handleSwipeRight:function(evt,direction,distance){$(".card.active .slide.active .previous-section").first().click()},handleSwipeUp:function(evt,direction,distance){odc.WorkScroller.scrollToNew()},handleSwipeDown:function(evt,direction,distance){odc.WorkScroller.scrollToLast()},handleLeftAndRight:function(evt){if(!odc.observeKeyDown){return}if(evt.keyCode==37){evt.preventDefault();$(".card.active .slide.active .previous-section").first().click()}else{if(evt.keyCode==39){evt.preventDefault();$(".card.active .slide.active .next-section").first().click()}}},handleUpAndDown:function(evt){if(!odc.observeKeyDown){return}if(evt.keyCode==40||evt.keyCode==74){evt.preventDefault();odc.WorkScroller.scrollToNew()}else{if(evt.keyCode==38||evt.keyCode==75){evt.preventDefault();odc.WorkScroller.scrollToLast()}}},usableForms:function(){$("input,textarea").live("focus",function(){odc.observeKeyDown=false}).live("blur",function(){odc.observeKeyDown=true})},fireNotification:function(){if($.cookie("one_design_nav_notification")=="true"){}else{$("#notification").fadeIn("slow").delay(2500).fadeOut("slow",function(){$.cookie("one_design_nav_notification","true",{expires:7});$(this).remove()})}}});var odc=odc||{};odc.init=function(){odc.subnav();odc.loadingIndicator();odc.fadeContent();odc.ContentLoader.init();odc.selfLoader();odc.initializeSlide();odc.initCycles();odc.validateForm();odc.handleWindowResizes();odc.Historian.init();odc.WorkScroller.init({afterScroll:odc.stopVideos});odc.SlideScroller.init({afterSlideLoaded:odc.initializeSlide,afterScroll:odc.stopVideos});odc.KeyboardNavigator.init()};odc.initializeSlide=function(){odc.initCycles();odc.validateForm()};odc.initCycles=function(){$(".mini-cycle").each(function(){$(this).cycle({})})};odc.handleWindowResizes=function(){$(window).resize(function(){var card=$(".card.active");card.scrollTo(card.find(".slide.active"))})};odc.stopVideos=function(theCard){$("div.video").each(function(){$(this).html($(this).html())})};odc.selfLoader=function(){$("a.self-load").live("click",function(event){var thisUrl=$(this).attr("href");var slide=$(this).closest(".slide");$.get("/page"+thisUrl,function(data){var contentNeeded=$(data).find(".slide").html();slide.html(contentNeeded);slide.find(".inner").show();slide.closest(".card").scrollTo(slide)});return false})};odc.fadeContent=function(){var htmlInterval=window.setInterval(function(){var htmlClass=$("html").attr("class");if(htmlClass.indexOf("wf-active")||htmlClass.indexOf("wf-inactive")>=0){$("a.logo").fadeIn(500,function(){window.clearInterval(htmlInterval);$("#main_navigation ul.parent, div.inner").fadeIn(750)})}},500)};odc.subnav=function(){$("ul.sub-nav").each(function(){$(this).hide()});$("a.parent-link").live("click",function(event){event.preventDefault();$(this).next("ul.sub-nav").animate({width:"toggle"})})};odc.loadingIndicator=function(){$.ajaxSetup({beforeSend:function(){$("#loading-indicator").show()},complete:function(){$("#loading-indicator").hide()}})};odc.validateForm=function(){$("#contactform").ajaxForm({beforeSubmit:function(){$("#contactform").validate();return $("#contactform").valid()},success:function(response){var card=$(".contactform");
card.html(response);}})};$(function(){odc.init()});
