function check()
{ 
	//with (document.myform) 
	{
		if (document.myform.txtName.value=="")
		{
		alert ('Въведете име!');
        return false;
		}
		else if (document.myform.txtPhone.value=="")
		{
		alert ('Въведете телефон!');
        return false;
		}
		else if (isPhone(document.myform.txtPhone, 'Въведете телефон!')==false) {
			return false;
		}		
		else if (document.myform.txtEmail.value=="")
		{
		alert ('Въведете e-mail!');
        return false;
		}
		else if(validateEmailv2(document.myform.txtEmail.value)==false)
		{ 
		     strError = "Въведете валиден e-mail! ";               
			 alert(strError); 
			 return false; 
		}
		else if (document.myform.txtZapitvane.value=="")
		{
		alert ('Въведете запитване!');
        return false;
		}
	
function isPhone(elem, helperMsg){
	//var alphaExp = /^[a-zA-Z]+$/;
	var alphaExp = /^[ 1234567890\/()+]+$/;
	if(elem.value.match(alphaExp) ){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}
	
function validateEmailv2(email)
{
// a very simple email validation checking. 
// you can add more complex email checking if it helps 
    if(email.length <= 0)
	{
	  return true;
	}
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) return false;
    if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) return false;
    }
    if(splitted[2] != null)
    {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) 
      {
	    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null) return false;
      }// if
      return true;
    }
return false;
}


	}
}
