var timer=null;var offset=5000;var index=0;function slideImage(A){var B="image_"+target[A];$("#"+B).animate({opacity:1},800,function(){$(this).find(".word").animate({height:"show"},"slow")}).show().siblings(":visible").find(".word").animate({height:"hide"},"fast",function(){$(this).parent().animate({opacity:0},800).hide()})}function hookThumb(){$("#thumbs li.slideshowItem a").bind("click",function(){if(timer){clearTimeout(timer)}var A=this.id;index=getIndex(A.substr(6));rechange(index);slideImage(index);timer=window.setTimeout(auto,offset);this.blur();return false})}function hookBtn(){$("#thumbs li img").filter("#play_prev,#play_next").bind("click",function(){if(timer){clearTimeout(timer)}var A=this.id;if(A=="play_prev"){index--;if(index<0){index=6}}else{index++;if(index>6){index=0}}rechange(index);slideImage(index);timer=window.setTimeout(auto,offset)})}function getIndex(A){for(var B=0;B<target.length;B++){if(target[B]==A){return B}}}function rechange(A){var B="thumb_"+target[A];$("#thumbs li a.current").removeClass("current");$("#"+B).addClass("current")}function auto(){index++;if(index>7){index=0}rechange(index);slideImage(index);timer=window.setTimeout(auto,offset)}jQuery.each(["Height","Width"],function(B,A){var C=A.toLowerCase();jQuery.fn["inner"+A]=function(){return this[0]?parseFloat(jQuery.css(this[0],C,"padding")):null};jQuery.fn["outer"+A]=function(D){return this[0]?parseFloat(jQuery.css(this[0],C,D?"margin":"border")):null};jQuery.fn[C]=function(E){var F=this[0];if(!F){return E==null?null:this}if(jQuery.isFunction(E)){return this.each(function(I){var H=jQuery(this);H[C](E.call(this,I,H[C]()))})}if(jQuery.isWindow(F)){return F.document.compatMode==="CSS1Compat"&&F.document.documentElement["client"+A]||F.document.body["client"+A]}else{if(F.nodeType===9){return Math.max(F.documentElement["client"+A],F.body["scroll"+A],F.documentElement["scroll"+A],F.body["offset"+A],F.documentElement["offset"+A])}else{if(E===undefined){var G=jQuery.css(F,C),D=parseFloat(G);return jQuery.isNaN(D)?G:D}else{return this.css(C,typeof E==="string"?E:E+"px")}}}}});$.fn.infiniteCarousel=function(){function A(C,B){return new Array(B+1).join(C)}return this.each(function(){var F=$("> div",this).css("overflow","hidden"),H=F.find("> div.slider-box"),G=H.find("> div.box"),D=G.filter(":first"),I=D.outerWidth(),C=Math.ceil(F.innerWidth()/I),E=1,B=Math.ceil(G.length/C);if((G.length%C)!=0){H.append(A('<div class="empty" />',C-(G.length%C)));G=H.find("> div")}G.filter(":first").before(G.slice(-C).clone().addClass("cloned"));G.filter(":last").after(G.slice(0,C).clone().addClass("cloned"));G=H.find("> div.box");F.scrollLeft(I*C);function J(L){var K=L<E?-1:1,N=Math.abs(E-L),M=I*K*C*N;F.filter(":not(:animated)").animate({scrollLeft:"+="+M},500,function(){if(L==0){F.scrollLeft(I*C*B);L=B}else{if(L>B){F.scrollLeft(I*C);L=1}}E=L});return false}F.after('<a class="arrow back">&lt;</a><a class="arrow forward">&gt;</a>');$("a.back",this).click(function(){return J(E-1)});$("a.forward",this).click(function(){return J(E+1)});$(this).bind("goto",function(K,L){J(L)})})};
