
function echeck(str) {
	/*check for valid e_mail------------------------------------------------------------------------------------*/
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){return false}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){return false}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){return false}
	if (str.indexOf(at,(lat+1))!=-1){return false}
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){return false}
	if (str.indexOf(dot,(lat+2))==-1){return false}
	if (str.indexOf(" ")!=-1){return false}

return true
} 
/*------------------------------------------------------------------------------------*/
function s_e_mail(ap_n){
  if(!(ap_n >0)){ap_n = 0;}
  if (document.f_mail.firstname.value==0 ){		 
		 alert('Please fill field "First name"');
         document.f_mail.firstname.focus();	
		 return false
	}

  if (document.f_mail.lastname.value==0){		 
		 alert('Please fill field "Last name"');
         document.f_mail.lastname.focus();	
		 return false
	}
   
	/*if ((document.f_mail.email.value==null || document.f_mail.email.value=="") ){			
		 alert('Please fill field "E-mail"');
		 document.f_mail.email.focus();	
		 return false
	}
    if (echeck(document.f_mail.email.value)==false){
		alert('E-mail is incorect.');
		document.f_mail.email.value="";
		document.f_mail.email.focus();			
		return false
		}  
	if (document.f_mail.phone.value==0 ){		 
		 alert('Please fill field "Phone"');
		 document.f_mail.phone.focus();			
		 return false
	}	*/    
	xajax_xa_send(document.f_mail.firstname.value,document.f_mail.lastname.value,document.f_mail.email.value,document.f_mail.phone.value,document.f_mail.comments.value,document.f_mail.title.value,ap_n);			
	return true;
}

