
// SCRIPT TO ROTATE HOME PAGE IMAGES

//PRELOAD BACKGROUND IMAGES
pic1= new Image(933,262); 
pic1.src="images/homerotation_1.jpg"; 
pic2= new Image(933,262); 
pic2.src="images/homerotation_2.jpg"; 
pic3= new Image(933,262); 
pic3.src="images/homerotation_3.jpg";


function rotatePhotos(imagenum,forcenum) {
    var div = document.getElementById('mainimage');
	var wrapdiv = document.getElementById('mainimagewrapper');
	
    if (imagenum == 0) {
		wrapdiv.style.backgroundImage = 'none';
	 	div.style.backgroundImage = 'none';
	}
	else {
		 wrapdiv.style.backgroundImage = 'url(images/homerotation_'+imagenum+'.jpg)';
	} // set the wrapper background image
             
	if (forcenum == 0) {r = imagenum+1;}
	else {r = forcenum;}
	if (r == 4) { r=1;} // go back to the first image at the end of the sequence
	div.style.opacity = .1;
	div.style.filter = "alpha(opacity = 10)";
	div.style.backgroundImage = 'url(images/homerotation_'+r+'.jpg)';
	
	i = 1;
	fadeIn(r); //fade background image in
	//div.style.opacity = 1;
	//div.style.filter = "alpha(opacity = 100)";
	
	
	div.innerHTML = "<img src='images/1x.gif' style='position:absolute;top:224px;left:545px;width:375px;height:37px' usemap='#boxes"+r+"' />";

	
	
	rerun = setTimeout('rotatePhotos(r,0)',10000); //run script again
}
 


function fadeIn(r) {
var div = document.getElementById('homebanner');
  if(i<=10) {
	  b=i*.1;
	  c=i*10;
    window.setTimeout("fadeIn(r)",100);
    document.getElementById('mainimage').style.opacity = b;
	document.getElementById('mainimage').style.filter = "alpha(opacity = "+c+")";
    i++;
  }
  
}


