function ChkEmail(frmName,strEmail)
{
	var re;
	var FormName;
	var FldName;
	FormName=frmName;
	FldName=strEmail;
	re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/;
	var str=eval("document."+FormName+"."+FldName+".value");
	if (re.test(str) == false)
	{
	alert("That is not a valid Email address. Please enter again. ");
	eval("document."+FormName+"."+FldName+".focus()");
	eval("document."+FormName+"."+FldName+".select()");
	return false;
	}
}

function validate_contact()
{
	var f_name=document.frmContact.f_name.value;
	var l_name=document.frmContact.l_name.value;
	var email=document.frmContact.email.value;
	var password=document.frmContact.password.value;
	 
	
	/*alert("Length:"+a.length);*/
	
	if(f_name=="")
	{
		alert("Select your first name");
		document.frmContact.f_name.focus();
		return false;
	}
	if(l_name=="")
	{
		alert("Select your last name");
		document.frmContact.l_name.focus();
		return false;
	}
	if(email=="")
	{
		alert("Please enter your e-mail address");
		document.frmContact.email.focus();
		return false;
	
	}
	if(ChkEmail('frmContact','email')==false)
	{
		return false;
	}
	if(password=="")
	{
		alert("Select your password");
		document.frmContact.password.focus();
		return false;
	}
	 
  	return true;
}	





//*********************************************
// Function that Shows an HTML element
//*********************************************
function showDiv(divID)
{
	var div = document.getElementById(divID);
	div.style.display = ""; //display div
}

//*********************************************
// Function that Hides an HTML element
//*********************************************
function hideDiv(divID)
{
	var div = document.getElementById(divID);
	div.style.display = "none"; // hide
}
//*****************************************************************************
// Function that Hides all the Div elements in the select menu Value
//*****************************************************************************
function hideAllDivs()
{
	//Loop through the seclect menu values and hide all
	var selectMenu = document.getElementById("selectMenu");
	for (var i=0; i<=selectMenu.options.length -1; i++)
	{
		hideDiv(selectMenu.options[i].value);
	}
}
//*********************************************
// Main function that calls others to toggle divs
//*********************************************
function toggle(showID)
{
	hideAllDivs(); // Hide all
	showDiv(showID); // Show the one we asked for

}
