// JavaScript Document
	
	var imageNum = 1;
	var arrayNum = 1;
	var totalImages = 7;
	imageArray = new Array();
	var imageSpeed = 3;
	
	
/* Setup
	
	imageArray[arrayNum++] = new imageItem("/fwo/" + GlobalCode + GlobalRegion + GlobalForecastType + ".+000" + GlobalFileType);
	imageArray[arrayNum++] = new imageItem("/fwo/" + GlobalCode + GlobalRegion + GlobalForecastType + ".+024" + GlobalFileType);
	imageArray[arrayNum++] = new imageItem("/fwo/" + GlobalCode + GlobalRegion + GlobalForecastType + ".+048" + GlobalFileType);
	imageArray[arrayNum++] = new imageItem("/fwo/" + GlobalCode + GlobalRegion + GlobalForecastType + ".+072" + GlobalFileType);
	imageArray[arrayNum++] = new imageItem("/fwo/" + GlobalCode + GlobalRegion + GlobalForecastType + ".+096" + GlobalFileType);
	imageArray[arrayNum++] = new imageItem("/fwo/" + GlobalCode + GlobalRegion + GlobalForecastType + ".+120" + GlobalFileType);
	imageArray[arrayNum++] = new imageItem("/fwo/" + GlobalCode + GlobalRegion + GlobalForecastType + ".+144" + GlobalFileType); */
	
	
		imageArray[arrayNum++] = new imageItem("http://www.bom.gov.au/fwo/" + GlobalCode + GlobalRegion + GlobalForecastType + ".+000" + GlobalFileType);
	imageArray[arrayNum++] = new imageItem("http://www.bom.gov.au/fwo/" + GlobalCode + GlobalRegion + GlobalForecastType + ".+024" + GlobalFileType);
	imageArray[arrayNum++] = new imageItem("http://www.bom.gov.au/fwo/" + GlobalCode + GlobalRegion + GlobalForecastType + ".+048" + GlobalFileType);
	imageArray[arrayNum++] = new imageItem("http://www.bom.gov.au/fwo/" + GlobalCode + GlobalRegion + GlobalForecastType + ".+072" + GlobalFileType);
	imageArray[arrayNum++] = new imageItem("http://www.bom.gov.au/fwo/" + GlobalCode + GlobalRegion + GlobalForecastType + ".+096" + GlobalFileType);
	imageArray[arrayNum++] = new imageItem("http://www.bom.gov.au/fwo/" + GlobalCode + GlobalRegion + GlobalForecastType + ".+120" + GlobalFileType);
	imageArray[arrayNum++] = new imageItem("http://www.bom.gov.au/fwo/" + GlobalCode + GlobalRegion + GlobalForecastType + ".+144" + GlobalFileType);

	
	
	function imageItem(image_location) { //Creating the image location
		this.image_item = new Image();
		this.image_item.src = image_location;
	}

	function get_ImageItemLocation(imageObj) { // Returning the image location
	return(imageObj.image_item.src)
	}
	
	function getNextImage() { // Gets the next image in the sequence
	imageNum = imageNum+1;
	if(imageNum>totalImages){
		imageNum=1;
	}
	var new_image = get_ImageItemLocation(imageArray[imageNum]);
	return(new_image);
	}
	
	function getPrevImage() { // Get the previous image in the sequence
	imageNum = imageNum-1;
	if(imageNum==-1||imageNum==0){
		imageNum=totalImages;
	}
	var new_image = get_ImageItemLocation(imageArray[imageNum]);
	return(new_image);
	}
	
	function switchImage(place) { // Switches all the images around
	if (imageNum==totalImages-1){
		var new_image = getNextImage();
		document[place].src = new_image;
		var recur_call = "switchImage('"+place+"')";
		timerID = setTimeout(recur_call, "3000");
		document.control_form.frame_nr.value = imageNum;
	}
	else{
		var new_image = getNextImage();
		document[place].src = new_image;
		var recur_call = "switchImage('"+place+"')";
		timerID = setTimeout(recur_call, interval);
		document.control_form.frame_nr.value = imageNum;
		}
		AnimPlaying = 1;
	}
	
	function switchPrevImage(place) { // Switches all the images around
	var new_image = getPrevImage();
	document[place].src = new_image;
	var recur_call = "switchImage('"+place+"')";
	timerID = setTimeout(recur_call, interval);
	document.control_form.frame_nr.value = imageNum;
	}
	
	function changeSpeed(speed){
		if(speed=='faster'){
			if (interval=='250'){
				alert("Loop can go no faster.");
			}
			else{
				interval=interval-250;
			}
		}
		
		
		if(speed=='slower'){
			if (interval=='1250'){
				alert("Loop can go no slower.");
			}
			else{
				interval=interval+250;
			}
		}
	}
	
	function stopAnimation(){
		GlobalPlaying='No';
		clearTimeout(timerID);
	}
	
	
	function play(place){
		if (GlobalPlaying != 'No') {
			return;
		}
	// If we're here, we are now not playing.
		GlobalPlaying = 'Yes';
		switchImage(place);		
	}
	
		/* Get Speed List working */
	document.speed_form.frame_speed.value = imageSpeed;