function validate_form( )
{
	 valid = true;

    if ((document.contact_form.XXDESXXFirstname.value == "")||(document.contact_form.XXDESXXLastname.value == "")||(document.contact_form.XXDESXXPhone.value == "")||(document.contact_form.XXDESXXEmail.value == ""))
    {
        alert ("Please fill in the required fields.");
        valid = false;
    }
    
    validEmail = validateEmailAdd();
    if(!validEmail)
    valid = false;

    return valid;
}

function validateEmailAdd(){
	if(document.contact_form.XXDESXXEmail.value.length >0) {
		if(document.contact_form.XXDESXXEmail.value.match(/^\w+(['\.\-\+]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/) == null){
		  alert('Not a valid email address');
		  return false;
		}
	}
	validatefreeAdd();

	return true;
}

function validate_Notessa_form( )
{
	 valid = true;

    if ((document.freetrialform.firstName.value == "")||(document.freetrialform.lastName.value == "")||(document.freetrialform.company.value == "")||(document.freetrialform.emailAddress_email.value == "")||(document.freetrialform.telephone_phoneNumber.value == "")||(document.freetrialform.country_id.selectedIndex == null))
    {
        alert ("Please fill in the required fields.");
        valid = false;
    }
    
    validEmail = validateNotessaEmailAdd();
    if(!validEmail)
    valid = false;

   /* validEmail2 = validatefreeEmailAdd();
    if(!validEmail2)
    valid = false;*/
    if(document.freetrialform.notifiedOfEmail.value == "false"){
    	validEmail2 = validatefreeEmailAdd();
	if(!validEmail2)
    	valid = false;
    }

    return valid;
}

function validateNotessaEmailAdd(){
	var email = document.freetrialform.emailAddress_email.value;
	if(email.length >0) {
		if(email.match(/^\w+(['\.\-\+]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/) == null){
		  alert('Not a valid email address');
		  return false;
		}
	}
	return true;
}

function validatefreeEmailAdd(){
	var email = document.freetrialform.emailAddress_email.value;
	if(email.length >0) {
		if((email.match("@hotmail.com")!= null)||(email.match("@gmail.com")!= null)){
		  var answer = alert('Please enter a business email address as we do not give full access to our system with private emails such as gmail / hotmail.');
		  document.freetrialform.notifiedOfEmail.value = "true";
		  return false;
		  
		}
	}
	return true;
}

/*function validatefreeEmailAdd(){
	var email = document.freetrialform.emailAddress_email.value;
	if(email.length >0) {
		if((email.match("@hotmail.com")!= null)||(email.match("@gmail.com")!= null)){
		  var answer = confirm('Please enter a business email address as we do not give full access to our system with private emails such as gmail / hotmail. \n(Ok to continue, cancel to change email address)');
		  if(answer){
			return true;
		  }	
		  else{
	    	   //document.freetrialform.notifiedOfEmail.value = "true";
		   return false;
		  }
		}
	}
	return true;
}*/



