var IMAGE_DIR = "http://www.easyoztravels.com/images/";
var timeOn;
var currentMenu="stopovers_menu";

function validate(){
if((document.getElementById('firstname').value=="")||(document.getElementById('email_add').value=="")||(document.getElementById('daytime').value=="")){
alert("Please fill in all required fields.");
return false;
}
else{
return true;
}
}

function hover(name){
document.getElementById(name).style.background = "#554A92";
}
function unhover(name){
document.getElementById(name).style.background = "#1B1151";
}

function changeImage(ind){
	var src= IMAGE_DIR+ind;

	if(document.getElementById(ind).src == src+".gif"){
		src+="_over.gif"
		}
	else
		src+=".gif";
	document.getElementById(ind).src=src;
}

function show(menu, over){
	document.getElementById(currentMenu).style.visibility="hidden";
	document.getElementById(menu).style.visibility="visible";
	hover(over);
	window.clearTimeout(timeOn)
}

function hide(menu, over){
	currentMenu=menu;
	timeOn=window.setTimeout("hideMenu()", 2000);
	unhover(over);
}

function hideMenu(){
document.getElementById(currentMenu).style.visibility="hidden";
}


var pause=2000;
var n=0;
var pics= new Array("slideshow_1.jpg", "slideshow_2.jpg", "slideshow_3.jpg");
var full_url = new Array();
//Pass the folder containing the 3 images as the argument
function loadSlideshow(folder){
	var preload = new Array();
	for(var i=0;i<3;i++){
		preload[i] = new Image();
		preload[i].src=IMAGE_DIR+folder+"/"+pics[i];
		full_url[i] = IMAGE_DIR+folder+"/"+pics[i];
	}
	slide();
}

function slide(){
	document.getElementById("slideshow").src=full_url[n];
	(n==(pics.length-1))?n=0:n++;
	setTimeout("slide()", pause);
}


/***** Planner ****/

function addPlan(name){
window.open("http://localhost/websites/easyoztravels/planner.php?add="+name, "", "directories=no, height=400, width=300, location=no, menubar=no, resizable=no, scrollbars=no, status=no, toolbar=no")
}