﻿// JScript File

var Pageurl=new Array("images/backgrounds/billboard1.png","images/backgrounds/billboard2.png","images/backgrounds/billboard3.png")
 var arr=new Array("images/backgrounds/billboard1.png","images/backgrounds/billboard2.png","images/backgrounds/billboard3.png")           
var num=0
var timeDelay
var FadeDurationMS=2000;
var imagePreload=new Array()
for (i=0;i<Pageurl.length;i++){
   imagePreload[i]=new Image()
imagePreload[i].src=Pageurl[i]
}

function drawpaging() { 
    RunSlideShow('EmilyPicture','EmilyPictureBackground','images/backgrounds/billboard1.png;images/backgrounds/billboard2.png;images/backgrounds/billboard3.png',20)
 }
 
 

 


var slideCache = new Array();

function RunSlideShow(pictureID,backgroundID,imageFiles,displaySecs)
{  
  var imageSeparator = imageFiles.indexOf(";");
  var nextImage = imageFiles.substring(0,imageSeparator);  
  //FadeInImage(pictureID,nextImage,backgroundID,num);
blendimage(backgroundID, pictureID, nextImage, 1000)
  var futureImages = imageFiles.substring(imageSeparator+1,imageFiles.length)+ ';' + nextImage;
  timeDelay=setTimeout("RunSlideShow('"+pictureID+"','"+backgroundID+"','"+futureImages+"',"+displaySecs+")",displaySecs*1000);
  // Cache the next image to improve performance.
	
  imageSeparator = futureImages.indexOf(";");
  nextImage = futureImages.substring(0,imageSeparator);
  if (slideCache[nextImage] == null)
  {
    slideCache[nextImage] = new Image;
    slideCache[nextImage].src = nextImage;
  }

 if (num<arr.length)
   {
    num++  
     if (num==arr.length) 
    num=0      
   } 
}




//change the opacity for different browsers
function changeOpac(opacity, id) {
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}


function blendimage(divid, imageid, imagefile, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 0;
	
	//set the current image as background
	document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
	
	//make image transparent
	changeOpac(0, imageid);
	
	//make new image
	document.getElementById(imageid).src = imagefile;

	//fade in image
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
		timer++;
	}
if(num==0)
{
document.getElementById('divpage1').style.display="block";
document.getElementById('divpage2').style.display="none";
document.getElementById('divpage3').style.display="none";
}
if(num==1)
{

document.getElementById('divpage1').style.display="none";
document.getElementById('divpage2').style.display="block";
document.getElementById('divpage3').style.display="none";
}

if(num==2)
{

document.getElementById('divpage1').style.display="none";
document.getElementById('divpage2').style.display="none";
document.getElementById('divpage3').style.display="block";
}

}

