/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/
jQuery.easing.jswing=jQuery.easing.swing; jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,a,c,b,d){return jQuery.easing[jQuery.easing.def](e,a,c,b,d)},easeInQuad:function(e,a,c,b,d){return b*(a/=d)*a+c},easeOutQuad:function(e,a,c,b,d){return-b*(a/=d)*(a-2)+c},easeInOutQuad:function(e,a,c,b,d){if((a/=d/2)<1)return b/2*a*a+c;return-b/2*(--a*(a-2)-1)+c},easeInCubic:function(e,a,c,b,d){return b*(a/=d)*a*a+c},easeOutCubic:function(e,a,c,b,d){return b*((a=a/d-1)*a*a+1)+c},easeInOutCubic:function(e,a,c,b,d){if((a/=d/2)<1)return b/ 2*a*a*a+c;return b/2*((a-=2)*a*a+2)+c},easeInQuart:function(e,a,c,b,d){return b*(a/=d)*a*a*a+c},easeOutQuart:function(e,a,c,b,d){return-b*((a=a/d-1)*a*a*a-1)+c},easeInOutQuart:function(e,a,c,b,d){if((a/=d/2)<1)return b/2*a*a*a*a+c;return-b/2*((a-=2)*a*a*a-2)+c},easeInQuint:function(e,a,c,b,d){return b*(a/=d)*a*a*a*a+c},easeOutQuint:function(e,a,c,b,d){return b*((a=a/d-1)*a*a*a*a+1)+c},easeInOutQuint:function(e,a,c,b,d){if((a/=d/2)<1)return b/2*a*a*a*a*a+c;return b/2*((a-=2)*a*a*a*a+2)+c},easeInSine:function(e, a,c,b,d){return-b*Math.cos(a/d*(Math.PI/2))+b+c},easeOutSine:function(e,a,c,b,d){return b*Math.sin(a/d*(Math.PI/2))+c},easeInOutSine:function(e,a,c,b,d){return-b/2*(Math.cos(Math.PI*a/d)-1)+c},easeInExpo:function(e,a,c,b,d){return a==0?c:b*Math.pow(2,10*(a/d-1))+c},easeOutExpo:function(e,a,c,b,d){return a==d?c+b:b*(-Math.pow(2,-10*a/d)+1)+c},easeInOutExpo:function(e,a,c,b,d){if(a==0)return c;if(a==d)return c+b;if((a/=d/2)<1)return b/2*Math.pow(2,10*(a-1))+c;return b/2*(-Math.pow(2,-10*--a)+2)+c}, easeInCirc:function(e,a,c,b,d){return-b*(Math.sqrt(1-(a/=d)*a)-1)+c},easeOutCirc:function(e,a,c,b,d){return b*Math.sqrt(1-(a=a/d-1)*a)+c},easeInOutCirc:function(e,a,c,b,d){if((a/=d/2)<1)return-b/2*(Math.sqrt(1-a*a)-1)+c;return b/2*(Math.sqrt(1-(a-=2)*a)+1)+c},easeInElastic:function(e,a,c,b,d){e=1.70158;var f=0,g=b;if(a==0)return c;if((a/=d)==1)return c+b;f||(f=d*0.3);if(g<Math.abs(b)){g=b;e=f/4}else e=f/(2*Math.PI)*Math.asin(b/g);return-(g*Math.pow(2,10*(a-=1))*Math.sin((a*d-e)*2*Math.PI/f))+c},easeOutElastic:function(e, a,c,b,d){e=1.70158;var f=0,g=b;if(a==0)return c;if((a/=d)==1)return c+b;f||(f=d*0.3);if(g<Math.abs(b)){g=b;e=f/4}else e=f/(2*Math.PI)*Math.asin(b/g);return g*Math.pow(2,-10*a)*Math.sin((a*d-e)*2*Math.PI/f)+b+c},easeInOutElastic:function(e,a,c,b,d){e=1.70158;var f=0,g=b;if(a==0)return c;if((a/=d/2)==2)return c+b;f||(f=d*0.3*1.5);if(g<Math.abs(b)){g=b;e=f/4}else e=f/(2*Math.PI)*Math.asin(b/g);if(a<1)return-0.5*g*Math.pow(2,10*(a-=1))*Math.sin((a*d-e)*2*Math.PI/f)+c;return g*Math.pow(2,-10*(a-=1))*Math.sin((a* d-e)*2*Math.PI/f)*0.5+b+c},easeInBack:function(e,a,c,b,d,f){if(f==undefined)f=1.70158;return b*(a/=d)*a*((f+1)*a-f)+c},easeOutBack:function(e,a,c,b,d,f){if(f==undefined)f=1.70158;return b*((a=a/d-1)*a*((f+1)*a+f)+1)+c},easeInOutBack:function(e,a,c,b,d,f){if(f==undefined)f=1.70158;if((a/=d/2)<1)return b/2*a*a*(((f*=1.525)+1)*a-f)+c;return b/2*((a-=2)*a*(((f*=1.525)+1)*a+f)+2)+c},easeInBounce:function(e,a,c,b,d){return b-jQuery.easing.easeOutBounce(e,d-a,0,b,d)+c},easeOutBounce:function(e,a,c,b,d){return(a/= d)<1/2.75?b*7.5625*a*a+c:a<2/2.75?b*(7.5625*(a-=1.5/2.75)*a+0.75)+c:a<2.5/2.75?b*(7.5625*(a-=2.25/2.75)*a+0.9375)+c:b*(7.5625*(a-=2.625/2.75)*a+0.984375)+c},easeInOutBounce:function(e,a,c,b,d){if(a<d/2)return jQuery.easing.easeInBounce(e,a*2,0,b,d)*0.5+c;return jQuery.easing.easeOutBounce(e,a*2-d,0,b,d)*0.5+b*0.5+c}});


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

/*
*
* 
* Function to add a slideshow to a page using Insight media XML
* setUpSlideShow(xmlPath, selector, {jQuery cycle settings})
*
*/

$(window).load(function(){window.check_39475 = 1})

function setUpSlideShow(xmlPath, selector, preload, settings)
{
    if(!xmlPath || !selector) return false;
    if(preload == undefined) preload = false;
    if(settings == undefined) settings = {};

    $(selector).html('');

    function getImgPaths(doc)
    {
        function makeSlide(n)
        {
            var srcText = base + i[n].getAttribute('src');
            var altText = i[n].getAttribute('title').replace(/^\d+\s+(.*)/, '$1');
            var linkURL = i[n].getAttribute('link');
            var img = $('<img>');
            img.attr({'src': srcText, 'alt': altText});
            var titleText = i[n].getAttribute('caption');
            if(titleText) img.attr('title', titleText);
            img.css('display', 'none');
            if(n == 0) img.load(function(){$(this).css('display', 'block')});

            if(linkURL)
            {
                img.css('cursor', 'pointer');
                if(i[n].getAttribute('target') != '_self')
                   img.click(function(){window.open(linkURL)});
                else
                   img.click(function(){location.href = linkURL});
            }

            img.load(function()
            {
                this.cycleW = parseInt($(this).css('width'));
                this.cycleH = parseInt($(this).css('height'));
            })

            if(preload)
            {
                if(n < 2) $(selector).append(img[0]);
                if(n == 1) img.load(function(){$(selector).cycle(settings)});
            }
            else
            {
                $(selector).append(img[0]);
                if(n == 0) for(var ct = 1; ct < i.length; ct++) makeSlide(ct);
                if(n+1 == i.length) $(selector).cycle(settings);
            }

            if(n == 0 && preload && i.length > 1) var si = setInterval(function(){if(window.check_39475){clearInterval(si);makeSlide(1)}}, 100);

            return img[0];
        }

        var album = doc.getElementsByTagName('album')[0];
        var base = album.getAttribute('lgPath').replace(/(http:\/\/.*?)(\/.*)/gi, "$2");
        var i = album.getElementsByTagName('img');

        if(preload) $.extend(settings, {'before': function(a,b,c,d){
          if(c.nextSlide+1 == i.length)
          {
              c.original.before[0] = function(){};
              return true;
          }
          if(c.addSlide && c.nextSlide == c.slideCount-1) c.addSlide(makeSlide(c.nextSlide+1));
        }});

        makeSlide(0);
    }
    $.get(xmlPath + '&rdm=' + Math.floor(Math.random()*9999999999), getImgPaths);
}
