﻿var thumbPerWidth=0;var thumbPlaySpeedConstant=30;var thumbPlaySpeed=thumbPlaySpeedConstant;var thumbInterval=null;var isThumbPlayAuto=0;var noPicHtml="<center>无可查看相片！</center>";var thumbPageContentID="thumbPageContent";var thumbPagePreDivID="thumbPagePreDiv";var thumbPageNextDivID="thumbPageNextDiv";var imageBorder=2;var tableCellSpacing=2;var imageDefaultCount=4;var imageMaxWidth=160;var imageMaxHeight=120;var picThumbSize=0;var picThumbInterval=1000;var picThumbVal=null;var picThumbForceStop=false;var _showPicThumbTimerID=null;var _showPicThumbTimerOut=500;function thumbPlayPerNext(a){var b=document.getElementById(thumbPageContentID);if(thumbInterval){if(isThumbPlayAuto!=0){thumbInterval=window.clearInterval(thumbInterval);isThumbPlayAuto=0}else{return}}var c=Math.floor(b.scrollLeft/thumbPerWidth)*thumbPerWidth;thumbInterval=window.setInterval("thumbPlayPerNextAuto("+c+");",thumbPlaySpeed);if(a==true){pause()}}function thumbPlayPerNextPage(){var a=document.getElementById(thumbPageContentID);if(thumbInterval){if(isThumbPlayAuto!=0){thumbInterval=window.clearInterval(thumbInterval);isThumbPlayAuto=0}}var b=Math.floor(a.scrollLeft/thumbPerWidth)*thumbPerWidth;a.scrollLeft=b+(picThumbSize-1)*thumbPerWidth;thumbPageButton();pause()}function thumbPlayPerNextAuto(a){isThumbPlayAuto=0;var b=document.getElementById(thumbPageContentID);if(b.scrollLeft<a+thumbPerWidth){b.scrollLeft++}else{thumbInterval=window.clearInterval(thumbInterval)}thumbPageButton()}function thumbPlayPerPre(a){var b=document.getElementById(thumbPageContentID);var c=Math.floor(b.scrollLeft/thumbPerWidth)*thumbPerWidth;if(thumbInterval){if(isThumbPlayAuto!=0){thumbInterval=window.clearInterval(thumbInterval);isThumbPlayAuto=0;c+=thumbPerWidth}else{return}}thumbInterval=window.setInterval("thumbPlayPerPreAuto("+c+");",thumbPlaySpeed);if(a==true){pause()}}function thumbPlayPerPrePage(){var a=document.getElementById(thumbPageContentID);var b=Math.floor(a.scrollLeft/thumbPerWidth)*thumbPerWidth;if(thumbInterval){if(isThumbPlayAuto!=0){thumbInterval=window.clearInterval(thumbInterval);isThumbPlayAuto=0;b+=thumbPerWidth}}a.scrollLeft=b-(picThumbSize-1)*thumbPerWidth;thumbPageButton();pause()}function thumbPlayPerPreAuto(a){isThumbPlayAuto=0;var b=document.getElementById(thumbPageContentID);if(b.scrollLeft<=0){thumbInterval=window.clearInterval(thumbInterval)}else if(b.scrollLeft>a-thumbPerWidth){b.scrollLeft--}else{thumbInterval=window.clearInterval(thumbInterval)}thumbPageButton()}function thumbPlayNextTimeOut(){_showPicThumbTimerID=window.setTimeout("thumbPlayNext();",_showPicThumbTimerOut)}function thumbPlayNext(){if(thumbInterval&&isThumbPlayAuto==-1){return}else if(thumbInterval){thumbInterval=window.clearInterval(thumbInterval)}var a=document.getElementById(thumbPageContentID);thumbInterval=window.setInterval("thumbPlayNextAuto();",thumbPlaySpeed);pause()}function thumbPlayNextAuto(){var a=document.getElementById(thumbPageContentID);if(a==null||a.scrollLeft>=a.scrollWidth-a.clientWidth){thumbInterval=window.clearInterval(thumbInterval);isThumbPlayAuto=0}else{isThumbPlayAuto=1;a.scrollLeft++}thumbPageButton()}function thumbPlayPreTimeOut(){_showPicThumbTimerID=window.setTimeout("thumbPlayPre();",_showPicThumbTimerOut)}function thumbPlayPre(){if(thumbInterval&&isThumbPlayAuto==1){return}else if(thumbInterval){thumbInterval=window.clearInterval(thumbInterval)}var a=document.getElementById(thumbPageContentID);thumbInterval=window.setInterval("thumbPlayPreAuto();",thumbPlaySpeed);pause()}function thumbPlayPreAuto(){var a=document.getElementById(thumbPageContentID);if(a.scrollLeft<=0){thumbInterval=window.clearInterval(thumbInterval);isThumbPlayAuto=0}else{a.scrollLeft--;isThumbPlayAuto=-1}thumbPageButton()}function clearThumbPlayAuto(){if(_showPicThumbTimerOut){window.clearTimeout(_showPicThumbTimerID)}if(thumbInterval&&isThumbPlayAuto!=0){thumbInterval=window.clearInterval(thumbInterval);var a=document.getElementById(thumbPageContentID);var b=Math.floor(a.scrollLeft/thumbPerWidth)*thumbPerWidth;if(isThumbPlayAuto==-1){b+=thumbPerWidth;thumbInterval=window.setInterval("thumbPlayPerPreAuto("+b+")",thumbPlaySpeed)}else if(isThumbPlayAuto==1){thumbInterval=window.setInterval("thumbPlayPerNextAuto("+b+")",thumbPlaySpeed)}isThumbPlayAuto=0}}function thumbPageButton(){var a=document.getElementById(thumbPageContentID);var b=document.getElementById(thumbPagePreDivID);var c=document.getElementById(thumbPageNextDivID);if(a==null||b==null||c==null){return}if(a.scrollWidth>a.clientWidth){if(a.scrollLeft<=0){b.style.visibility="hidden"}else{b.style.visibility="visible"}if(a.scrollLeft+a.clientWidth>=a.scrollWidth){c.style.visibility="hidden"}else{c.style.visibility="visible"}}else{b.style.visibility="hidden";c.style.visibility="hidden"}}function countImagesLimit(){var a=imageDefaultCount;var b=document.getElementById("pageMid");if(b){var c=32;var d=10;var e=(a*imageMaxWidth)+((a+1)*tableCellSpacing)+((a)*2*imageBorder)+c+d;while((b.clientWidth<=e)&&a>=0){a--;e=(a*imageMaxWidth)+((a+1)*tableCellSpacing)+((a)*2*imageBorder)+c+d}}return a}function initMarquee(){var a=document.getElementById("thumbPageContent");picThumbSize=countImagesLimit();a.style.width=(picThumbSize*imageMaxWidth)+((picThumbSize+1)*tableCellSpacing)+((picThumbSize)*2*imageBorder);a.style.height=imageMaxHeight+(picThumbSize*(2*(tableCellSpacing+imageBorder)));a.style.overflow="hidden";marquee=document.createElement("div");var b=document.createElement("table");b.cellSpacing=tableCellSpacing;b.cellPadding=0;b.border=0;b.insertRow();if(imageSrcArray.length>0){for(var i=0;i<imageSrcArray.length;i++){var c=b.rows[0].insertCell();c.width=imageMaxWidth;c.height=imageMaxHeight;c.style.overflow="hidden";c.style.align="center";c.style.verticalAlign="middle";var d="";d+="<div style=\"width:"+(imageMaxWidth+2*imageBorder)+";height:"+(imageMaxHeight+2*imageBorder)+";\">";d+="<table width=\"100%\" height=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td align=\"center\" valign=\"middle\">";d+="<img style=\"cursor:hand;border:2px solid #FFF;margin:auto;\"";d+=" src=\""+imageSrcArray[i]+"\" onclick=\"windowOpen('"+imageLinkArray[i]+"');\" alt=\""+imageNameArray[i]+"\"";d+=" border=\"0\" />";d+="</td></tr></table>";d+="</div>";c.innerHTML=d}}else{a.innerHTML=noPicHtml}marquee.appendChild(b);a.appendChild(marquee);thumbPerWidth=imageMaxWidth+2*imageBorder+tableCellSpacing}