function ValidateNo(NumStr, String)
		{
    for(var Idx=0; Idx<NumStr.length; Idx++)
    {
        var Char = NumStr.charAt(Idx);
        var Match = false;

        for(var Idx1=0; Idx1<String.length; Idx1++)
        {
            if(Char == String.charAt (Idx1))
                Match = true;
        }

        if (!Match)
            return false;
    }
    return true;
	} 
	
	
  function validEmail(email) {
    invalidChars = " /:,;�?בגדהוזחטיכ�?�?נסעפצקרשת";         
    if (email == "") {// cannot be empty
      return false
    }
    for (i=0; i<invalidChars.length; i++) { // does it contain any invalid characters?
      badChar = invalidChars.charAt(i)
      if (email.indexOf(badChar,0) > -1) {
        return false
      }
    }
    atPos = email.indexOf("@",1)            // there must be one "@" symbol
    if (atPos == -1) {
      return false
    }
    if (email.indexOf("@",atPos+1) != -1) { // and only one "@" symbol
      return false
    }
    periodPos = email.indexOf(".",atPos)
    if (periodPos == -1) {                  // and at least one "." after the "@"
      return false
    }
    if (periodPos+3 > email.length) {       // must be at least 2 characters after the "."
      return false
    }
    return true
  }
    
  function validate(){
    str="";
    strN=""
    flag=true
    focos=0;

    
    if((document.formi.phone.value.length<2)){
      flag=false
      str=str+err_arr['phone_empty']+"<br>"
      if (focos==0) {document.formi.phone.focus();focos=1 }
      //return false;
    } 
     	
	if(!ValidateNo(document.formi.phone.value,"1234567890+- "))
    {
    	flag=false
    	str=str+err_arr['phone_invalid']+"<br>"
    	if (focos==0) {document.formi.phone.focus();focos=1 }
    }
    
	if(!ValidateNo(document.formi.fax.value,"1234567890+- "))
    {
    	flag=false
    	str=str+err_arr['fax_invalid']+"<br>"
    	if (focos==0) {document.formi.fax.focus();focos=1 }
    }
            
    if((document.formi.fname.value.length<2)){
      flag=false
      str=str+err_arr['fname']+"<br>"
      if (focos==0) {document.formi.fname.focus();focos=1 }
      //return false;
    }

    if((document.formi.lname.value.length<2)){
      flag=false
      str=str +err_arr['lname']+"<br>"
      if (focos==0) {document.formi.lname.focus();focos=1 }
      //return false;
    }
    if((document.formi.email.value.length==0)){
      flag=false
      str=str + err_arr['email_empty']+"<br>"
      if (focos==0) {document.formi.email.focus();focos=1 }
      //return false; 
    }
    if (!validEmail(document.formi.email.value) && (document.formi.email.value!="")) {
      str=str + err_arr['email_invalid']+"<br>";
      flag=false;
      if (focos==0) {document.formi.email.focus();focos=1 }
      //return false
    }

	var comfList = document.forms['formi'].elements['inter[]'];
	var bool = false;
	if (comfList.length) {
         for (var i=0; i < comfList.length; i++)
         if(comfList[i].checked==true)
            bool=true;
    }    

    if (bool==false) {
      str=str + err_arr['inter_invalid']+"<br>";
      flag=false;
      //return false
    }
    
    
    if(flag==true){
			return true;
    } else {
      if (document.layers) {
        document.layers['contactalert'].document.close();
        document.layers['contactalert'].document.write(str);
        document.layers['contactalert'].document.close();       
      } else {
        if (document.all) {
          document.all.contactalert.innerHTML = str;
        } else {
          document.getElementById('contactalert').innerHTML = str;
        }
      }   
      return false;
    }
  }
