﻿function $ImgRepeatClass(){var a=this;a.folderPath="./Images";a.containerId="divShow";a.repair=8;a.width=200;a.height=120;a.isAutoPlay=true;a.isShowContent=true;a.isShowImgPage=true;a.interval=3;a._imgs=[];a._urls=[];a._contents=[];a._index=0;a._div=null;a._divA=null,a._divContent=null}$ImgRepeatClass.prototype.Append=function(d,e,c,b){var a=this;img=document.createElement("img");img.src=a.folderPath+"/"+d;if(b)img.alt=img.title=b;a._imgs.push(img);a._urls.push(e);a._contents.push(c)};$ImgRepeatClass.prototype.Apply=function(){var a=this;if(a._imgs.length<=0)return;var b,c,d,g,h,m;h=document.getElementById(a.containerId);h.style.width=a.width+"px";h.style.height=a.height+"px";c="position: relative; overflow: hidden;";d="width: "+a.width+"px;";g="height: "+a.height+"px;";var f=document.createElement("div");f.style.cssText=c+d+g;h.appendChild(f);b=document.createElement("div");f.appendChild(b);a._div=b;if(a.isShowImgPage){c="position: absolute; overflow: auto; z-index: 399;";d="right: "+a.repair/2+"px; bottom: "+a.repair/2+"px;";b=document.createElement("div");b.style.cssText=c+d;var e,l=document.createDocumentFragment();c="display: block; float: left; padding: 0 3px; margin: 2px; z-index: 400;";d=" text-decoration: none; background-color: #000;";g="font-size: 12px; color: #fff; font-family: Tahoma; font-weight: bold;";for(var i=0;i<a._imgs.length;i++){e=document.createElement("a");e.style.cssText=c+d+g;e.href="javascript:void(0);";e.innerText=e.textContent=i+1;a._event(e);l.appendChild(e)}b.appendChild(l);a._divA=b;f.appendChild(b)}if(a.isShowContent){c="position: absolute; top: 0; width: 100%; height: 25px; z-index: 401;";d="filter: alpha(opacity=40); opacity: 0.4; background-color: #000;";b=document.createElement("div");b.style.cssText=c+d;f.appendChild(b);c="position: absolute; top: 0; z-index: 402; padding: 5px 0; overflow: hidden;";d="color: #fff; font-size: 12px; font-weight: bold; font-family: Tahoma;";g="width: 100%; height: 25px; text-align: center;";b=document.createElement("div");b.style.cssText=c+d+g;a._divContent=b;f.appendChild(b)}a._animate();if(a.isAutoPlay){var k=function(){a._animate()},j=setInterval(k,a.interval*1e3);a._div.onmouseover=function(){clearInterval(j)};a._div.onmouseout=function(){j=setInterval(k,a.interval*1e3)}}};$ImgRepeatClass.prototype._tools={loc:function(a){if(arguments.length!=1||a==null)return null;var c=a.offsetTop,b=a.offsetLeft,e=a.offsetWidth,d=a.offsetHeight;while(a=a.offsetParent){c+=a.offsetTop;b+=a.offsetLeft}return{AbsoluteTop:c,AbsoluteLeft:b,OffsetWidth:e,OffsetHeight:d}},show:function(c,b){var a=0,e=document.all?25:.25,f=document.all?100:1,d=setInterval(function(){a+=e;if(document.all)c.style.filter="alpha(opacity="+a+")";else c.style.opacity=a;if(a>=f){clearInterval(d);typeof b==="function"&&b.call()}},100)},hide:function(c,b){var a=document.all?100:1,e=document.all?25:.25,f=0,d=setInterval(function(){a-=e;if(document.all)c.style.filter="alpha(opacity="+a+")";else c.style.opacity=a;if(a<=f){clearInterval(d);typeof b==="function"&&b.call()}},100)}};$ImgRepeatClass.prototype._event=function(a){var b=this,c=parseInt(a.innerText||a.textContent);a.onclick=function(){b._index=c-1;b._animate();this.blur()};a.onmouseover=function(){this.style.backgroundColor="#FF4E00"};a.onmouseout=function(){if(b._index!=c)this.style.backgroundColor="#000"}};$ImgRepeatClass.prototype._animate=function(){var a=this,b=a._div,j=a._divA,g=a._divContent,c=a._index>=a._imgs.length?0:a._index,e=a._imgs[c],h=a._urls[c],k=a._contents[c],i=function(){e.style.border=0;var d=document.createDocumentFragment(),c=document.createElement("a");c.href=h?h:e.src;c.target="_blank";c.appendChild(e);d.appendChild(c);if(b.hasChildNodes())b.replaceChild(d,b.firstChild);else b.appendChild(d);a._tools.show(b)};if(a.isShowImgPage)for(var f=j.childNodes,d=0;d<f.length;d++)f[d].style.backgroundColor=d===c?"#FF4E00":"#000";if(a.isShowContent)g.innerText=g.textContent=k;a._tools.hide(b,i);a._index=c;a._index++};
