function echeck(str) 
{

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("E-mail not in correct format.")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("E-mail not in correct format.")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("E-mail not in correct format.")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("E-mail not in correct format.")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("E-mail not in correct format.")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("E-mail not in correct format.")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("E-mail not in correct format.")
		    return false
		 }

 		 return true					
 }

function CheckPhoneNumber(TheNumber) {
	var valid = 1
	var GoodChars = "0123456789()-+ "
	var i = 0
	//if (TheNumber=="") {
		// Return false if number is empty
		//valid = 0
	//}
	for (i =0; i <= TheNumber.length -1; i++) {
		if (GoodChars.indexOf(TheNumber.charAt(i)) == -1) {
 alert(TheNumber.charAt(i) + " is not valid in a phone number.")
			valid = 0
			return valid
} // End if statement
	} // End for loop
	return valid
}

function SubmitForm (theForm) 
{
var formOK = true;
//MM_validateForm('','','R','','','R','','','RisEmail')

	if(theForm.name.value == "")
	{
		alert("Please enter your name.");
return (false);
	}
	else if(theForm.company.value == "")
	{
		alert("Please enter your company name.");
return (false);
	}
	else if(theForm.position.value == "")
	{
		alert("Please enter your position.");
return (false);
	}
	else if(theForm.telephone.value == "")
	{
		alert("Please enter your telephone number.");
return (false);
	}
	else if(theForm.security_code.value == "")
	{
		alert("Please the security code for processing the form.");
return (false);
	}
var check=CheckPhoneNumber(theForm.telephone.value);
if (check== false)
	{
	return (false);
	}			
if (theForm.email.value) {
var check=echeck(theForm.email.value);
if (check== false)
	{
	return (false);
	}		
}
document.form1.submit();
}

