//6.4
var playMode=1;var scale=1;var Title=1;var timeoutValue=2000;var timeoutID;var pic=1;var image=0;var play=1;var numOfImages=image_end-image_start+1;var maxWidth=640;var maxHeight=480;var imageHeight;var imageWidth;var imageIndex=0;imageLoaded=new Array();image_text=new Array();imgarray=new Array();if(typeof imagePath=="undefined"){var imagePath=""}for(pic=1;pic<=numOfImages;pic++){imageLoaded[pic]=0}imgarray[1]=new Image();imgarray[1].src=imagePath+(image_start)+".jpg";imgarray[2]=new Image();imgarray[2].src=imagePath+(image_start+1)+".jpg";var nextLoading=3;var numLoaded=0;var showStarted=0;var managerTimer;var imageLoadTimeoutTime=20;var imageLoadTimeout=imageLoadTimeoutTime;function imageManager(){var loadComplete=1;for(pic=1;pic<nextLoading;pic++){if(imageLoaded[pic]==0){if(imgarray[pic].complete){imageLoaded[pic]=1;numLoaded++}else loadComplete=0}}if(loadComplete==1){if(nextLoading<=numOfImages){imageLoadTimeout=imageLoadTimeoutTime;imgarray[nextLoading]=new Image();imgarray[nextLoading].src=imagePath+(image_start-1+nextLoading)+".jpg";nextLoading++;managerTimer=setTimeout("imageManager()",200)}}else{if(imageLoadTimeout>0)imageLoadTimeout--;else{imageLoadTimeout=imageLoadTimeoutTime;imgarray[nextLoading]=new Image();imgarray[nextLoading].src=imagePath+(image_start-1+nextLoading)+".jpg";if(nextLoading<numOfImages)nextLoading++}managerTimer=setTimeout("imageManager()",200)}if(!showStarted&&numLoaded>2&&imageLoaded[1]){showStarted=1;startPlay()}}var imageStart;function startPlay(){var vspace;{imageIndex=nextImage(imageIndex);imageStart=nextImage(imageIndex);while(imageLoaded[imageIndex]==0&&imageStart!=imageIndex){imageIndex=nextImage(imageIndex)}}if(imageLoaded[imageIndex]==1){imageWidth=imgarray[imageIndex].width;imageHeight=imgarray[imageIndex].height;if(scale==1){scaleImage();if(imageWidth>maxWidth){imageHeight=(imageHeight*maxWidth/imageWidth);imageWidth=maxWidth}if(imageHeight>maxHeight){imageWidth*=maxHeight/imageHeight;imageHeight=maxHeight;vspace=0}if(imageWidth<maxWidth&&imageHeight<maxHeight){if(maxWidth/imageWidth>maxHeight/imageHeight){imageHeight*=maxWidth/imageWidth;imageWidth=maxWidth}else{imageWidth*=maxHeight/imageHeight;imageHeight=maxHeight}}}if(imageHeight<maxHeight)vspace=(maxHeight-imageHeight)/2;else vspace=0;document.getElementById("SlideImage").width=0;document.getElementById("SlideImage").height=0;document.getElementById("SlideImage").vspace=vspace;document.getElementById("SlideImage").src=imgarray[imageIndex].src;document.getElementById("SlideImage").width=imageWidth;document.getElementById("SlideImage").height=imageHeight;if(Title==1)document.getElementById("slideText").innerHTML=image_text[imageIndex]}if(play==1)timeoutID=setTimeout("startPlay()",timeoutValue)}function nextImage(imageNumber){if(playMode==1){if(imageNumber<numOfImages&&imageNumber<(nextLoading-1))imageNumber++;else imageNumber=1}else{if(imageNumber>1)imageNumber--;else imageNumber=nextLoading-1}return imageNumber}function pausePlay(){if(play==1){play=0;clearTimeout(timeoutID)}}function PlayImage(){if(play==0){play=1;startPlay()}}function slower(){play=1;if(timeoutValue<10000)timeoutValue+=1000}function faster(){if(timeoutValue>1000){timeoutValue-=1000;clearTimeout(timeoutID);startPlay()}}function ImageForward(){clearTimeout(timeoutID);playMode=1;startPlay()}function ImageBack(){clearTimeout(timeoutID);playMode=0;startPlay()}function scaleImage(){var iWidth;var iHeight;var vspace;iWidth=document.getElementById("SlideImage").width;iHeight=document.getElementById("SlideImage").height;if(iWidth>maxWidth){iHeight=(iHeight*maxWidth/iWidth);iWidth=maxWidth}if(iHeight>maxHeight){iWidth*=maxHeight/iHeight;iHeight=maxHeight;vspace=0}if(iWidth<maxWidth&&iHeight<maxHeight){if(maxWidth/iWidth>maxHeight/iHeight){iHeight*=maxWidth/iWidth;iWidth=maxWidth}else{iWidth*=maxHeight/iHeight;iHeight=maxHeight}}if(iHeight<maxHeight)vspace=(maxHeight-iHeight)/2;else vspace=0;document.getElementById("SlideImage").vspace=vspace;document.getElementById("SlideImage").width=iWidth;document.getElementById("SlideImage").height=iHeight}
