<!-- // Start of AdSubtract JavaScript block; you can ignore this.
     // It is used when AdSubtract blocks cookies or pop-up windows.
document.iMokie = "cookie blocked by AdSubtract";
document.iMferrer = "referrer blocked by AdSubtract";
function iMwin() {
	this.location = "";
	this.frames = new Array(9);
	this.frames[0] = this;
	this.frames[1] = this;
	this.frames[2] = this;
	this.frames[3] = this;
	this.frames[4] = this;
	this.frames[5] = this;
	this.frames[6] = this;
	this.frames[7] = this;
	this.frames[8] = this;
	this.length = 0;
}
// End of AdSubtract JavaScript block. -->
var curImg = 0;
var timerId = -1;
var interval_6 = 1000
var interval_5 = 2000;
var interval_4 = 3000//document.slideshow.speedMenu.options[document.slideshow.speedMenu.selectedIndex].value*1000;//200;
var interval_3 = 4500;
var interval_2 = 6000;
var interval_1 = 10000;

var interval = interval_2;//m
var imgIsLoaded = false;

function replaceNum(myinput, token, newstr)
{
    var input = myinput;
    var output = input;
    var idx = output.indexOf(token);
    if (idx > -1) {
	output = input.substring(0, idx);
	output += newstr;
	output += input.substr(idx+token.length);
    }
    return output;
}
///////////////////////////////////////////////////////////////////////////////
function changeSpeed()
{

////////function slideshowSpeed()  // set show speed on the fly
 //////// {
  //////////var index = document.slideshowForm.speedSelect.selectedIndex;
	/////////interval  = document.slideshowForm.speedSelect.options[index].text;
//////	}
/////g_isPlaying = true;
/////  timeoutID = setTimeout("slideshowStart();", g_duration * 1000);
////  }
///setTimeout("slideshow();", document.slide.delaytime.options[document.slide.delaytime.selectedIndex].value*1000 )
   //    interval = document.changeSpeed.speedMenu.options[document.changeSpeed.speedMenu.selectedIndex].value*1000;
////	else {
	/////interval = document.changeSpeed.speedMenu.options[document.changeSpeed.speedMenu.selectedIndex].value*1000;
////   }
//////////////////////////////////////////////////////////////////////    
    var sidx = document.forms[0].speedMenu.selectedIndex;
   if (sidx == 0) {
	interval = interval_1;//s
   } 
    else if (sidx == 1){
	interval = interval_2;//m
    } 
    else if (sidx == 2){
	interval = interval_3;//f added
    } 
    else if (sidx == 3){
	interval = interval_4;//f added
    } 
	else if (sidx == 4){
	interval = interval_3;//f added
    } 
    else if (sidx == 5){
	interval = interval_5;//f added
    } 
    else {
	interval = interval_6;// vf interval = intervalf;
    }
    if (timerId != -1) {
	window.clearInterval(timerId);
	timerId = window.setInterval("forward();",interval);//interval
    }
}


function imgLoadNotify()
{
    imgIsLoaded = true;
}

function changeSlide()
{
    imgIsLoaded = false;
    var htmlCont = "<center><br><b>" + imageNameArray[curImg] + "</b><br>"  + imageDescArray[curImg] + 
	"<br><img src=\"" + imageSrcArray[curImg] + "\" alt=\"" + imageNameArray[curImg] + "\"";
    if (imageWidthArray[curImg] < 0 && imageHeightArray[curImg] < 0) {   //////CHANGED > 0 && imageHeightArray[curImg] >  to < 0 && imageHeightArray[curImg] <
        htmlCont += " width=" + imageWidthArray[curImg] + " height=" + imageHeightArray[curImg];
    }
    	
    htmlCont += " border=0 hspace=10 vspace=10 onload=\"imgLoadNotify();\">" +
	"<br><small>";
//    if (SHOWCREATOR) {
//        var tmpstr = replaceNum(POSTED2, "%date", imageDateArray[curImg]);
//        htmlCont += replaceNum(tmpstr, "%creator", imageCreatorArray[curImg]);
//    } 
//    else {
//        htmlCont += POSTED1 + "&nbsp;" + imageDateArray[curImg];
//        htmlCont 
//    }
//  htmlCont += "&nbsp;|&nbsp;" + RESOLUTION + "&nbsp;" + imageWidthArray[curImg] +
//	"x" + imageHeightArray[curImg] + "</small></center>";
    var pnumLine = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font face=\"$.fontonly\" size=-1 >";//-1 thisline controls the font for curent slide displayed text    color=red 
    pnumLine += replaceNum(SHOWINGSTRING, "%slideNum", eval(curImg+1));
    pnumLine += "</font>";
    if (isMinNS4) {
	document.layers[1].document.imgDiv.document.open();
	document.layers[1].document.imgDiv.document.write(htmlCont);
	document.layers[1].document.imgDiv.document.close();

	document.layers[0].document.layers[0].document.open();
	document.layers[0].document.layers[0].document.write(pnumLine);
	document.layers[0].document.layers[0].document.close();
    } else {
	document.all.pem.innerHTML = pnumLine;
	document.all.imgp.innerHTML = htmlCont;//imgp.
    }
}

function forward()
{
    if (imgIsLoaded) {
	curImg++;
	if (curImg == numImgs)
	    curImg = 0;
	changeSlide();
    }
}

function rewind()
{
    curImg--;
    if (curImg < 0)
	curImg = numImgs - 1;
    changeSlide();
}

function stop()
{
    window.clearInterval(timerId);
    timerId = -1;
    document.playbtn.src = buttonImgPfx + buttonOffArray[0];
    document.stopbtn.src = buttonImgPfx + buttonOnArray[1];
    imgIsLoaded = true;
}

function play()
{
    timerId = window.setInterval('forward();', interval);
    document.playbtn.src = buttonImgPfx + buttonOnArray[0];
    document.stopbtn.src = buttonImgPfx + buttonOffArray[1];
}

function setButton(direction)
{
    imgIsLoaded = true;
    if (direction == 0) {
	document.prevbtn.src = buttonImgPfx + buttonOnArray[2];
	window.setTimeout("document.prevbtn.src = buttonImgPfx + buttonOffArray[2];", 300);
    } else 
	{
	document.fowdbtn.src = buttonImgPfx + buttonOnArray[3];
	window.setTimeout("document.fowdbtn.src = buttonImgPfx + buttonOffArray[3];", 300);
    }
}
