/*
--- JAVASCRIPT FUNCTIONS FOR Austria Ski website ---
--- CJH - 29/06/2007 ---
*/

// Define the array to hold the images and the thumbs
var myImages = new Array();
var imgPath = "/resources/images/header/" // Path to images

var timerID = 0;
var currentImage = 1;

// Populate the array with the main images, thumbs, display text and URL
myImages[0] = "header1new.jpg";
myImages[1] = "header2new.jpg";
myImages[2] = "header3new.jpg";
myImages[3] = "header4new.jpg";
myImages[4] = "header5new.jpg";
myImages[5] = "header6new.jpg";

//Preload the images
if(document.images) {
	img1 = new Image();
	img2 = new Image();
	
	img1.src = imgPath + myImages[0]
	img2.src = imgPath + myImages[1];	
}

// Change to the selected image
function changeImage() {
	// IE Broswer blend (uses filters)
	if (document.getElementById('imgHeader').filters) {
		document.getElementById('imgHeader').style.filter = "blendTrans(duration=3)";
		document.getElementById('imgHeader').filters.blendTrans.Apply();
		document.getElementById('imgHeader').filters.blendTrans.Play();		

		document.getElementById('imgHeader').style.backgroundImage = "url(" + imgPath + myImages[currentImage] + ")"; // Set the new main image

	} 
	else {
		document.getElementById('imgHeader').style.backgroundImage = "url(" + imgPath + myImages[currentImage] + ")"; // Set the new main image
	}

	// Increment the counter
	currentImage++;
	
	if (currentImage >= myImages.length) {
		currentImage = 0;
	}
}


// Open a new popup window
// Take 3 parameters - url - the URL of the page to be openeed
//					 - width - the width of the popup window
//					 - height - the height of the popup window
function popup(url, height, width) {
	var newWindow = window.open(url, '', 'width=' + width + ',height=' + height +',resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,menubar=no,copyhistory=no');
	if (window.focus) {newWindow.focus()}
}