var Pic = new Array(); // picture file name var PicW = new Array(); // picture width var PicH = new Array(); // picture height var PicC = new Array(); // picture comment var preLoad = new Array(); Pic[0] = 'photos/20000607_australia/australia1.jpg'; PicW[0] = 466; PicH[0] = 345; PicC[0] = '  '; preLoad[0] = new Image(); Pic[1] = 'photos/20000607_australia/australia10.jpg'; PicW[1] = 466; PicH[1] = 326; PicC[1] = '  '; preLoad[1] = new Image(); Pic[2] = 'photos/20000607_australia/australia11.jpg'; PicW[2] = 326; PicH[2] = 466; PicC[2] = '  '; preLoad[2] = new Image(); Pic[3] = 'photos/20000607_australia/australia12.jpg'; PicW[3] = 326; PicH[3] = 466; PicC[3] = '  '; preLoad[3] = new Image(); Pic[4] = 'photos/20000607_australia/australia2.jpg'; PicW[4] = 466; PicH[4] = 326; PicC[4] = '  '; preLoad[4] = new Image(); Pic[5] = 'photos/20000607_australia/australia3.jpg'; PicW[5] = 466; PicH[5] = 326; PicC[5] = '  '; preLoad[5] = new Image(); Pic[6] = 'photos/20000607_australia/australia4.jpg'; PicW[6] = 313; PicH[6] = 459; PicC[6] = '  '; preLoad[6] = new Image(); Pic[7] = 'photos/20000607_australia/australia5.jpg'; PicW[7] = 466; PicH[7] = 326; PicC[7] = '  '; preLoad[7] = new Image(); Pic[8] = 'photos/20000607_australia/australia6.jpg'; PicW[8] = 466; PicH[8] = 326; PicC[8] = '  '; preLoad[8] = new Image(); Pic[9] = 'photos/20000607_australia/australia7.jpg'; PicW[9] = 466; PicH[9] = 326; PicC[9] = '  '; preLoad[9] = new Image(); Pic[10] = 'photos/20000607_australia/australia8.jpg'; PicW[10] = 466; PicH[10] = 326; PicC[10] = '  '; preLoad[10] = new Image(); Pic[11] = 'photos/20000607_australia/australia9.jpg'; PicW[11] = 466; PicH[11] = 326; PicC[11] = '  '; preLoad[11] = new Image(); // alert("111 preLoadPic ix = "+0+":::"+preLoad[0].name); // Set slideShowSpeed (milliseconds) var slideShowSpeed = 5000 // Agent sniffer shamelessly 'stolen' from the excellent X library from cross-browser.com var xOp7=false,xOp5or6=false,xIE4Up=false,xNN4=false,xUA=navigator.userAgent.toLowerCase(); if(window.opera){ xOp7=(xUA.indexOf('opera 7')!=-1 || xUA.indexOf('opera/7')!=-1); if (!xOp7) xOp5or6=(xUA.indexOf('opera 5')!=-1 || xUA.indexOf('opera/5')!=-1 || xUA.indexOf('opera 6')!=-1 || xUA.indexOf('opera/6')!=-1); } else if(document.layers) xNN4=true; else {xIE4Up=document.all && xUA.indexOf('msie')!=-1 && parseInt(navigator.appVersion)>=4;} // Duration of crossfade (seconds) var crossFadeDuration = 1 // Specify the image files var t = -1; var pos = 0; var posNext = 0; var status_slideshow = 0; var count_entry = 0; var html; function preLoadPic(index) { if (index >= 0 && index < Pic.length) { if (preLoad[index].src == "") { preLoad[index].src = "albums/"+Pic[index]; // alert("preLoadPic ix = "+index); // alert("preLoadPic"); } } else { Alert("Error : invalid index."); } } function startSlideShow() { if (Pic.length == 0) { // No picture to start slide show. Alert("Error : Pic.length is less than or equal to 0."); } else if (t == -1) { // Only when the slide show has not been started, // then start it. posNext = pos; if ((posNext+1) < Pic.length) { // Can increment var pos. Thus increment. posNext++; } else if ((posNext +1) >= Pic.length) { // Cannot increment var pos. Thus restart from beginning. posNext = 0; } status_slideshow = 1; count_entry = 0; playSlideShow(); window.status='Starting Slide Show ... '+window.status; } } function playSlideShow() { if (Pic.length <= 0) { endSlideShow(); Alert("Error : Pic.length is less than or equal to 0."); return; } if (preLoad[posNext].src == "") { endSlideShow(); Alert("Error : preLoad[posNext].src is empty"); return; } if (! preLoad[posNext].complete) { // The next picture is not completely loaded. if (count_entry == 3) { // Already attempted 3 times. Abort. endSlideShow(); window.status='Slide show halted. Connection speed is too slow.'; Alert("Error : Connection speed is too slow for slide show."); } else { window.status='Loading Picture '+(posNext+1)+' of '+Pic.length+', '+Pic[posNext]; if (count_entry > 0) { window.status = window.status + ', '+count_entry; } if (t == -1) { t = window.setInterval('playSlideShow();', 3000); // alert("timer started"); } } count_entry++; } else { // The next picture has been completely loaded. // Show the next picture pos = posNext; count_entry = 0; changeSlide(); window.status='Showing Picture '+(pos+1)+' of '+Pic.length; if (status_slideshow != 0 && (posNext+1) < Pic.length) { // Slide show is being played. // Preload the next picture. posNext++; preLoadPic(posNext); if (t == -1) { // Although it is now in the slide show mode, but // the timer has not been started. Thus, start it. t = window.setInterval('playSlideShow();', 3000); } } else { // Slide show is not being played OR slide show has ended. if (status_slideshow != 0) { window.status=window.status+', '+'Slide Show Ended.'; } endSlideShow(); } if (status_slideshow == 0) { // Not in slide show mode. // Also preload the next and the prev photo if ((pos+1) < Pic.length) preLoadPic(pos+1); if (pos > 0) preLoadPic(pos-1); } } } function endSlideShow() { if (t != -1) { window.clearInterval(t); t = -1; } // window.status=''; status_slideshow = 0; } function changeSlide() { if (xIE4Up) { if (document.all) { //document.images.SlideShow.style.filter= "blendTrans(duration=crossFadeDuration)" document.all.SlideShow.style.filter="blendTrans(duration=1)"; document.all.SlideShow.filters.blendTrans.Apply(); } } writeInnerHTML(); if (xIE4Up) { if (document.all) { document.all.SlideShow.filters.blendTrans.Play(); } } displayComment(); return true; } function writeInnerHTML() { html = ""; html += "\n"; html += "\n"; html += "
\n"; html += " 0) { posNext = pos - 1; playSlideShow(); } } function firstPhoto() { endSlideShow(); posNext = 0; playSlideShow(); } function lastPhoto() { endSlideShow(); if (Pic.length > 0) { posNext = Pic.length - 1; playSlideShow(); } } function gotoPhoto(num) { endSlideShow(); if (num > 0 && num <= Pic.length) { pos = num - 1; if (preLoad[pos].src == "" || ! preLoad[pos].complete) { // The next picture is not completely loaded. preLoadPic(pos); writeInnerHTML(); displayComment(); } else { changeSlide(); } // Also preload the next and the prev photo if ((pos+1) < Pic.length) preLoadPic(pos+1); if (pos > 0) preLoadPic(pos-1); } } function displayComment() { html = "Album 8 : 2000 June Australia Trip
"; html += "Photo "+(pos+1)+" of "+Pic.length+"
"; html += PicC[pos]; html += "
"; document.getElementById("TitleAndComments").innerHTML = html; } function load() { displayComment(); // Display the first picture. gotoPhoto(1); // Preload the last picture. if (Pic.length>0) preLoadPic(Pic.length-1); }