
function validateEmail(email) {
	var matches = email.match(/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/);
	return (matches != null && email == matches[0]);
}
function strTrim(str){
  str=str.replace(/(^\s*)|(\s*$)/g, "");
  if (str.length==0){
    return false;
  }
  return true;
} 
 
function checkForm(){
  if(!strTrim(document.all['FromName'].value) || !validateEmail(document.all['email'].value) ||  !validateEmail(document.all['to'].value)){
    alert(' *Please fill in all mandatory fields and correct Email address');
    return false;
  }   
return true;
}

function SendContactForm(formname)
{
	
	if (document.getElementById("FirstName").value=="")
	{
			alert('Please fill in First Name');
			document.getElementById("FirstName").focus();		
			return;
	}
	else if (document.getElementById("LastName").value=="")
	{
			alert('Please fill in Last Name');
			document.getElementById("LastName").focus();		
			return;
	}
	else if (document.getElementById("JobTitle").value=="")
	{
			alert('Please fill in Job Title');
			document.getElementById("JobTitle").focus();		
			return;
	}
	else if (document.getElementById("Company").value=="")
	{
			alert('Please fill in Company');
			document.getElementById("Company").focus();		
			return;
	}
	else if (document.getElementById("OrganizationType").value=="")
	{
			alert('Please choose an OrganizationType');
			document.getElementById("OrganizationType").focus();		
			return;
	}
	
	if (document.getElementById("Email").value=="")
	{
			alert('Please fill in Email Address');
			document.getElementById("Email").focus();		
			return;
	}	
		else if((document.getElementById("Email").value).match(/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/)==null)	
		{
		alert('Please fill in correct Email');
			document.getElementById("Email").focus();		
			return;
		}
	if (document.getElementById("Country").value=="")
	{
			alert('Please choose a country');
			document.getElementById("Country").focus();		
			return;
	}
		
	else
	{
		//alert(document.getElementById("Country").value);
		//alert ('xxx');
		eval("document.forms['"+formname+"'].submit()");
	}
}
function chk_right_contact(){
if(document.getElementById("ContactName").value==""){
alert("Please fill in your name");
return false;
}
if(!validateEmail(document.getElementById("ContactEmail").value)){
alert("Please fill in a valid mail address");
return false;
}
return true;
}
function clearRightForm(){
document.getElementById("ContactName").value="";
document.getElementById("ContactEmail").value="";
document.getElementById("right_message").value="";

}




