//SUPPORT PAGE HIGHLIGHTS SCRIPT FILE


//Current option to start with *************************************************************
currentIndx=1;


//Figures out how many entries in the array for the "1 of 5" number area *************************************************************
var total = highlightphoto.length-1;


//Variables for SlideShow Timer
var delay3 = 0;


//This function calls the SlideShow after a delay *************************************************************
function delaySS() {
	delay3 = setTimeout('runSlideShow()', SlideShowSpeed);
}


//This is for pre-loading the images *************************************************************
imagesPreloaded = new Array()
for (var i = 1; i < highlightphoto.length ; i++) 
{
	imagesPreloaded[i] = new Image(360,187)
imagesPreloaded[i].src=highlightphoto[i]
}


//This function loads up the first array option *************************************************************
function showOne() {
document.getElementById('photoback').style.backgroundImage = "url(" + imagesPreloaded[currentIndx].src + ")";
document.getElementById('highlightphoto').src=imagesPreloaded[currentIndx].src
document.getElementById('highlightphoto').alt=highlighttitle[currentIndx];
document.getElementById('highlightcategory').innerHTML=highlightcategory[currentIndx];
document.getElementById('highlighttitle').innerHTML=highlighttitle[currentIndx];
document.getElementById('highlightdescription').innerHTML=highlightdescription[currentIndx];
document.getElementById('highlightlinkto').href=highlightlinkto[currentIndx];
document.getElementById('morelinkto').href=highlightlinkto[currentIndx];
document.getElementById('highlightthumbnail1').src=highlightthumbnail[1];
document.getElementById('highlightthumbnail2').src=highlightthumbnail[2];
document.getElementById('highlightthumbnail3').src=highlightthumbnail[3];
document.getElementById('highlightthumbnail4').src=highlightthumbnail[4];
document.getElementById('highlightthumbnail5').src=highlightthumbnail[5];
highlightCells();
}

function highlightCells(){
	if (currentIndx==1) {
	document.getElementById('cell1').background='/joinsupport/images/1px-darkpurple.jpg';
	document.getElementById('cell2').background='';
	document.getElementById('cell3').background='';
	document.getElementById('cell4').background='';
	document.getElementById('cell5').background='';
}else
if (currentIndx==2) {
	document.getElementById('cell1').background='';
	document.getElementById('cell2').background='/joinsupport/images/1px-darkpurple.jpg';
	document.getElementById('cell3').background='';
	document.getElementById('cell4').background='';
	document.getElementById('cell5').background='';
}else
if (currentIndx==3) {
	document.getElementById('cell1').background='';
	document.getElementById('cell2').background='';
	document.getElementById('cell3').background='/joinsupport/images/1px-darkpurple.jpg';
	document.getElementById('cell4').background='';
	document.getElementById('cell5').background='';
}else
if (currentIndx==4) {
	document.getElementById('cell1').background='';
	document.getElementById('cell2').background='';
	document.getElementById('cell3').background='';
	document.getElementById('cell4').background='/joinsupport/images/1px-darkpurple.jpg';
	document.getElementById('cell5').background='';
}else
if (currentIndx==5) {
	document.getElementById('cell1').background='';
	document.getElementById('cell2').background='';
	document.getElementById('cell3').background='';
	document.getElementById('cell4').background='';
	document.getElementById('cell5').background='/joinsupport/images/1px-darkpurple.jpg';
}
}


//This tells the page to call this function when loaded *************************************************************
window.onload=function(){
//blendimage('photos', 'photoname', imagesPreloaded[currentIndx].src, 600);
showOne();
delaySS();
highlightCells();
}


//This function is for the automatic slideshow (1000 = 1 second) *************************************************************


//Fade function *************************************************************

// Set the slideshow speed (in milliseconds)
var SlideShowSpeed = 5000;

// Set the duration of crossfade (in seconds)
var CrossFadeDuration = 3;

function runSlideShow(){

document.getElementById('highlightphoto').src = imagesPreloaded[currentIndx].src;
changeOpac(100, 'highlightphoto');

if (currentIndx<imagesPreloaded.length-1){
currentIndx=currentIndx+1
}
else {
 currentIndx=1
}	

document.getElementById('photoback').style.backgroundImage = "url(" + imagesPreloaded[currentIndx].src + ")";
 
    var speed = Math.round(300 / 100); 
    var timer = 0;
	for(var i = 100; i >= 0; i--) { 
        setTimeout("changeOpac(" + i + ",'" + 'highlightphoto' + "')",(timer * speed)); 
        timer++; } 


document.getElementById('highlightphoto').alt=highlighttitle[currentIndx];
document.getElementById('highlightcategory').innerHTML=highlightcategory[currentIndx];
document.getElementById('highlighttitle').innerHTML=highlighttitle[currentIndx];
document.getElementById('highlightdescription').innerHTML=highlightdescription[currentIndx];
document.getElementById('highlightlinkto').href=highlightlinkto[currentIndx];
document.getElementById('morelinkto').href=highlightlinkto[currentIndx];
highlightCells();
delay3 = setTimeout('runSlideShow()', SlideShowSpeed);
}


//Function to stop slide show *************************************************************
function stopSS() {
	if(delay3) {
      clearTimeout(delay3);
      timerID  = 0;
  	
}}


//change the opacity for different browsers ********************************************************
function changeOpac(opacity, id) { 
	var object = document.getElementById(id).style; 
    object.opacity = (opacity / 101); 
    object.MozOpacity = (opacity / 101); 
    object.KhtmlOpacity = (opacity / 101); 
    object.filter = "alpha(opacity=" + opacity + ")";
} 