// -- Array for links -- REMEBER TO CHANGE THE NUMBER AT THE TOP -- //
var daguiarURL 	= new Array(5);
daguiarURL[0]   = "facials.htm";
daguiarURL[1]   = "treatments.htm";
daguiarURL[2]   = "wedding.htm";
daguiarURL[3]   = "wedding.htm";
daguiarURL[4]   = "aboutus.htm";

// -- Array for images -- REMEBER TO CHANGE THE NUMBER AT THE TOP -- //
var daguiarFile = new Array(5);
daguiarFile[0] 	= "scripts/daguiar0.jpg";
daguiarFile[1] 	= "scripts/daguiar1.jpg";
daguiarFile[2] 	= "scripts/daguiar2.jpg";
daguiarFile[3] 	= "scripts/daguiar3.jpg";
daguiarFile[4] 	= "scripts/daguiar4.jpg";

// -- Start with the first banner -- //
//var NewBN   = 0;
//var CurrentBN   = 0;

// -- Start with a random banner -- //
var NewBN   = Math.floor(Math.random() * daguiarFile.length);
var CurrentBN   = Math.floor(Math.random() * daguiarFile.length);

// -- Function to write the HREF and SRC -- //
function LoadBN(){	
		document.write("<A NAME='daguiarLink' ID='daguiarLink' HREF='" + daguiarURL[NewBN] + "' >");
		document.write("<IMG NAME='daguiarImage' ID='daguiarImage' ALT='daguiar' SRC='" + daguiarFile[NewBN] + "'");
		
		// -- DON'T FORGET TO ADJUST THE WIDTH AND HEIGHT FOR THE IMAGE -- //
		document.write(" width='300' height='240' border='0' style='border: 0px solid #222222;'></A>");
	
		// -- Set the current banner to a new number -- //
		CurrentBN = NewBN;
	
		// -- Set the Timeout -- DON'T FORGET TO ALSO SET FURTHER DOWN -- //
		window.setTimeout("ChangeBN()",8000);
}

// -- Function to change the HREF and SRC -- //
function ChangeBN(){
	
		// -- Get a random new banner -- //
		//NewBN = Math.floor(Math.random() * daguiarFile.length);
		
		// -- Get the next banner in order -- //
		if (NewBN < (daguiarFile.length - 1)){
			NewBN ++;
		}
		else{
			NewBN = 0;
		}
		
		// -- If the new banner is not the same change the HREF and SRC -- //
		if(CurrentBN != NewBN){				
			//daguiarLink.href = daguiarURL[NewBN];
			//daguiarImage.src = daguiarFile[NewBN];
			document.getElementById('daguiarLink').href = daguiarURL[NewBN];
			document.getElementById('daguiarImage').src = daguiarFile[NewBN];
			CurrentBN = NewBN;
		}
		
		// -- Set the Timeout -- DON'T FORGET TO ALSO SET HIGHER UP -- //
		window.setTimeout("ChangeBN()",8000);
}

LoadBN();