function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
} }



//drop down menu start

var myMenuID = "blank";
var myTimeID = "0";
var mySubMenuID = "blank";
var mySubTimeID = "0";

/*
if(myMenuID != "blank"){
		window.clearTimeout(myTimeID);
		hideSubMenu();
	}
	*/


function buttonOver(menuID){
	//Forcefully hide any sub sub
	if(mySubMenuID != "blank"){
		window.clearTimeout(mySubTimeID);
		hideSubSubMenu();
	}
	
	//forcefully hide any pending hide
	if(myMenuID != "blank"){
		window.clearTimeout(myTimeID);
		hideSubMenu();
	}
	
	myMenuID = menuID;
	showSubMenu();
}



function buttonOut(menuID){	
	myTimeID = setTimeout("hideSubMenu()", 200);
}

function menuOver(menuID){
	window.clearTimeout(myTimeID);
}

function menuOut(menuID){
	myMenuID = menuID;
	myTimeID = setTimeout("hideSubMenu()", 200);
}

function clearMenuTimeout(){
	window.clearTimeout(myTimeID);
	myTimeID = "0"
}

function showSubMenu(){
	obj = MM_findObj(myMenuID);
	if (!obj) return; obj.style.display = 'block';
    // iframe
	obj = MM_findObj('i'+myMenuID);
	if (obj) obj.style.display = 'block';
    // a link rollover
	obj = MM_findObj(myMenuID+'Button');
	if (obj) obj.className = 'over';
}

function hideSubMenu(){
	obj = MM_findObj(myMenuID);
	if (!obj) return; obj.style.display = 'none';
    // iframe
	obj = MM_findObj('i'+myMenuID);
	if (obj) obj.style.display = 'none';
    // a link rollover
	obj = MM_findObj(myMenuID+'Button');
	if (obj) obj.className = '';
}

function hideSubSubMenu(){
    obj2 = MM_findObj(mySubMenuID)
	if (!obj2) return; obj2.style.display = 'none';
}

function showDiv(myId) {
	obj = MM_findObj(myId);
	if (!obj) return; obj.style.display = 'block';
}

function hideDiv(myId) {
	obj = MM_findObj(myId);
	if (!obj) return; obj.style.display = 'none';
}



//Sub Menus
function subButtonOver(menuID){
	//keep parent menu open
	window.clearTimeout(mySubTimeID);
	window.clearTimeout(myTimeID);
}

function subButtonClick(menuID){
	//forcefully close other menu
	if(mySubMenuID != "blank"){
		window.clearTimeout(mySubTimeID);
		hideSubSubMenu();
	}

	mySubMenuID = menuID;
	showSubSubMenu();
}

function subButtonOut(menuID){
	myTimeID = setTimeout("hideSubMenu()", 200);
}


function showSubSubMenu(){
	obj = MM_findObj(mySubMenuID);
	if (!obj) return; obj.style.display = 'block';
}

function subMenuOver(menuID){
	window.clearTimeout(mySubTimeID);
	window.clearTimeout(myTimeID);
}

function subMenuOut(menuId, subMenuId){
	mySubMenuID = subMenuId;
	mySubTimeID = setTimeout("hideSubSubMenu()", 200);
	menuOut(menuId);
}

//drop down menu end

//show/hide container for travel basket page start

var amID = "blank";

function showContainer(containerId){
	if(amID != "blank")
		hideMe(amID);

	if(amID != containerId)
	    showMe(containerId);
    
    if(amID == containerId)
        amID = "blank";
    else
    	amID = containerId;
}

function showMe(containerId){
	obj = MM_findObj(containerId);

	if (!obj) return;

	obj.style.display = 'block';
}

function hideMe(containerId){
	obj2 = MM_findObj(containerId)

	if (!obj2) return;

	obj2.style.display = 'none';
}

//show/hide container for travel basket page end

//clearing form fields start

function ClearInput(value, id){ // This calls our function ClearInput, and the two variables we will need for it to function the original value and the id.

var input = document.getElementById(id); // Gets the input field based on its id.

	if(value == input.value){ // If the default value is equal to the current value.
		input.value = ''; // Empty It.
	}
	
	else{ // Else the value is not equal to the current input field value.
		input.value = input.value; // Leave it the same.
	} // End Else.
} // Close Function.

//clearing form fields end