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

jQuery(document).ready(function($){

	$('.product-img-box a.newmanGal').hover(   
		function() { 
			$('.product-img-box .active').removeClass('active');
			$(this).addClass('active');
		},    
		function() {   
			// run = setInterval(homeslider, speed);     
		}   
	)

	if ($.isFunction($.fn.numoshow)) {
		$(".product-zoom").numoshow({modal:'.5'});

		$("#view-gallery-carousel a").numoshow({ gallery: 'one', modal: '.5', pageID : '#view-gallery-carousel' });
	}
	
	if($('.related-list').length > 0){
		$('.related-list').equalHeights();
		
	}
	if ( !$.browser.msie && !$.browser.version <= 8 ) {
		$('.zoom-icon, .newmanGal').bt({
			padding: 5,
			width: 240,
			shrinkToFit: true,
			spikeLength: 5,
			spikeGirth: 10,
			cornerRadius: 3,
			fill: 'rgba(0, 172, 202, 1)',
			strokeWidth: 1,
			strokeStyle: '#FFFFFF',
			centerPointX: .5, // the spike extends from center of the target edge to this point
			centerPointY: .5, // defined by percentage horizontal (x) and vertical (y)
			closeWhenOthersOpen: true,
			positions: ['top', 'left', 'right', 'bottom'],
			cssStyles: {
				color: '#FFFFFF',
				fontWeight: 'normal'
			}
		});
	}

    // Makes the groupued link image / content div clickable
    if ($('div.grouped-content').length > 0) {
        $("div.grouped-content").click(function() {
            var url = $(this).find('a').attr("href");
            window.location = url;
        });
    }

    if ($('.additional-info').length == 0) {
        $('.down-link').remove();
    }

    // Range carousel
    if ($('#grouped-carousel').length > 0 && $.isFunction($.fn.cycle)) {
        $('#grouped-carousel').cycle({
            fx: 'fade',
            //scrollLeft turnDown 'scrollHorz' ,
            timeout: 0,
            //set to 0 will not auto scroll
            prev: '#prev-group',
            next: '#next-group',
            pager: '#grouped-controls',
            after: onAfter,
            cleartype: 1,
            // enable cleartype corrections
            pagerAnchorBuilder: pagerFactory1
        });
    }

    function pagerFactory1(idx, slide) {
        var s = idx > 2 ? ' style="display:none"': '';
        return '<li' + s + '><a href="#"><span>' + (idx + 1) + '</span></a></li>';
    };

    function onAfter(curr, next, opts) {
        var index = opts.currSlide;
        if (index == opts.slideCount - 1) {
            $('#next-group').css("opacity", 0).hide();
            $('#next-group-inactive').css("opacity", 1).fadeIn();
        } else {
            $('#next-group-inactive').css("opacity", 0).hide();
            $('#next-group').css("opacity", 1).fadeIn();
        }

        if (index == 0) {
            $('#prev-group').css("opacity", 0).hide();
            $('#prev-group-inactive').css("opacity", 1).fadeIn();
        } else {
            $('#prev-group-inactive').css("opacity", 0).hide();
            $('#prev-group').css("opacity", 1).fadeIn();
        }
    }

    // the grouped carousel 

	if ($('#slideshow').length > 0 && $.isFunction($.fn.cycle)) {
		$('#slideshow').cycle({
			fx: 'fade',
			//scrollLeft turnDown 'scrollHorz' ,
			timeout: 0,
			//set to 0 will not auto scroll
			prev: '#prev',
			next: '#next',
			pager: '#nav',
			after: onAfterGall,
			cleartype: 1,
			// enable cleartype corrections
			pagerAnchorBuilder: pagerFactory1
		});
			$('#next').css("opacity", 0).hide();
			$('#prev').css("opacity", 0).hide();
		}
	
		function pagerFactory2(idx, slide) {
		var s = idx > 2 ? ' style="display:none"': '';
		return '<li' + s + '><a href="#"><span>' + (idx + 1) + '</span></a></li>';
	};

	function onAfterGall(curr, next, opts) {
          var index = opts.currSlide;
          if (index == opts.slideCount - 1) {
              $('#next').css("opacity", 0).hide();
              $('#next-inactive').css("opacity", 0).hide();
          } else {
              $('#next-inactive').css("opacity", 0).hide();
              $('#next').css("opacity", 0).hide();
          }

          if (index == 0) {
              $('#prev').css("opacity", 0).hide();
              $('#prev-inactive').css("opacity", 0).hide();
          } else {
              $('#prev-inactive').css("opacity", 0).hide();
              $('#prev').css("opacity", 0).hide();
          }
      }
	  
	
	$(".down-link").bind('click', function(){
		var $target = $(this).attr('href');
		if (typeof $.fn.scrollTo == 'function') {
			$(window).scrollTo($target, {duration:1000});
			return false;
		}
	});
	
	
	if ($.isFunction($.fn.colorbox)) {
		var url = BASE_URL + 'product-enquiry';
		$("#product-contactus a#product-contactus-link").colorbox({
			href:url,
			onComplete:function(){
				var product_url = window.location.href;
				var product_name = $(".product-name",".hproduct").text();
				$(":input[name=product-url]","form#form-product-enquiry").val('Product Link: ' + product_url);
				$(":input[name=product-name]","form#form-product-enquiry").val('Product Name: ' + product_name);
			}
		});
	}
	
//	if ($.isFunction($.fn.fancybox)) {
//		var url = BASE_URL + 'product-enquiry';
//		$("#product-contactus a#product-contactus-link").attr('href',url).fancybox({
//			ajax:{cache:false},
//			onComplete:function(){
//				var product_url = window.location.href;
//				var product_name = $(".product-name",".hproduct").text();
//				$(":input[name=product-url]","form#form-product-enquiry").val('Product Link: ' + product_url);
//				$(":input[name=product-name]","form#form-product-enquiry").val('Product Name: ' + product_name);
//			}
//		});
//	}

	// SOCIAL MEDIA
//	var sm = $("#product-info-box .add-to-holder").append('<div class="addthis_toolbox addthis_default_style"><a class="addthis_button_tweet"></a><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a></div>');
//	var body = document.getElementsByTagName('body')[0];
//	var script = document.createElement('script');
//	script.src = 'http://s7.addthis.com/js/250/addthis_widget.js#username=xa-4cd08d747b3f3291';
//	body.appendChild(script);
	
//	if ($("#product-info-box .add-to-holder").length > 0) {
//		var sm = $("#product-info-box .add-to-holder").append('<div class="addthis_toolbox addthis_default_style"><a href="http://twitter.com/share" class="twitter-share-button" data-count="none" data-via="DomayneAU"></a><fb:like layout="button_count" width="100"></fb:like></div>');
//		var element = document.createElement("script");
//		element.src = "http://platform.twitter.com/widgets.js";
//		document.body.appendChild(element);
//		
//		var element = document.createElement("script");
//		element.src = "http://connect.facebook.net/en_US/all.js#xfbml=1";
//		document.body.appendChild(element);
//	}
	
	
    // END custom jquery config / docready 
});




