(function(e,c){function h(b){e.fn.cycle.debug&&a(b)}function a(){window.console&&console.log&&console.log("[cycle] "+Array.prototype.join.call(arguments," "))}function j(b,g,a){var d=e(b).data("cycle.opts"),c=!!b.cyclePause;c&&d.paused?d.paused(b,d,g,a):!c&&d.resumed&&d.resumed(b,d,g,a)}function i(b,g,k){function d(b,g,k){if(!b&&g===true){b=e(k).data("cycle.opts");if(!b)return a("options not found, can not resume"),false;if(k.cycleTimeout)clearTimeout(k.cycleTimeout),k.cycleTimeout=0;t(b.elements,
b,1,!b.backwards)}}if(b.cycleStop==c)b.cycleStop=0;if(g===c||g===null)g={};if(g.constructor==String)switch(g){case "destroy":case "stop":k=e(b).data("cycle.opts");if(!k)return false;b.cycleStop++;b.cycleTimeout&&clearTimeout(b.cycleTimeout);b.cycleTimeout=0;k.elements&&e(k.elements).stop();e(b).removeData("cycle.opts");g=="destroy"&&l(k);return false;case "toggle":return b.cyclePause=b.cyclePause===1?0:1,d(b.cyclePause,k,b),j(b),false;case "pause":return b.cyclePause=1,j(b),false;case "resume":return b.cyclePause=
0,d(false,k,b),j(b),false;case "prev":case "next":k=e(b).data("cycle.opts");if(!k)return a('options not found, "prev/next" ignored'),false;e.fn.cycle[g](k);return false;default:g={fx:g}}else if(g.constructor==Number){var i=g,g=e(b).data("cycle.opts");if(!g)return a("options not found, can not advance slide"),false;if(i<0||i>=g.elements.length)return a("invalid slide index: "+i),false;g.nextSlide=i;if(b.cycleTimeout)clearTimeout(b.cycleTimeout),b.cycleTimeout=0;if(typeof k=="string")g.oneTimeFx=k;
t(g.elements,g,1,i>=g.currSlide);return false}return g}function d(b,g){if(!e.support.opacity&&g.cleartype&&b.style.filter)try{b.style.removeAttribute("filter")}catch(a){}}function l(b){b.next&&e(b.next).unbind(b.prevNextEvent);b.prev&&e(b.prev).unbind(b.prevNextEvent);if(b.pager||b.pagerAnchorBuilder)e.each(b.pagerAnchors||[],function(){this.unbind().remove()});b.pagerAnchors=null;b.destroy&&b.destroy(b)}function n(b,g,k,i,z){var q,f=e.extend({},e.fn.cycle.defaults,i||{},e.metadata?b.metadata():e.meta?
b.data():{}),h=e.isFunction(b.data)?b.data(f.metaAttr):null;h&&(f=e.extend(f,h));if(f.autostop)f.countdown=f.autostopCount||k.length;var l=b[0];b.data("cycle.opts",f);f.$cont=b;f.stopCount=l.cycleStop;f.elements=k;f.before=f.before?[f.before]:[];f.after=f.after?[f.after]:[];!e.support.opacity&&f.cleartype&&f.after.push(function(){d(this,f)});f.continuous&&f.after.push(function(){t(k,f,0,!f.backwards)});m(f);!e.support.opacity&&f.cleartype&&!f.cleartypeNoBg&&r(g);b.css("position")=="static"&&b.css("position",
"relative");f.width&&b.width(f.width);f.height&&f.height!="auto"&&b.height(f.height);f.startingSlide!=c?(f.startingSlide=parseInt(f.startingSlide,10),f.startingSlide>=k.length||f.startSlide<0?f.startingSlide=0:q=true):f.startingSlide=f.backwards?k.length-1:0;if(f.random){f.randomMap=[];for(h=0;h<k.length;h++)f.randomMap.push(h);f.randomMap.sort(function(){return Math.random()-0.5});if(q)for(q=0;q<k.length;q++){if(f.startingSlide==f.randomMap[q])f.randomIndex=q}else f.randomIndex=1,f.startingSlide=
f.randomMap[1]}else if(f.startingSlide>=k.length)f.startingSlide=0;f.currSlide=f.startingSlide||0;var o=f.startingSlide;g.css({position:"absolute",top:0,left:0}).hide().each(function(b){b=f.backwards?o?b<=o?k.length+(b-o):o-b:k.length-b:o?b>=o?k.length-(b-o):o-b:k.length-b;e(this).css("z-index",b)});e(k[o]).css("opacity",1).show();d(k[o],f);f.fit&&(f.aspect?g.each(function(){var b=e(this),g=f.aspect===true?b.width()/b.height():f.aspect;f.width&&b.width()!=f.width&&(b.width(f.width),b.height(f.width/
g));f.height&&b.height()<f.height&&(b.height(f.height),b.width(f.height*g))}):(f.width&&g.width(f.width),f.height&&f.height!="auto"&&g.height(f.height)));f.center&&(!f.fit||f.aspect)&&g.each(function(){var b=e(this);b.css({"margin-left":f.width?(f.width-b.width())/2+"px":0,"margin-top":f.height?(f.height-b.height())/2+"px":0})});f.center&&!f.fit&&!f.slideResize&&g.each(function(){var b=e(this);b.css({"margin-left":f.width?(f.width-b.width())/2+"px":0,"margin-top":f.height?(f.height-b.height())/2+
"px":0})});if(f.containerResize&&!b.innerHeight()){for(var n=h=q=0;n<k.length;n++){var v=e(k[n]),w=v[0],u=v.outerWidth(),x=v.outerHeight();u||(u=w.offsetWidth||w.width||v.attr("width"));x||(x=w.offsetHeight||w.height||v.attr("height"));q=u>q?u:q;h=x>h?x:h}q>0&&h>0&&b.css({width:q+"px",height:h+"px"})}var B=false;f.pause&&b.hover(function(){B=true;this.cyclePause++;j(l,true)},function(){B&&this.cyclePause--;j(l,true)});if(s(f)===false)return false;var C=false;i.requeueAttempts=i.requeueAttempts||0;
g.each(function(){var b=e(this);this.cycleH=f.fit&&f.height?f.height:b.height()||this.offsetHeight||this.height||b.attr("height")||0;this.cycleW=f.fit&&f.width?f.width:b.width()||this.offsetWidth||this.width||b.attr("width")||0;if(b.is("img")){var b=e.browser.mozilla&&this.cycleW==34&&this.cycleH==19&&!this.complete,g=e.browser.opera&&(this.cycleW==42&&this.cycleH==19||this.cycleW==37&&this.cycleH==17)&&!this.complete,k=this.cycleH==0&&this.cycleW==0&&!this.complete;if(e.browser.msie&&this.cycleW==
28&&this.cycleH==30&&!this.complete||b||g||k)if(z.s&&f.requeueOnImageNotLoaded&&++i.requeueAttempts<100)return a(i.requeueAttempts," - img slide not loaded, requeuing slideshow: ",this.src,this.cycleW,this.cycleH),setTimeout(function(){e(z.s,z.c).cycle(i)},f.requeueTimeout),C=true,false;else a("could not determine size of image: "+this.src,this.cycleW,this.cycleH)}return true});if(C)return false;f.cssBefore=f.cssBefore||{};f.cssAfter=f.cssAfter||{};f.cssFirst=f.cssFirst||{};f.animIn=f.animIn||{};
f.animOut=f.animOut||{};g.not(":eq("+o+")").css(f.cssBefore);e(g[o]).css(f.cssFirst);if(f.timeout){f.timeout=parseInt(f.timeout,10);if(f.speed.constructor==String)f.speed=e.fx.speeds[f.speed]||parseInt(f.speed,10);f.sync||(f.speed/=2);for(q=f.fx=="none"?0:f.fx=="shuffle"?500:250;f.timeout-f.speed<q;)f.timeout+=f.speed}if(f.easing)f.easeIn=f.easeOut=f.easing;if(!f.speedIn)f.speedIn=f.speed;if(!f.speedOut)f.speedOut=f.speed;f.slideCount=k.length;f.currSlide=f.lastSlide=o;if(f.random){if(++f.randomIndex==
k.length)f.randomIndex=0;f.nextSlide=f.randomMap[f.randomIndex]}else f.nextSlide=f.backwards?f.startingSlide==0?k.length-1:f.startingSlide-1:f.startingSlide>=k.length-1?0:f.startingSlide+1;if(!f.multiFx)if(q=e.fn.cycle.transitions[f.fx],e.isFunction(q))q(b,g,f);else if(f.fx!="custom"&&!f.multiFx)return a("unknown transition: "+f.fx,"; slideshow terminating"),false;b=g[o];f.skipInitializationCallbacks||(f.before.length&&f.before[0].apply(b,[b,b,f,true]),f.after.length&&f.after[0].apply(b,[b,b,f,true]));
f.next&&e(f.next).bind(f.prevNextEvent,function(){return y(f,1)});f.prev&&e(f.prev).bind(f.prevNextEvent,function(){return y(f,0)});(f.pager||f.pagerAnchorBuilder)&&A(k,f);D(f,k);return f}function m(b){b.original={before:[],after:[]};b.original.cssBefore=e.extend({},b.cssBefore);b.original.cssAfter=e.extend({},b.cssAfter);b.original.animIn=e.extend({},b.animIn);b.original.animOut=e.extend({},b.animOut);e.each(b.before,function(){b.original.before.push(this)});e.each(b.after,function(){b.original.after.push(this)})}
function s(b){var g,k,d=e.fn.cycle.transitions;if(b.fx.indexOf(",")>0){b.multiFx=true;b.fxs=b.fx.replace(/\s*/g,"").split(",");for(g=0;g<b.fxs.length;g++){var i=b.fxs[g];k=d[i];if(!k||!d.hasOwnProperty(i)||!e.isFunction(k))a("discarding unknown transition: ",i),b.fxs.splice(g,1),g--}if(!b.fxs.length)return a("No valid transitions named; slideshow terminating."),false}else if(b.fx=="all")for(p in b.multiFx=true,b.fxs=[],d)k=d[p],d.hasOwnProperty(p)&&e.isFunction(k)&&b.fxs.push(p);if(b.multiFx&&b.randomizeEffects){k=
Math.floor(Math.random()*20)+30;for(g=0;g<k;g++)d=Math.floor(Math.random()*b.fxs.length),b.fxs.push(b.fxs.splice(d,1)[0]);h("randomized fx sequence: ",b.fxs)}return true}function D(b,g){b.addSlide=function(a,d){var i=e(a),c=i[0];b.autostopCount||b.countdown++;g[d?"unshift":"push"](c);if(b.els)b.els[d?"unshift":"push"](c);b.slideCount=g.length;b.random&&(b.randomMap.push(b.slideCount-1),b.randomMap.sort(function(){return Math.random()-0.5}));i.css("position","absolute");i[d?"prependTo":"appendTo"](b.$cont);
d&&(b.currSlide++,b.nextSlide++);!e.support.opacity&&b.cleartype&&!b.cleartypeNoBg&&r(i);b.fit&&b.width&&i.width(b.width);b.fit&&b.height&&b.height!="auto"&&i.height(b.height);c.cycleH=b.fit&&b.height?b.height:i.height();c.cycleW=b.fit&&b.width?b.width:i.width();i.css(b.cssBefore);(b.pager||b.pagerAnchorBuilder)&&e.fn.cycle.createPagerAnchor(g.length-1,c,e(b.pager),g,b);if(e.isFunction(b.onAddSlide))b.onAddSlide(i);else i.hide()}}function t(b,g,a,d){function i(){var a=0;g.timeout&&!g.continuous?(a=
u(b[g.currSlide],b[g.nextSlide],g,d),g.fx=="shuffle"&&(a-=g.speedOut)):g.continuous&&j.cyclePause&&(a=10);if(a>0)j.cycleTimeout=setTimeout(function(){t(b,g,0,!g.backwards)},a)}if(a&&g.busy&&g.manualTrump)h("manualTrump in go(), stopping active transition"),e(b).stop(true,true),g.busy=0;if(g.busy)h("transition active, ignoring new tx request");else{var j=g.$cont[0],f=b[g.currSlide],l=b[g.nextSlide];if(!(j.cycleStop!=g.stopCount||j.cycleTimeout===0&&!a))if(!a&&!j.cyclePause&&!g.bounce&&(g.autostop&&
--g.countdown<=0||g.nowrap&&!g.random&&g.nextSlide<g.currSlide))g.end&&g.end(g);else{var n=false;if((a||!j.cyclePause)&&g.nextSlide!=g.currSlide){var n=true,o=g.fx;f.cycleH=f.cycleH||e(f).height();f.cycleW=f.cycleW||e(f).width();l.cycleH=l.cycleH||e(l).height();l.cycleW=l.cycleW||e(l).width();if(g.multiFx){if(d&&(g.lastFx==c||++g.lastFx>=g.fxs.length))g.lastFx=0;else if(!d&&(g.lastFx==c||--g.lastFx<0))g.lastFx=g.fxs.length-1;o=g.fxs[g.lastFx]}if(g.oneTimeFx)o=g.oneTimeFx,g.oneTimeFx=null;e.fn.cycle.resetState(g,
o);g.before.length&&e.each(g.before,function(b,a){j.cycleStop==g.stopCount&&a.apply(l,[f,l,g,d])});var m=function(){g.busy=0;e.each(g.after,function(b,a){j.cycleStop==g.stopCount&&a.apply(l,[f,l,g,d])});j.cycleStop||i()};h("tx firing("+o+"); currSlide: "+g.currSlide+"; nextSlide: "+g.nextSlide);g.busy=1;if(g.fxFn)g.fxFn(f,l,g,m,d,a&&g.fastOnEvent);else if(e.isFunction(e.fn.cycle[g.fx]))e.fn.cycle[g.fx](f,l,g,m,d,a&&g.fastOnEvent);else e.fn.cycle.custom(f,l,g,m,d,a&&g.fastOnEvent)}else i();if(n||g.nextSlide==
g.currSlide)if(g.lastSlide=g.currSlide,g.random){g.currSlide=g.nextSlide;if(++g.randomIndex==b.length)g.randomIndex=0,g.randomMap.sort(function(){return Math.random()-0.5});g.nextSlide=g.randomMap[g.randomIndex];if(g.nextSlide==g.currSlide)g.nextSlide=g.currSlide==g.slideCount-1?0:g.currSlide+1}else g.backwards?(a=g.nextSlide-1<0)&&g.bounce?(g.backwards=!g.backwards,g.nextSlide=1,g.currSlide=0):(g.nextSlide=a?b.length-1:g.nextSlide-1,g.currSlide=a?0:g.nextSlide+1):(a=g.nextSlide+1==b.length)&&g.bounce?
(g.backwards=!g.backwards,g.nextSlide=b.length-2,g.currSlide=b.length-1):(g.nextSlide=a?0:g.nextSlide+1,g.currSlide=a?b.length-1:g.nextSlide-1);n&&g.pager&&g.updateActivePagerLink(g.pager,g.currSlide,g.activePagerClass)}}}function u(b,a,e,d){if(e.timeoutFn){for(b=e.timeoutFn.call(b,b,a,e,d);e.fx!="none"&&b-e.speed<250;)b+=e.speed;h("calculated timeout: "+b+"; speed: "+e.speed);if(b!==false)return b}return e.timeout}function y(b,a){var d=a?1:-1,i=b.elements,c=b.$cont[0],j=c.cycleTimeout;if(j)clearTimeout(j),
c.cycleTimeout=0;if(b.random&&d<0){b.randomIndex--;if(--b.randomIndex==-2)b.randomIndex=i.length-2;else if(b.randomIndex==-1)b.randomIndex=i.length-1;b.nextSlide=b.randomMap[b.randomIndex]}else if(b.random)b.nextSlide=b.randomMap[b.randomIndex];else if(b.nextSlide=b.currSlide+d,b.nextSlide<0){if(b.nowrap)return false;b.nextSlide=i.length-1}else if(b.nextSlide>=i.length){if(b.nowrap)return false;b.nextSlide=0}c=b.onPrevNextEvent||b.prevNextClick;e.isFunction(c)&&c(d>0,b.nextSlide,i[b.nextSlide]);t(i,
b,1,a);return false}function A(b,a){var d=e(a.pager);e.each(b,function(i,c){e.fn.cycle.createPagerAnchor(i,c,d,b,a)});a.updateActivePagerLink(a.pager,a.startingSlide,a.activePagerClass)}function r(b){function a(b){b=parseInt(b,10).toString(16);return b.length<2?"0"+b:b}function d(b){for(;b&&b.nodeName.toLowerCase()!="html";b=b.parentNode){var i=e.css(b,"background-color");if(i&&i.indexOf("rgb")>=0)return b=i.match(/\d+/g),"#"+a(b[0])+a(b[1])+a(b[2]);if(i&&i!="transparent")return i}return"#ffffff"}
h("applying clearType background-color hack");b.each(function(){e(this).css("background-color",d(this))})}if(e.support==c)e.support={opacity:!e.browser.msie};e.expr[":"].paused=function(b){return b.cyclePause};e.fn.cycle=function(b,g){var d={s:this.selector,c:this.context};if(this.length===0&&b!="stop"){if(!e.isReady&&d.s)return a("DOM not ready, queuing slideshow"),e(function(){e(d.s,d.c).cycle(b,g)}),this;a("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)"));return this}return this.each(function(){var c=
i(this,b,g);if(c!==false){c.updateActivePagerLink=c.updateActivePagerLink||e.fn.cycle.updateActivePagerLink;this.cycleTimeout&&clearTimeout(this.cycleTimeout);this.cycleTimeout=this.cyclePause=0;var j=e(this),l=c.slideExpr?e(c.slideExpr,this):j.children(),f=l.get(),m=n(j,l,f,c,d);if(m!==false)if(f.length<2)a("terminating; too few slides: "+f.length);else if(j=m.continuous?10:u(f[m.currSlide],f[m.nextSlide],m,!m.backwards))j+=m.delay||0,j<10&&(j=10),h("first timeout: "+j),this.cycleTimeout=setTimeout(function(){t(f,
m,0,!c.backwards)},j)}})};e.fn.cycle.resetState=function(b,a){a=a||b.fx;b.before=[];b.after=[];b.cssBefore=e.extend({},b.original.cssBefore);b.cssAfter=e.extend({},b.original.cssAfter);b.animIn=e.extend({},b.original.animIn);b.animOut=e.extend({},b.original.animOut);b.fxFn=null;e.each(b.original.before,function(){b.before.push(this)});e.each(b.original.after,function(){b.after.push(this)});var d=e.fn.cycle.transitions[a];e.isFunction(d)&&d(b.$cont,e(b.elements),b)};e.fn.cycle.updateActivePagerLink=
function(b,a,d){e(b).each(function(){e(this).children().removeClass(d).eq(a).addClass(d)})};e.fn.cycle.next=function(b){y(b,1)};e.fn.cycle.prev=function(b){y(b,0)};e.fn.cycle.createPagerAnchor=function(b,a,d,i,c){e.isFunction(c.pagerAnchorBuilder)?(a=c.pagerAnchorBuilder(b,a),h("pagerAnchorBuilder("+b+", el) returned: "+a)):a='<a href="#">'+(b+1)+"</a>";if(a){var l=e(a);if(l.parents("body").length===0){var f=[];d.length>1?(d.each(function(){var b=l.clone(true);e(this).append(b);f.push(b[0])}),l=e(f)):
l.appendTo(d)}c.pagerAnchors=c.pagerAnchors||[];c.pagerAnchors.push(l);d=function(a){a.preventDefault();c.nextSlide=b;var a=c.$cont[0],f=a.cycleTimeout;if(f)clearTimeout(f),a.cycleTimeout=0;a=c.onPagerEvent||c.pagerClick;e.isFunction(a)&&a(c.nextSlide,i[c.nextSlide]);t(i,c,1,c.currSlide<b)};/mouseenter|mouseover/i.test(c.pagerEvent)?l.hover(d,function(){}):l.bind(c.pagerEvent,d);!/^click/.test(c.pagerEvent)&&!c.allowPagerClickBubble&&l.bind("click.cycle",function(){return false});var m=c.$cont[0],
n=false;c.pauseOnPagerHover&&l.hover(function(){n=true;m.cyclePause++;j(m,true,true)},function(){n&&m.cyclePause--;j(m,true,true)})}};e.fn.cycle.hopsFromLast=function(b,a){var e=b.lastSlide,d=b.currSlide;return a?d>e?d-e:b.slideCount-e:d<e?e-d:e+b.slideCount-d};e.fn.cycle.commonReset=function(b,a,d,c,i,j){e(d.elements).not(b).hide();if(typeof d.cssBefore.opacity=="undefined")d.cssBefore.opacity=1;d.cssBefore.display="block";if(d.slideResize&&c!==false&&a.cycleW>0)d.cssBefore.width=a.cycleW;if(d.slideResize&&
i!==false&&a.cycleH>0)d.cssBefore.height=a.cycleH;d.cssAfter=d.cssAfter||{};d.cssAfter.display="none";e(b).css("zIndex",d.slideCount+(j===true?1:0));e(a).css("zIndex",d.slideCount+(j===true?0:1))};e.fn.cycle.custom=function(b,a,d,c,i,j){var f=e(b),h=e(a),l=d.speedIn,b=d.speedOut,m=d.easeIn,a=d.easeOut;h.css(d.cssBefore);j&&(l=typeof j=="number"?b=j:b=1,m=a=null);var n=function(){h.animate(d.animIn,l,m,function(){c()})};f.animate(d.animOut,b,a,function(){f.css(d.cssAfter);d.sync||n()});d.sync&&n()};
e.fn.cycle.transitions={fade:function(b,a,d){a.not(":eq("+d.currSlide+")").css("opacity",0);d.before.push(function(b,a,d){e.fn.cycle.commonReset(b,a,d);d.cssBefore.opacity=0});d.animIn={opacity:1};d.animOut={opacity:0};d.cssBefore={top:0,left:0}}};e.fn.cycle.ver=function(){return"2.9998"};e.fn.cycle.defaults={activePagerClass:"activeSlide",after:null,allowPagerClickBubble:false,animIn:null,animOut:null,aspect:false,autostop:0,autostopCount:0,backwards:false,before:null,center:null,cleartype:!e.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,metaAttr:"cycle",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,
skipInitializationCallbacks:false,slideExpr:null,slideResize:1,speed:1E3,speedIn:null,speedOut:null,startingSlide:0,sync:1,timeout:4E3,timeoutFn:null,updateActivePagerLink:null,width:null}})(jQuery);
(function(e){e.fn.cycle.transitions.none=function(c,h,a){a.fxFn=function(a,c,d,h){e(c).show();e(a).hide();h()}};e.fn.cycle.transitions.fadeout=function(c,h,a){h.not(":eq("+a.currSlide+")").css({display:"block",opacity:1});a.before.push(function(a,c,d,h,n,m){e(a).css("zIndex",d.slideCount+(!m===true?1:0));e(c).css("zIndex",d.slideCount+(!m===true?0:1))});a.animIn.opacity=1;a.animOut.opacity=0;a.cssBefore.opacity=1;a.cssBefore.display="block";a.cssAfter.zIndex=0};e.fn.cycle.transitions.scrollUp=function(c,
h,a){c.css("overflow","hidden");a.before.push(e.fn.cycle.commonReset);c=c.height();a.cssBefore.top=c;a.cssBefore.left=0;a.cssFirst.top=0;a.animIn.top=0;a.animOut.top=-c};e.fn.cycle.transitions.scrollDown=function(c,h,a){c.css("overflow","hidden");a.before.push(e.fn.cycle.commonReset);c=c.height();a.cssFirst.top=0;a.cssBefore.top=-c;a.cssBefore.left=0;a.animIn.top=0;a.animOut.top=c};e.fn.cycle.transitions.scrollLeft=function(c,h,a){c.css("overflow","hidden");a.before.push(e.fn.cycle.commonReset);c=
c.width();a.cssFirst.left=0;a.cssBefore.left=c;a.cssBefore.top=0;a.animIn.left=0;a.animOut.left=0-c};e.fn.cycle.transitions.scrollRight=function(c,h,a){c.css("overflow","hidden");a.before.push(e.fn.cycle.commonReset);c=c.width();a.cssFirst.left=0;a.cssBefore.left=-c;a.cssBefore.top=0;a.animIn.left=0;a.animOut.left=c};e.fn.cycle.transitions.scrollHorz=function(c,h,a){c.css("overflow","hidden").width();a.before.push(function(a,c,d,h){d.rev&&(h=!h);e.fn.cycle.commonReset(a,c,d);d.cssBefore.left=h?c.cycleW-
1:1-c.cycleW;d.animOut.left=h?-a.cycleW:a.cycleW});a.cssFirst.left=0;a.cssBefore.top=0;a.animIn.left=0;a.animOut.top=0};e.fn.cycle.transitions.scrollVert=function(c,h,a){c.css("overflow","hidden");a.before.push(function(a,c,d,h){d.rev&&(h=!h);e.fn.cycle.commonReset(a,c,d);d.cssBefore.top=h?1-c.cycleH:c.cycleH-1;d.animOut.top=h?a.cycleH:-a.cycleH});a.cssFirst.top=0;a.cssBefore.left=0;a.animIn.top=0;a.animOut.left=0};e.fn.cycle.transitions.slideX=function(c,h,a){a.before.push(function(a,c,d){e(d.elements).not(a).hide();
e.fn.cycle.commonReset(a,c,d,false,true);d.animIn.width=c.cycleW});a.cssBefore.left=0;a.cssBefore.top=0;a.cssBefore.width=0;a.animIn.width="show";a.animOut.width=0};e.fn.cycle.transitions.slideY=function(c,h,a){a.before.push(function(a,c,d){e(d.elements).not(a).hide();e.fn.cycle.commonReset(a,c,d,true,false);d.animIn.height=c.cycleH});a.cssBefore.left=0;a.cssBefore.top=0;a.cssBefore.height=0;a.animIn.height="show";a.animOut.height=0};e.fn.cycle.transitions.shuffle=function(c,h,a){c=c.css("overflow",
"visible").width();h.css({left:0,top:0});a.before.push(function(a,c,d){e.fn.cycle.commonReset(a,c,d,true,true,true)});if(!a.speedAdjusted)a.speed/=2,a.speedAdjusted=true;a.random=0;a.shuffle=a.shuffle||{left:-c,top:15};a.els=[];for(c=0;c<h.length;c++)a.els.push(h[c]);for(c=0;c<a.currSlide;c++)a.els.push(a.els.shift());a.fxFn=function(a,c,d,h,n){d.rev&&(n=!n);var m=n?e(a):e(c);e(c).css(d.cssBefore);var s=d.slideCount;m.animate(d.shuffle,d.speedIn,d.easeIn,function(){for(var c=e.fn.cycle.hopsFromLast(d,
n),i=0;i<c;i++)n?d.els.push(d.els.shift()):d.els.unshift(d.els.pop());if(n){c=0;for(i=d.els.length;c<i;c++)e(d.els[c]).css("z-index",i-c+s)}else c=e(a).css("z-index"),m.css("z-index",parseInt(c,10)+1+s);m.animate({left:0,top:0},d.speedOut,d.easeOut,function(){e(n?this:a).hide();h&&h()})})};e.extend(a.cssBefore,{display:"block",opacity:1,top:0,left:0})};e.fn.cycle.transitions.turnUp=function(c,h,a){a.before.push(function(a,c,d){e.fn.cycle.commonReset(a,c,d,true,false);d.cssBefore.top=c.cycleH;d.animIn.height=
c.cycleH;d.animOut.width=c.cycleW});a.cssFirst.top=0;a.cssBefore.left=0;a.cssBefore.height=0;a.animIn.top=0;a.animOut.height=0};e.fn.cycle.transitions.turnDown=function(c,h,a){a.before.push(function(a,c,d){e.fn.cycle.commonReset(a,c,d,true,false);d.animIn.height=c.cycleH;d.animOut.top=a.cycleH});a.cssFirst.top=0;a.cssBefore.left=0;a.cssBefore.top=0;a.cssBefore.height=0;a.animOut.height=0};e.fn.cycle.transitions.turnLeft=function(c,h,a){a.before.push(function(a,c,d){e.fn.cycle.commonReset(a,c,d,false,
true);d.cssBefore.left=c.cycleW;d.animIn.width=c.cycleW});a.cssBefore.top=0;a.cssBefore.width=0;a.animIn.left=0;a.animOut.width=0};e.fn.cycle.transitions.turnRight=function(c,h,a){a.before.push(function(a,c,d){e.fn.cycle.commonReset(a,c,d,false,true);d.animIn.width=c.cycleW;d.animOut.left=a.cycleW});e.extend(a.cssBefore,{top:0,left:0,width:0});a.animIn.left=0;a.animOut.width=0};e.fn.cycle.transitions.zoom=function(c,h,a){a.before.push(function(a,c,d){e.fn.cycle.commonReset(a,c,d,false,false,true);
d.cssBefore.top=c.cycleH/2;d.cssBefore.left=c.cycleW/2;e.extend(d.animIn,{top:0,left:0,width:c.cycleW,height:c.cycleH});e.extend(d.animOut,{width:0,height:0,top:a.cycleH/2,left:a.cycleW/2})});a.cssFirst.top=0;a.cssFirst.left=0;a.cssBefore.width=0;a.cssBefore.height=0};e.fn.cycle.transitions.fadeZoom=function(c,h,a){a.before.push(function(a,c,d){e.fn.cycle.commonReset(a,c,d,false,false);d.cssBefore.left=c.cycleW/2;d.cssBefore.top=c.cycleH/2;e.extend(d.animIn,{top:0,left:0,width:c.cycleW,height:c.cycleH})});
a.cssBefore.width=0;a.cssBefore.height=0;a.animOut.opacity=0};e.fn.cycle.transitions.blindX=function(c,h,a){c=c.css("overflow","hidden").width();a.before.push(function(a,c,d){e.fn.cycle.commonReset(a,c,d);d.animIn.width=c.cycleW;d.animOut.left=a.cycleW});a.cssBefore.left=c;a.cssBefore.top=0;a.animIn.left=0;a.animOut.left=c};e.fn.cycle.transitions.blindY=function(c,h,a){c=c.css("overflow","hidden").height();a.before.push(function(a,c,d){e.fn.cycle.commonReset(a,c,d);d.animIn.height=c.cycleH;d.animOut.top=
a.cycleH});a.cssBefore.top=c;a.cssBefore.left=0;a.animIn.top=0;a.animOut.top=c};e.fn.cycle.transitions.blindZ=function(c,h,a){h=c.css("overflow","hidden").height();c=c.width();a.before.push(function(a,c,d){e.fn.cycle.commonReset(a,c,d);d.animIn.height=c.cycleH;d.animOut.top=a.cycleH});a.cssBefore.top=h;a.cssBefore.left=c;a.animIn.top=0;a.animIn.left=0;a.animOut.top=h;a.animOut.left=c};e.fn.cycle.transitions.growX=function(c,h,a){a.before.push(function(a,c,d){e.fn.cycle.commonReset(a,c,d,false,true);
d.cssBefore.left=this.cycleW/2;d.animIn.left=0;d.animIn.width=this.cycleW;d.animOut.left=0});a.cssBefore.top=0;a.cssBefore.width=0};e.fn.cycle.transitions.growY=function(c,h,a){a.before.push(function(a,c,d){e.fn.cycle.commonReset(a,c,d,true,false);d.cssBefore.top=this.cycleH/2;d.animIn.top=0;d.animIn.height=this.cycleH;d.animOut.top=0});a.cssBefore.height=0;a.cssBefore.left=0};e.fn.cycle.transitions.curtainX=function(c,h,a){a.before.push(function(a,c,d){e.fn.cycle.commonReset(a,c,d,false,true,true);
d.cssBefore.left=c.cycleW/2;d.animIn.left=0;d.animIn.width=this.cycleW;d.animOut.left=a.cycleW/2;d.animOut.width=0});a.cssBefore.top=0;a.cssBefore.width=0};e.fn.cycle.transitions.curtainY=function(c,h,a){a.before.push(function(a,c,d){e.fn.cycle.commonReset(a,c,d,true,false,true);d.cssBefore.top=c.cycleH/2;d.animIn.top=0;d.animIn.height=c.cycleH;d.animOut.top=a.cycleH/2;d.animOut.height=0});a.cssBefore.height=0;a.cssBefore.left=0};e.fn.cycle.transitions.cover=function(c,h,a){var j=a.direction||"left",
i=c.css("overflow","hidden").width(),d=c.height();a.before.push(function(a,c,h){e.fn.cycle.commonReset(a,c,h);j=="right"?h.cssBefore.left=-i:j=="up"?h.cssBefore.top=d:j=="down"?h.cssBefore.top=-d:h.cssBefore.left=i});a.animIn.left=0;a.animIn.top=0;a.cssBefore.top=0;a.cssBefore.left=0};e.fn.cycle.transitions.uncover=function(c,h,a){var j=a.direction||"left",i=c.css("overflow","hidden").width(),d=c.height();a.before.push(function(a,c,h){e.fn.cycle.commonReset(a,c,h,true,true,true);j=="right"?h.animOut.left=
i:j=="up"?h.animOut.top=-d:j=="down"?h.animOut.top=d:h.animOut.left=-i});a.animIn.left=0;a.animIn.top=0;a.cssBefore.top=0;a.cssBefore.left=0};e.fn.cycle.transitions.toss=function(c,h,a){var j=c.css("overflow","visible").width(),i=c.height();a.before.push(function(a,c,h){e.fn.cycle.commonReset(a,c,h,true,true,true);!h.animOut.left&&!h.animOut.top?e.extend(h.animOut,{left:j*2,top:-i/2,opacity:0}):h.animOut.opacity=0});a.cssBefore.left=0;a.cssBefore.top=0;a.animIn.left=0};e.fn.cycle.transitions.wipe=
function(c,h,a){var j=c.css("overflow","hidden").width(),i=c.height();a.cssBefore=a.cssBefore||{};var d;a.clip&&(/l2r/.test(a.clip)?d="rect(0px 0px "+i+"px 0px)":/r2l/.test(a.clip)?d="rect(0px "+j+"px "+i+"px "+j+"px)":/t2b/.test(a.clip)?d="rect(0px "+j+"px 0px 0px)":/b2t/.test(a.clip)?d="rect("+i+"px "+j+"px "+i+"px 0px)":/zoom/.test(a.clip)&&(c=parseInt(i/2,10),h=parseInt(j/2,10),d="rect("+c+"px "+h+"px "+c+"px "+h+"px)"));a.cssBefore.clip=a.cssBefore.clip||d||"rect(0px 0px 0px 0px)";var c=a.cssBefore.clip.match(/(\d+)/g),
l=parseInt(c[0],10),n=parseInt(c[1],10),m=parseInt(c[2],10),s=parseInt(c[3],10);a.before.push(function(a,c,d){if(a!=c){var h=e(a),A=e(c);e.fn.cycle.commonReset(a,c,d,true,true,false);d.cssAfter.display="block";var r=1,b=parseInt(d.speedIn/13,10)-1;(function k(){var a=l?l-parseInt(r*(l/b),10):0,c=s?s-parseInt(r*(s/b),10):0,d=m<i?m+parseInt(r*((i-m)/b||1),10):i,e=n<j?n+parseInt(r*((j-n)/b||1),10):j;A.css({clip:"rect("+a+"px "+e+"px "+d+"px "+c+"px)"});r++<=b?setTimeout(k,13):h.css("display","none")})()}});
e.extend(a.cssBefore,{display:"block",opacity:1,top:0,left:0});a.animIn={left:0};a.animOut={left:0}}})(jQuery);


/* jquery.tweet */
(function(d){"function"===typeof define&&define.amd?define(["jquery"],d):d(jQuery)})(function(d){d.fn.tweet=function(j){function e(b,a){if("string"===typeof b){var f=b,d;for(d in a)var e=a[d],f=f.replace(RegExp("{"+d+"}","g"),null===e?"":e);return f}return b(a)}function g(b,a){return function(){var f=[];this.each(function(){f.push(this.replace(b,a))});return d(f)}}function k(b,a){return b.replace(h,function(b){for(var c=/^[a-z]+:/i.test(b)?b:"http://"+b,d=0;d<a.length;++d){var e=a[d];if(e.url==c&& e.expanded_url){c=e.expanded_url;b=e.display_url;break}}return'<a href="'+c.replace(/</g,"&lt;").replace(/>/g,"^&gt;")+'">'+b.replace(/</g,"&lt;").replace(/>/g,"^&gt;")+"</a>"})}function l(b){var a=parseInt(((1<arguments.length?arguments[1]:new Date).getTime()-b)/1E3,10),d="",d=1>a?"just now":60>a?a+" seconds ago":120>a?"a minute ago":2700>a?parseInt(a/60,10).toString()+" minutes ago":7200>a?"an hour ago":86400>a?""+parseInt(a/3600,10).toString()+" hours ago":172800>a?"a day ago":parseInt(a/86400, 10).toString()+" days ago";return"about "+d}function m(){var c="https:"==document.location.protocol?"https:":"http:",a=null===b.fetch?b.count:b.fetch;if(b.list)return c+"//"+b.twitter_api_url+"/1/"+b.username[0]+"/lists/"+b.list+"/statuses.json?page="+b.page+"&per_page="+a+"&include_entities=1&callback=?";if(b.favorites)return c+"//"+b.twitter_api_url+"/favorites/"+b.username[0]+".json?page="+b.page+"&count="+a+"&include_entities=1&callback=?";if(null===b.query&&1==b.username.length)return c+"//"+ b.twitter_api_url+"/1/statuses/user_timeline.json?screen_name="+b.username[0]+"&count="+a+(b.retweets?"&include_rts=1":"")+"&page="+b.page+"&include_entities=1&callback=?";var d=b.query||"from:"+b.username.join(" OR from:");return c+"//"+b.twitter_search_url+"/search.json?&q="+encodeURIComponent(d)+"&rpp="+a+"&page="+b.page+"&include_entities=1&callback=?"}function i(b,a){return a?"user"in b?b.user.profile_image_url_https:i(b,!1).replace(/^http:\/\/[a-z0-9]{1,3}\.twimg\.com\//,"https://s3.amazonaws.com/twitter_production/"): b.profile_image_url||b.user.profile_image_url}function n(c){var a={};a.item=c;a.source=c.source;a.screen_name=c.from_user||c.user.screen_name;a.avatar_size=b.avatar_size;a.avatar_url=i(c,"https:"===document.location.protocol);a.retweet="undefined"!=typeof c.retweeted_status;a.tweet_time=Date.parse(c.created_at.replace(/^([a-z]{3})( [a-z]{3} \d\d?)(.*)( \d{4})$/i,"$1,$2$4$3"));a.join_text="auto"==b.join_text?c.text.match(/^(@([A-Za-z0-9-_]+)) .*/i)?b.auto_join_text_reply:c.text.match(h)?b.auto_join_text_url: c.text.match(/^((\w+ed)|just) .*/im)?b.auto_join_text_ed:c.text.match(/^(\w*ing) .*/i)?b.auto_join_text_ing:b.auto_join_text_default:b.join_text;a.tweet_id=c.id_str;a.twitter_base="http://"+b.twitter_url+"/";a.user_url=a.twitter_base+a.screen_name;a.tweet_url=a.user_url+"/status/"+a.tweet_id;a.reply_url=a.twitter_base+"intent/tweet?in_reply_to="+a.tweet_id;a.retweet_url=a.twitter_base+"intent/retweet?tweet_id="+a.tweet_id;a.favorite_url=a.twitter_base+"intent/favorite?tweet_id="+a.tweet_id;a.retweeted_screen_name= a.retweet&&c.retweeted_status.user.screen_name;a.tweet_relative_time=l(a.tweet_time);a.entities=c.entities?(c.entities.urls||[]).concat(c.entities.media||[]):[];a.tweet_raw_text=a.retweet?"RT @"+a.retweeted_screen_name+" "+c.retweeted_status.text:c.text;a.tweet_text=d([k(a.tweet_raw_text,a.entities)]).linkUser().linkHash()[0];a.tweet_text_fancy=d([a.tweet_text]).makeHeart().capAwesome().capEpic()[0];a.user=e('<a class="tweet_user" href="{user_url}">{screen_name}</a>',a);a.join=b.join_text?e(' <span class="tweet_join">{join_text}</span> ', a):" ";a.avatar=a.avatar_size?e('<a class="tweet_avatar" href="{user_url}"><img src="{avatar_url}" height="{avatar_size}" width="{avatar_size}" alt="{screen_name}\'s avatar" title="{screen_name}\'s avatar" border="0"/></a>',a):"";a.time=e('<span class="tweet_time"><a href="{tweet_url}" title="view tweet on twitter">{tweet_relative_time}</a></span>',a);a.text=e('<span class="tweet_text">{tweet_text_fancy}</span>',a);a.reply_action=e('<a class="tweet_action tweet_reply" href="{reply_url}">reply</a>', a);a.retweet_action=e('<a class="tweet_action tweet_retweet" href="{retweet_url}">retweet</a>',a);a.favorite_action=e('<a class="tweet_action tweet_favorite" href="{favorite_url}">favorite</a>',a);return a}var b=d.extend({username:null,list:null,favorites:!1,query:null,avatar_size:null,count:3,fetch:null,page:1,retweets:!0,intro_text:null,outro_text:null,join_text:null,auto_join_text_default:"i said,",auto_join_text_ed:"i",auto_join_text_ing:"i am",auto_join_text_reply:"i replied to",auto_join_text_url:"i was looking at", loading_text:null,refresh_interval:null,twitter_url:"twitter.com",twitter_api_url:"api.twitter.com",twitter_search_url:"search.twitter.com",template:"{avatar}{time}{join}{text}",comparator:function(b,a){return a.tweet_time-b.tweet_time},filter:function(){return!0}},j),h=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?\u00ab\u00bb\u201c\u201d\u2018\u2019]))/gi; d.extend({tweet:{t:e}});d.fn.extend({linkUser:g(/(^|[\W])@(\w+)/gi,'$1@<a href="http://'+b.twitter_url+'/$2">$2</a>'),linkHash:g(/(?:^| )[\#]+([\w\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u00ff\u0600-\u06ff]+)/gi,' <a href="http://'+b.twitter_search_url+"/search?q=&tag=$1&lang=all"+(b.username&&1==b.username.length&&!b.list?"&from="+b.username.join("%2BOR%2B"):"")+'">#$1</a>'),capAwesome:g(/\b(awesome)\b/gi,'<span class="awesome">$1</span>'),capEpic:g(/\b(epic)\b/gi,'<span class="epic">$1</span>'),makeHeart:g(/(&lt;)+[3]/gi, "<tt class='heart'>&#x2665;</tt>")});return this.each(function(c,a){var f=d('<ul class="tweet_list">'),g='<p class="tweet_intro">'+b.intro_text+"</p>",h='<p class="tweet_outro">'+b.outro_text+"</p>",i=d('<p class="loading">'+b.loading_text+"</p>");b.username&&"string"==typeof b.username&&(b.username=[b.username]);d(a).unbind("tweet:load").bind("tweet:load",function(){b.loading_text&&d(a).empty().append(i);d.getJSON(m(),function(c){d(a).empty().append(f);b.intro_text&&f.before(g);f.empty();c=d.map(c.results|| c,n);c=d.grep(c,b.filter).sort(b.comparator).slice(0,b.count);f.append(d.map(c,function(a){return"<li>"+e(b.template,a)+"</li>"}).join("")).children("li:first").addClass("tweet_first").end().children("li:odd").addClass("tweet_even").end().children("li:even").addClass("tweet_odd");b.outro_text&&f.after(h);d(a).trigger("loaded").trigger(0===c.length?"empty":"full");b.refresh_interval&&window.setTimeout(function(){d(a).trigger("tweet:load")},1E3*b.refresh_interval)})}).trigger("tweet:load")})}});


var prevView=0;
var thisDocName="";
var tabPrevIndex=0;
var tmeO=null;

$(function(){

	$(".tweet").tweet({
	  username: "IrayneP",
	  avatar_size: 48,
	  count: 3,
	  loading_text: "loading tweets..."
	});


	$('#banner-slider').cycle({  
    	pager:  '#banner-nav',
    	timeout: 6000
	});

	$(".cart").load('http://www.todenhammanorfarm.co.uk/shop/index.php .cart');

	//MAIN SCROLL
	if($('#cblock').length){
		$("#cblock").scrollable({
			next:'#ar',
			prev:'#al',
			circular:'true',
			easing:'swing',
			speed:450
		}).autoscroll({ autoplay: true, interval: 6000 });
	}
	
	$('#al, #ar').click(function(){
		return false;
	});



/*
	TIPSY
*/
		if($('.pinfo').length){
		$('.pinfo').each(function(){
			if($(this).attr('title').length>0){
			$(this).tipsy({
				opacity:1,
				html:true,
				gravity: 'e'
			});
			}
		});
		}

	if($('.changer').length>0) {
		$('.changer>div').hide().eq(0).show();
	}
						   
	var trig = $('#accordion h2');
	var divs = $('#accordion div');
	var dur = 400; var accwidth = 200;
			
	trig.click(function(){
		thisind = trig.index(this);
		divs
		.animate({width: 25},{queue: false, duration: dur})
		.eq(thisind)
		.animate({width: accwidth},{queue: false, duration: dur});

		if($('.changer').length>0) {
			$('.changer>div').hide().eq(thisind).show();
		}
		
	});
	
	
	
	divs.eq(0).animate({width: accwidth},{queue: false, duration: dur});
	
	/* CONTACT FORM */
	$('.formContact p').formValidate().parent().submit(function(){
		clearTimeout(tmeO);
		thsForm=$(this).children('p');
		if(thsForm.frmSubmit()){
			expVals="";
			$('.formContact input[type="text"]').each(function(){expVals=expVals+$(this).val()+"{spl}";});
			$('.formContact textarea').each(function(){expVals=expVals+$(this).val()+"{spl}";});
			$.ajax({
			   type: "POST",
			   url: "media/scripts/php/jqFunctions.php",
			   data: "func=contactUs&inpVals="+expVals,
			   success: function(data){
				$('.contactReturn').text(data).css({display:'block'});
				tmeO=setTimeout(function(){$('.contactReturn').css({display:'none'}).text("")},5000);
				$('.formContact p').frmReset();
			   }
			 });
		}
		else{
			$('.contactReturn').text("Please ensure all mandatory fields a filled in correctly.")
			.css({display:'block'});
			tmeO=setTimeout(function(){$('.contactReturn').css({display:'none'}).text("")},5000);
		}
		return false;
	});

		if($('#promotion').length>0){
		$(window).bind("resize",function(){
			$('.pgecontainer').pgeConCen();					   
		});
		$(window).bind("load",function(){
				$('#promotion').PgeMask(function(){
				$('.pgecontainer img, .pgewrapper .pgemask').click(function(){
					$(this).PgeUnloadmask();					
				});				
			});
		});
		}
	
	$(window).bind("load",function(){
		thisDocName=CurrentDocName();


				
		$('#lOverlay').hide();
		$('.imginfo2 span').eq(0).show();
		$('#rtesec img').css({left:700}).eq(0).css({left:0}).fadeIn(500,function(){
		$('#rtesec img').show();
		$('.imginfo').animate({opacity:.8,top:0},300);
		$('.imginfo2').animate({top:0},300);
		
		
		$('input[type="text"]').frmImps();
		
		$('#baf').submit(function(){
			$('.bafdesc').text("Processing...").css({color:'#658B01'});
			emlVal=$(this).children('p').children('input[type="text"]').val();
			if(CheckEmail(emlVal)){
				 $.ajax({
				   type: "POST",
				   url: "media/scripts/php/baf.php",
				   data: "emailadd="+emlVal,
				   success: function(data){
						$('#baf').children('p').children('input[type="text"]').val("");
						$('.bafdesc').text(data).css({color:'#5a7b00'});
						$('#email').val('');
				   }
				 });
			}
			else{$('.bafdesc').text("Please enter a valid email address").css({color:'#e30000'});}
			
			return false;
		});
		
	});
		
		
		if(thisDocName==pgeNames[0][0])
		{
			$('.buttoncon').eq(0).css({'backgroundPosition':'left top'});
			
			$('.buttoncon').mouseout(function(){
				$('#rtesec').runCycle();							  
			});
			$('.buttoncon').mouseover(function(){
				thisIndex=$('.buttoncon').index(this);
				if(thisIndex!=prevView){FullAni(thisIndex);}
			});
			$('#rtesec').runCycle();
		}
		else
		{
			for(i=0;i<=pgeNames.length-1;i++){
				if(thisDocName==pgeNames[i][0]){$('#rtesec').leftSlide(0,pgeNames[i][1]);}
			}

			//$('#rtesec').leftSlide(0,7)
		}
		
		
		
	});
	
});

$(function(){
	$.fn.runCycle=function(){
		$(this).stop().animate({top:0},2000,function(){
			$(this).ImCycle();
		});
	}
	
	$.fn.ImCycle=function(){
		imgCount=$('#rtesec img').size()-1;
		
		$('#rtesec img').each(function(){
			thisIndex=$('#rtesec img').index(this);
			if($(this).css('left')=='0px')
			{
				runNext=ReturnNextInLine(imgCount,'right',thisIndex);
				$(this).animate({top:0},2000,function(){
					FullAni(runNext,function(){$('#rtesec').runCycle();});							 
				});
			}
		});		
	}
	
   $.fn.leftSlide=function(imStart,imFin){
		var thisName=$(this)
		var thisChildren=thisName.children('img');
		var nexIn=0;
		var prevIn=0;
		
		$(this).animate({top:0},3500,function(){
			thisChildren.each(function(){
				thisIndex=thisChildren.index(this);
				if(thisIndex>=imStart && thisIndex<=imFin)
				{
					if($(this).css('left')=="0px")
					{
						nexIn=thisIndex+1;
						prevIn=thisIndex;
						if(thisIndex>=imFin){nexIn=imStart;}
					}
				}
			});
			
			thisChildren.eq(prevIn).animate({left:-700},600,"swing",function(){
				$(this).css({left:700});																	
			});
			
			thisChildren.eq(nexIn).animate({left:0},{
			duration: 600, queue: false});
			
			thisName.leftSlide(imStart,imFin);
		});
   }
   
});

function ReturnNextInLine(elementlimit, AnimateDirection, currentIndex)
{	
	if(AnimateDirection=="left")
	{if(currentIndex==0){return elementlimit;}else{return currentIndex-1;}}
	else{if(currentIndex==elementlimit){return 0;}else{return currentIndex+1;}}
}

function FullAni(useIndex,callback)
{
			$('#lOverlay').show();
			$('.buttoncon').css({
			'backgroundPosition': 'left bottom'}).eq(useIndex).css({
			'backgroundPosition': 'left top'});

			
			$('#rtesec img').queue([]).eq(prevView).animate({
			left:'-700',opacity:0},600,"swing",function(){
				$(this).css({left:700}).animate({opacity:1},10);
				$('#lOverlay').hide();
				if(callback != undefined){callback();}
			});
			
			$('#rtesec img').eq(useIndex).animate({left:0},{
			duration: 600, queue: false});
			
			$('.imginfo').animate({top:0},{
			duration: 600,  queue: false});
			
			$('.imginfo2').animate({top:0},{
			duration: 600, queue: false});
			
			$('.imginfo2 span').hide().eq(useIndex).show();
			
			prevView=useIndex;	
}

function CurrentDocName()
{
    thisURL=document.location.href;
    strUrl=thisURL.split('/');
    strUrl=strUrl.pop().split('?');
    strUrl=strUrl[0].split('#');
    return strUrl[0];
}

function CheckEmail(inputemail) {
	AtPos = inputemail.indexOf("@");
	StopPos = inputemail.lastIndexOf(".");
	if (AtPos == -1 || StopPos == -1){return false;}
	else{return true;}
}

 (function($) {
    $.fn.extend({
        frmImps:function(options){
            return this.each(function() {
               var thsName=$(this);
               thsName.focus(function(){thsVal=thsName.val();thsName.val("");
               }).blur(function(){if(thsName.val()==""){thsName.val(thsVal);}});
            });
        }
    });

})(jQuery);
