(function(b){b.fn.turns=function(e){for(var d=0;d<this.length;d++){this.turns=new a(e,this[d])}return this};var c={inerval:3000,start:0,navigation:{active:true,effect:"slide"},pagination:{active:true,effect:"fade",interact:"hover"},effect:{slide:{speed:500},fade:{speed:1000}}};var a=function(d,e){var d=b.extend(c,d,true);this.conts=b(d.contName,e);this.tags=b(d.tagName||"jdAdPagination",e);this.options=d;this.interval=d.interval;this.gsize=d.gsize;this.pos=0;this.timer=null;this.size=this.conts.length;if(this.size<=1){this.show(0);return}this.start(d.start);this.eventBind(b(e),this.tags,this.conts)};window.exposes={};a.prototype={start:function(e){this.auto=true;var d=this;this.play(e,"next");this.timer=setInterval(function(){d.next()},d.interval)},end:function(e){for(var d=0;d<this.gsize;d++){this.exposal(this.conts[e])}b(".page",b(".jdAdIndex")).html(e+1);b(".jdFixPrice").html(b(".jdAdPrice")[e].innerHTML);b(".jdAdPrevious").off("mousedown",this.levt).on("mousedown",this.levt);b(".jdAdNext").off("mousedown",this.revt).on("mousedown",this.revt)},play:function(f,d,e){if(this.options.navigation.effect=="slide"){this.slide(f,d)}else{this.fade(f,d)}},show:function(d){this.turnsReset();this.turnsInnerReset();b(this.conts[d]).addClass("current");b(this.tags[d]).addClass("select");this.end(d)},slide:function(i,h){var m=this.tags[i];this.turnsReset();this.turnsInnerReset();var l=this.conts[i];var f=this.conts[(i-1+this.size)%this.size];var g=this.conts[(i+1)%this.size];b(l).addClass("current");b(g).addClass("current");b(f).addClass("current");b(m).addClass("select");var k=this;var d=0;var j=l.offsetWidth;l.style.opacity=1;g.style.opacity=1;f.style.opacity=1;if(h=="prev"){change=j;d=-j;l.style.left=-j+"px";g.style.left=0;f.style.left=-2*j+"px"}else{change=-j;d=j;l.style.left=j+"px";g.style.left=2*j+"px";f.style.left=0}var e=this.options.effect.slide.speed/20;b(l).animate("left",d,change,e,"px",function(){l.style.left=d+change+"px"});b(g).animate("left",d+j,change,e,"px",function(){g.style.left=d+j+change+"px"});b(f).animate("left",d-j,change,e,"px",function(){f.style.left=d-j+change+"px";k.end(i)})},fade:function(i,g){var f=this;var e=this.conts[i];var d=this.tags[i];var h=this.options.effect.fade.speed/20;this.turnsReset();this.turnsInnerReset();b(d).addClass("select");b(e).addClass("current").addClass("jdAdShow");e.style.left=0;this.end(i)},next:function(){this.pos++;this.pos%=this.size;var d=this;this.play(this.pos,"next")},prev:function(){this.pos--;this.pos=(this.pos+this.size)%this.size;var d=this;this.play(this.pos,"prev")},stop:function(){clearInterval(this.timer)},turnsReset:function(){this.conts.removeClass("current").removeClass("jdAdShow");this.conts.each(function(d){d.style.left=0;d.style.opacity=1});this.tags.removeClass("select")},turnsInnerReset:function(){b(".jdAdInfo",this.conts[this.pos]).removeClass(".jdAdInfoShow")},exposal:function(d){b(".jdAdContInner",d).each(function(g,f){var e=g.getAttribute("exposal");if(window.exposes[e]===undefined){b.getScript(e);window.exposes[e]=1}})},eventBind:function(k,g,f){var e=this;k.on("mouseover",function(i){e.stop()});k.on("mouseout",function(i){e.stop();e.timer=setTimeout(function(){e.start((++e.pos)%e.size)},1000)});this.levt=function(i){b(".jdAdPrevious").off("mousedown",e.levt);var l=(i||window.event);if(l.preventDefault){l.preventDefault()}e.stop();e.prev()};this.revt=function(i){b(".jdAdNext").off("mousedown",e.revt);var l=(i||window.event);if(l.preventDefault){l.preventDefault()}e.stop();e.next()};if(this.options.navigation.active===true){this.auto=false;b(".jdAdPrevious").on("mousedown",this.levt);b(".jdAdNext").on("mousedown",this.revt)}var j=function(i){var l=this.getAttribute("index");if(e.pos==l){return false}else{e.pos=l}e.turnsReset();e.stop();if(e.options.pagination.effect=="slide"){e.slide(l)}else{e.fade(l)}return false};var d=function(i){e.stop();e.turnsReset();e.pos=this.index;e.fade(this.index)};if(this.options.pagination.active===true){if(this.options.pagination.interact==="hover"){for(var h=0;h<g.length;h++){g[h].index=h;g[h].onmouseover=d}}else{if(this.options.pagination.interact==="click"){g.on("click",j)}}}}}})(_J);