/*** Default.js - Default javascript functions ***/

// Define the array to hold the images and the thumbs for rotating header
var myImages = new Array();
var imgPath = "/images/" // Path to images

var timerID = 0;
var currentImage = 1;

// Populate the array with the main images, thumbs, display text and URL
myImages[0] = "bg1.jpg";
myImages[1] = "bg2.jpg";
myImages[2] = "bg3.jpg";
myImages[3] = "bg4.jpg";

//Preload the images
if(document.images) {
	img1 = new Image();
	img2 = new Image();
	img3 = new Image();
	img4 = new Image();	
	
	img1.src = imgPath + myImages[0]
	img2.src = imgPath + myImages[1];	
	img3.src = imgPath + myImages[2]
	img4.src = imgPath + myImages[3]	
}

// Change to the selected image
function changeImage() {
	// IE Broswer blend (uses filters)
	if (document.getElementById('headerphoto').filters) {
		document.getElementById('headerphoto').style.filter = "blendTrans(duration=3)";
		document.getElementById('headerphoto').filters.blendTrans.Apply();
		document.getElementById('headerphoto').filters.blendTrans.Play();		

		document.getElementById('headerphoto').style.backgroundImage = "url(" + imgPath + myImages[currentImage] + ")"; // Set the new main image

	} 
	else {
		document.getElementById('headerphoto').style.backgroundImage = "url(" + imgPath + myImages[currentImage] + ")"; // Set the new main image
	}

	// Increment the counter
	currentImage++;
	
	if (currentImage >= myImages.length) {
		currentImage = 0;
	}
}

// Clear the newsletter sign up box when clicked on
function inputChange() {
	document.getElementById("EmailAddress").value = "";
}

