var touchslide=function(a){a=a||{};var b={slidecell:a.slidecell||"#touchslide",titcell:a.titcell||".btndiv span",maincell:a.maincell||".bd",effect:a.effect||"left",autoplay:a.autoplay||!1,delaytime:a.delaytime||200,intertime:a.intertime||2500,defaultindex:a.defaultindex||0,titonclassname:a.titonclassname||"on",autopage:a.autopage||!1,prevcell:a.prevcell||".prev",nextcell:a.nextcell||".next",pagestatecell:a.pagestatecell||".pagestate",pnloop:"undefined "==a.pnloop?!0:a.pnloop,startfun:a.startfun||null,endfun:a.endfun||null,switchload:a.switchload||null},c=document.getelementbyid(b.slidecell.replace("#",""));if(!c)return!1;var d=function(a,b){a=a.split(" ");var c=[];b=b||document;var d=[b];for(var e in a)0!=a[e].length&&c.push(a[e]);for(var e in c){if(0==d.length)return!1;var f=[];for(var g in d)if("#"==c[e][0])f.push(document.getelementbyid(c[e].replace("#","")));else if("."==c[e][0])for(var h=d[g].getelementsbytagname("*"),i=0;ir;r++)q+="";else for(var r=0;p>r;r++)q+=b.autopage.replace("$",r+1);o.innerhtml=q,o=o.children}"leftloop"==i&&(p+=2,m.appendchild(m.children[0].clonenode(!0)),m.insertbefore(m.children[n-1].clonenode(!0),m.children[0])),n=e(m,'
'),m.style.csstext="width:"+p*m+"px;"+"position:relative;overflow:hidden;padding:0;margin:0;";for(var r=0;p>r;r++)m.children[r].style.csstext="display:table-cell;vertical-align:top;width:"+m+"px";var s=function(){"function"==typeof b.startfun&&b.startfun(r,p)},t=function(){"function"==typeof b.endfun&&b.endfun(r,p)},u=function(a){var b=("leftloop"==i?r+1:r)+a,c=function(a){for(var b=m.children[a].getelementsbytagname("img"),c=0;ca;a++)m.children[a].style.width=m+"px";var b="leftloop"==i?r+1:r;w(-b*m,0)};window.addeventlistener("resize",v,!1);var w=function(a,b,c){c=c?c.style:m.style,c.webkittransitionduration=c.moztransitionduration=c.mstransitionduration=c.otransitionduration=c.transitionduration=b+"ms",c.webkittransform="translate("+a+"px,0)"+"translatez(0)",c.mstransform=c.moztransform=c.otransform="translatex("+a+"px)"},x=function(a){switch(i){case"left":r>=p?r=a?r-1:0:0>r&&(r=a?0:p-1),null!=q&&u(0),w(-r*m,s),x=r;break;case"leftloop":null!=q&&u(0),w(-(r+1)*m,s),-1==r?(z=settimeout(function(){w(-p*m,0)},s),r=p-1):r==p&&(z=settimeout(function(){w(-m,0)},s),r=0),x=r}s(),a=settimeout(function(){t()},s);for(var c=0;p>c;c++)h(o[c],b.titonclassname),c==r&&g(o[c],b.titonclassname);0==w&&(h(k,"nextstop"),h(j,"prevstop"),0==r?g(j,"prevstop"):r==p-1&&g(k,"nextstop")),l&&(l.innerhtml=""+(r+1)+"/"+p)};if(x(),u&&(y=setinterval(function(){r++,x()},t)),o)for(var r=0;p>r;r++)!function(){var a=r;o[a].addeventlistener("click",function(){cleartimeout(z),cleartimeout(a),r=a,x()})}();k&&k.addeventlistener("click",function(){(1==w||r!=p-1)&&(cleartimeout(z),cleartimeout(a),r++,x())}),j&&j.addeventlistener("click",function(){(1==w||0!=r)&&(cleartimeout(z),cleartimeout(a),r--,x())});var y=function(a){cleartimeout(z),cleartimeout(a),o=void 0,d=0;var b=h?a.touches[0]:a;b=b.pagex,c=b.pagey,m.addeventlistener(j,z,!1),m.addeventlistener(k,$,!1)},z=function(a){if(!h||!(a.touches.length>1||a.scale&&1!==a.scale)){var b=h?a.touches[0]:a;if(d=b.pagex-b,e=b.pagey-c,"undefined"==typeof o&&(o=!!(o||math.abs(d)0||r>=p-1&&0>d)&&(d=.4*d),w(-r*m+d,0);break;case"leftloop":w(-(r+1)*m+d,0)}null!=q&&math.abs(d)>m/3&&u(d>-0?-1:1)}}},$=function(a){0!=d&&(a.preventdefault(),o||(math.abs(d)>m/10&&(d>0?r--:r++),x(!0),u&&(y=setinterval(function(){r++,x()},t))),m.removeeventlistener(j,z,!1),m.removeeventlistener(k,$,!1))};m.addeventlistener(i,y,!1)};