// Copyright 2006-2007 javascript-array.com

var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose; 


function CheckForm () { 
    var errorMsg = "";
	if (document.frmEnquiry.name.value == ""){
		errorMsg += "\nName \t\t- Enter your name";	
	}
	if (document.frmEnquiry.phone.value == ""){
		errorMsg += "\nPhone \t\t- Enter your phone number";	
	}
	if (document.frmEnquiry.enquiry.value == ""){
		errorMsg += "\nEnquiry \t\t- Enter an enquiry";	
	}
	if ((document.frmEnquiry.email.value == "") || (document.frmEnquiry.email.value.length > 0 && (document.frmEnquiry.email.value.indexOf("@",0) == - 1 || document.frmEnquiry.email.value.indexOf(".",0) == - 1))) { 
		errorMsg += "\nE-mail Address \t- Enter your valid e-mail address";
	}
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "Your enquiry has not been sent because there are problem(s) with the form.\n";
		msg += "Please correct the problem(s) and re-submit the form.\n";
		msg += "______________________________________________________________\n\n";
		msg += "The following field(s) need to be corrected: -\n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}
function CheckForm2 () { 
    var errorMsg = "";
	if (document.frmEnquiry.name.value == ""){
		errorMsg += "\nName \t\t- Enter your name";	
	}
	if ((document.frmEnquiry.email.value == "") || (document.frmEnquiry.email.value.length > 0 && (document.frmEnquiry.email.value.indexOf("@",0) == - 1 || document.frmEnquiry.email.value.indexOf(".",0) == - 1))) { 
		errorMsg += "\nE-mail Address \t- Enter your valid e-mail address";
	}
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "Your request has not been sent because there are problem(s) with the form.\n";
		msg += "Please correct the problem(s) and re-submit the form.\n";
		msg += "______________________________________________________________\n\n";
		msg += "The following field(s) need to be corrected: -\n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}
function CheckForm3 () { 
    var errorMsg = "";
	if (document.frmEnquiry.enquiry.value == ""){
		errorMsg += "\nComments \t\t- Please enter your comments";	
	}
	if ((document.frmEnquiry.email.value == "") || (document.frmEnquiry.email.value.length > 0 && (document.frmEnquiry.email.value.indexOf("@",0) == - 1 || document.frmEnquiry.email.value.indexOf(".",0) == - 1))) { 
		errorMsg += "\nE-mail Address \t- Enter your valid e-mail address";
	}
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "Your request has not been sent because there are problem(s) with the form.\n";
		msg += "Please correct the problem(s) and re-submit the form.\n";
		msg += "______________________________________________________________\n\n";
		msg += "The following field(s) need to be corrected: -\n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}
function CheckForm4 () { 
    var errorMsg = "";
	if ((document.frmEnquiry1.email.value == "") || (document.frmEnquiry1.email.value.length > 0 && (document.frmEnquiry1.email.value.indexOf("@",0) == - 1 || document.frmEnquiry1.email.value.indexOf(".",0) == - 1))) { 
		errorMsg += "\nE-mail Address \t- Enter a valid e-mail address";
	}
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "Your request has not been sent because there are problem(s) with the form.\n";
		msg += "Please correct the problem(s) and re-submit the form.\n";
		msg += "______________________________________________________________\n\n";
		msg += "The following field(s) need to be corrected: -\n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}
