var photos = new Array;

var urls = new Array;





// SLIDE SHOW CONFIG //

/* 

To add or remove photos, simply follow the pattern below - each set should be the next number up eg:

photos[0] = new Image();

photos[0].src = 'YOUR IMAGE HERE';

urls[0] = 'YOUR URL HERE';



photos[1] = new Image();

photos[1].src = 'YOUR IMAGE HERE';

urls[1] = 'YOUR URL HERE';



then 2, then 3 etc

*/



photos[0] = new Image();

photos[0].src = '/v/vspfiles/templates/104/images/img1.jpg';

urls[0] = 'http://www.ellumiglow.com/LED-Par-Cans-s/127.htm'; 



photos[1] = new Image();

photos[1].src = '/v/vspfiles/templates/104/images/img2.jpg';

urls[1] = 'http://www.ellumiglow.com/Electric-Optics-5-0mm-EL-Wire-6-Foot-Kit-p/eo5rm6.htm';


photos[2] = new Image();

photos[2].src = '/v/vspfiles/templates/104/images/img3.jpg';

urls[2] = 'http://www.ellumiglow.com/DJ-Lasers-s/108.htm';



photos[3] = new Image();

photos[3].src = '/v/vspfiles/templates/104/images/img4.jpg';

urls[3] = 'http://www.ellumiglow.com/electroluminescent-billboard';



maxwidth = 550 ; //Maximum image width 550

maxheight = 300 ; //Maxiumum image height 300



rotatetime = 5 ; //Time between rotations in seconds. It was set to 5



fillerlink = 'javascript:;'; //The Link for the Space filler image

fillerimg = '/v/vspfiles/templates/104/images/spacefiller.jpg'; //The Image for the space filler



///// END CONFIG - DO NOT EDIT BELOW THIS LINE!! /////



playbutton = new Image();

playbutton.src = 'vspfiles/templates/104/images/play.png';



var x = 0;

var num = 4; //var num = photos.length; Changed 11/17/2009 Number of slideshow to display

var y = num - 1; 

var pause = 0;



function slideshowInit(){

buttonsize = (num * 43) + 43;

left = (maxwidth - buttonsize);

document.write("<div id='showcontainer' style='width:"+maxwidth+"px;height:"+(maxheight+30)+";'><div id='slideshow' style='width:"+maxwidth+"px;height:"+maxheight+";text-align:center;'>Loading Images...");

document.write("</div>");

document.write("<div id='playpause' style='float:right;width:43px;height:33px;text-align:center;cursor:pointer' onclick='stopstart()'><img src='/v/vspfiles/templates/104/images/pause.png' /></div>");

while (y >= 0){

document.write ("<div id='button"+y+"' style='float:right;font-weight:bold;width:43px;height:33px;text-align:center;cursor:pointer;background:url(/v/vspfiles/templates/104/images/background.png);' onclick='showimage("+y+")'><div style='margin-top:7px;font-size:13px;font-weight:bold;font-family:verdana'><b>"+(y+1)+"</b></div></div>");

y = y-1;

}

document.write ("<div style='float:left;width:"+left+"px;height:33px;overflow:hidden;text-align:left;'><a href='"+fillerlink+"'><img src='"+fillerimg+"' style='border:0px'/></a></div>");

document.write ("<div style='clear:all'></div>");



setTimeout("checkload()","1000");

}



function checkload(){

if (photos[0].width != 0){

shownext()

}else{

setTimeout("checkload()","1000");

}

}





function shownext(){

if (pause == 1){

return;

}

if (x >= num){

//x = 3; //x = 2;   Changed 11/19/2009 It goes stop at image0, 1, 2, 3. 3=4th image
x = 0; 


thiswidth = photos[x].width;

thisheight = photos[x].height;



if (thiswidth > maxwidth){

	ratio = maxwidth / thiswidth;

	thiswidth = Math.floor(thiswidth * ratio);

	thisheight = Math.floor(thisheight * ratio);

}



if (thisheight > maxheight){

	ratio = maxheight / thisheight;

	thiswidth = Math.floor(thiswidth * ratio);

	thisheight = Math.floor(thisheight * ratio);

}



document.getElementById('slideshow').innerHTML = "<a href='"+urls[x]+"'><img src='"+photos[x].src+"' style='border:0px;width:"+thiswidth+";height:"+thisheight+";margin-left:auto;margin-right:auto;' /></a>";



clearhighlight();

document.getElementById("button"+x).style.background = 'url(/v/vspfiles/templates/104/images/backgroundselected.png)';

stopstart();

return;

}



thiswidth = photos[x].width;

thisheight = photos[x].height;



if (thiswidth > maxwidth){

	ratio = maxwidth / thiswidth;

	thiswidth = Math.floor(thiswidth * ratio);

	thisheight = Math.floor(thisheight * ratio);

}



if (thisheight > maxheight){

	ratio = maxheight / thisheight;

	thiswidth = Math.floor(thiswidth * ratio);

	thisheight = Math.floor(thisheight * ratio);

}





document.getElementById('slideshow').innerHTML = "<a href='"+urls[x]+"'><img src='"+photos[x].src+"' style='border:0px;width:"+thiswidth+";height:"+thisheight+";margin-left:auto;margin-right:auto;' /></a>";



clearhighlight();

document.getElementById("button"+x).style.background = 'url(/v/vspfiles/templates/104/images/backgroundselected.png)';





x = x + 1;

setTimeout("shownext()",rotatetime * 1000);

}



function clearhighlight(){

y = 0;

while (y < num){

document.getElementById("button"+y).style.background = 'url(/v/vspfiles/templates/104/images/background.png)';

y = y+1;

}

}



function showimage(img){

if (pause != 1){

stopstart();

}

clearhighlight();

document.getElementById("button"+img).style.background = 'url(/v/vspfiles/templates/104/images/backgroundselected.png)';

thiswidth = photos[img].width;

thisheight = photos[img].height;



if (thiswidth > maxwidth){

	ratio = maxwidth / thiswidth;

	thiswidth = Math.floor(thiswidth * ratio);

	thisheight = Math.floor(thisheight * ratio);

}



if (thisheight > maxheight){

	ratio = maxheight / thisheight;

	thiswidth = Math.floor(thiswidth * ratio);

	thisheight = Math.floor(thisheight * ratio);

}



document.getElementById('slideshow').innerHTML = "<a href='"+urls[img]+"'><img src='"+photos[img].src+"' style='border:0px;width:"+thiswidth+";height:"+thisheight+";margin-left:auto;margin-right:auto;' /></a>";



}



function stopstart(){

if (pause == 1){

pause = 0;

document.getElementById("playpause").innerHTML = "<img src='/v/vspfiles/templates/104/images/pause.png' />";

shownext();

}else{

pause = 1;

document.getElementById("playpause").innerHTML = "<img src='/v/vspfiles/templates/104/images/play.png' />";

}



}
