

function checkmailform(){
	var oName = document.forms.newsletterform.Name;
	if( oName.value == null || oName.value.length < 2 || oName.value == "Your Name *" ) {
		alert("Please Input Your Name");
		oName.focus();
		return false;

	}else{
		var p_email;
		p_email = document.forms.newsletterform.Email.value.toString();
		if (p_email != "") {
			t = p_email.indexOf("@");
			if((p_email.indexOf(".") == -1) || (t == -1) || (t < 1) || (t > p_email.length - 5) || (p_email.charAt(t - 1) == '.') || (p_email.charAt(t + 1) == '.')) {
				alert("Email Address Is Wrong.");
				document.forms.newsletterform.Email.focus();
				return false;
			}
		}else{
			alert("Email Address Is Wrong.");
			document.forms.newsletterform.Email.focus();
			return false;
		}
	}
	return true;
}

// use this function for brochure
function brocheckmailform()
{
	var oName = document.forms.brochureform.Name;
	if( oName.value == null || oName.value.length < 2 || oName.value == "Your Name *" )
			{
			alert("Please Input Your Name");
			oName.focus();
			return false;
			}
		else
			{
			var p_email;
			p_email = document.forms.brochureform.Email.value.toString();
			if (p_email != "")
				{
				t = p_email.indexOf("@");
				if((p_email.indexOf(".") == -1) || (t == -1) || (t < 1) || (t > p_email.length - 5) || (p_email.charAt(t - 1) == '.') || (p_email.charAt(t + 1) == '.'))
					{
					alert("Email Address is Wrong");
					document.forms.brochureform.Email.focus();
					return false;
					}
				}
			else
				{
				alert("Email Address Is Wrong");
				document.forms.brochureform.Email.focus();
				return false;
				}
//add
			var NewCount = 0
			var myform = document.forms.brochureform;
			if (myform.MetroArt.checked)
			{NewCount = NewCount + 1}
			
			if (myform.MetroCabin.checked)
				{NewCount = NewCount + 1}
				
			if (myform.MetroCabin1.checked)
				{NewCount = NewCount + 1}

			if (myform.MetroPlay.checked)
				{NewCount = NewCount + 1}

			if (myform.Shedusa.checked)
				{NewCount = NewCount + 1}

			if (myform.Sheduk.checked)
				{NewCount = NewCount + 1}

			if (myform.MetroShip.checked)
				{NewCount = NewCount + 1}
				
			if {myform.MetroDemoSale.checked)
				 (NewCount = NewCount + 1)

			if (NewCount == 0)
				{
				alert('Please Check One(1) Or More Boxes')
				myform.MetroArt.focus(); return false;
				}
//add	
			}
	return true;
}



//use for main form validation
function checkContactForm(){
	var oName = document.forms.mainform.Name;
	if( oName.value == null || oName.value.length < 2 || oName.value == "Your Name *" ) {
		alert("Please Input Your Name");
		oName.focus();
		return false;
	}else{
		var p_email;
		p_email = document.forms.mainform.Email.value.toString();
		if (p_email != "") {
			t = p_email.indexOf("@");
			if((p_email.indexOf(".") == -1) || (t == -1) || (t < 1) || (t > p_email.length - 5) || (p_email.charAt(t - 1) == '.') || (p_email.charAt(t + 1) == '.')) {
				alert("Email Address Is Wrong.");
				document.forms.mainform.Email.focus();
				return false;
			}
		}else{
			alert("Email Address Is Wrong");
			document.forms.mainform.Email.focus();
			return false;
		}

		var reg = /^\d{3}\-\d{3}\-\d{4}$/ ;
		var p_homephone;
		p_homephone = document.forms.mainform.MTelephone.value.toString();				
		if (!reg.test(p_homephone) ){		
			alert("Please Input Phone in Format ###-###-####.");
			document.forms.mainform.MTelephone.focus();
			return false;
		}	



	}
	return true;

}



