
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 validateTelepnone(Number){
    var stripped = Number.replace(/[\(\)\.\-\ ]/g, '');
//strip out acceptable non-numeric characters
//   if (isNaN(parseInt(stripped))){ 
	for (var i = 0; i< stripped.length; i++)
	{
		if (isNaN(parseInt(stripped.substr(i,1)))) 
		     return false;
    }	 
	var maxlength=9
	if (Number.length<maxlength){
	return false;
	}
	return true;
}
 
// function checkchars(cur){
//change max length to determine below
//var maxlength=9
//if (cur.chars.value.length<maxlength){
//return false
//}
//}

   

function checkForm(){
  if( !strTrim(document.all['First_Name'].value)) {
    alert(' First Name is Required Field');
	document.all['First_Name'].focus();
    return false;
  }
  if( !strTrim(document.all['Last_Name'].value)) {
    alert( 'Last Name is Required Field');
	document.all['First_Name'].focus();
    return false;
  }
  if( !strTrim(document.all['Company_Name'].value)) {
    alert(' Company Name is Required Field');
	document.all['First_Name'].focus();
    return false;
  }
  if( !strTrim(document.all['Job_Position'].value)) {
    alert(' Job Position is Required Field');
	document.all['First_Name'].focus();
    return false;
  }
  if(validateTelepnone(document.all['Telephone_No'].value)==false) {
    alert('Telephone Number in incorrect Format');
	document.all['Telephone_No'].focus();
    return false;
  }
  if(!validateEmail(document.all['Email'].value)) {
    alert('E-mail in incorrect Format');
	document.all['Email'].focus();
    return false;
  }
  if(!strTrim(document.all['Choose_Service'].options[document.all['Choose_Service'].selectedIndex].value)) {
    alert(' Please Choose Service Type');
	document.all['Choose_Service'].focus();
    return false;
  }
  if(!strTrim(document.all['Where_Did_You_Hearied_About_Us'].options[document.all['Where_Did_You_Hearied_About_Us'].selectedIndex].value)) {
    alert('aaa ');
	document.all['Choose_Service'].focus();
    return false;
  }
 document.ContactForm.submit();
  return true;
}

function checkFormINAction(){
  if( !strTrim(document.all['First_Name'].value)) {
    alert('First Name is Required Field');
	document.all['First_Name'].focus();
    return false;
  }
  if( !strTrim(document.all['Last_Name'].value)) {
    alert('Last Name is Required Field');
	document.all['First_Name'].focus();
    return false;
  }
  if( !strTrim(document.all['Company_Name'].value)) {
    alert('Last Name is Required Field');
	document.all['First_Name'].focus();
    return false;
  }
  if( !strTrim(document.all['Job_Position'].value)) {
    alert('Job Position is Required Field');
	document.all['First_Name'].focus();
    return false;
  }
  if(validateTelepnone(document.all['Telephone_No'].value)==false) {
    alert('Telephone Number in incorrect Format');
	document.all['Telephone_No'].focus();
    return false;
  }
  if(!validateEmail(document.all['Email'].value)) {
    alert('דואר אלקטרוני שגוי');
	document.all['Email'].focus();
    return false;
  }
   
 document.ContactForm.submit();
  return true;
}


function checkFormRight()
{
if( !strTrim(document.all['First_Name'].value)) {
    alert(' First Name is Required Field');
	document.all['First_Name'].focus();
    return false;
  }
if(validateTelepnone(document.all['Telephone_No'].value)==false) {
   alert('Telephone Number in incorrect Format');
   document.all['Telephone_No'].focus();
   return false;
  }
   if(!validateEmail(document.all['Email'].value)) {
    alert('E-mail in incorrect Format');
	document.all['Email'].focus();
    return false;
  }
  
  document.ContactFormRIGHT.submit();
  return true;
}


function TestDataCheck(){
	
	

  if( !strTrim(document.all['first_name'].value)) {
    alert(' First Name is Required Field');
	document.all['first_name'].focus();
    return false;
  }
  if( !strTrim(document.all['last_name'].value)) {
    alert( 'Last Name is Required Field');
	document.all['last_name'].focus();
    return false;
  }
  if( !strTrim(document.all['company'].value)) {
    alert(' Company Name is Required Field');
	document.all['company'].focus();
    return false;
  }
  if( !strTrim(document.all['title'].value)) {
    alert(' Job Position is Required Field');
	document.all['title'].focus();
    return false;
  }
  if(validateTelepnone(document.all['phone'].value)==false) {
    alert('Telephone Number in incorrect Format');
	document.all['phone'].focus();
    return false;
  }
  if(!validateEmail(document.all['email'].value)) {
    alert('E-mail in incorrect Format');
	document.all['email'].focus();
    return false;
  }
  if(!strTrim(document.all['00N20000001ykuw'].options[document.all['00N20000001ykuw'].selectedIndex].value)) {
    alert(' Please Choose Service Type');
	document.all['00N20000001ykuw'].focus();
    return false;
  }
  if(!strTrim(document.all['00N20000001ykv6'].options[document.all['00N20000001ykv6'].selectedIndex].value)) {
    alert(' Please Choose Service Type');
	document.all['00N20000001ykv6'].focus();
    return false;
  }

  return true;
}




function TestDataCheckFormRight(){
	
	

  if( !strTrim(document.all['first_name'].value)) {
    alert(' First Name is Required Field');
	document.all['first_name'].focus();
    return false;
  }
  if(validateTelepnone(document.all['phone'].value)==false) {
    alert('Telephone Number in incorrect Format');
	document.all['phone'].focus();
    return false;
  }
  if(!validateEmail(document.all['email'].value)) {
    alert('E-mail in incorrect Format');
	document.all['email'].focus();
    return false;
  }
  if(!strTrim(document.all['00N20000001ykuw'].options[document.all['00N20000001ykuw'].selectedIndex].value)) {
    alert(' Please Choose Service Type');
	document.all['00N20000001ykuw'].focus();
    return false;
  }

  return true;
}