/*************************/
function isEMailAddr(elem) {
	var str = elem.value;
	var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
	if (!str.match(re)) {
		alert("Verificati adresa de email introdusa.");
		elem.focus();
		return false;
	} else {
		return true;
	}
}
/*********************/
function validate_form(frm){
//validate the nume
/*********************************************/
    if(frm.nume.value=='')
         {
           alert("Va rugam sa va introduceti numele si prenumele...");
           frm.nume.focus();
           return false;
         } //end if
//validate the email
/*********************************************/
   if (frm.txt_email.value!=''){
     if(!isEMailAddr(frm.txt_email)){
		return false;
	}
     }
	

/*
   if(frm.txt_email.value=='')
         {
           alert("Va rugam sa introduceti adresa de email la care puteti fi contactati...");
           frm.txt_email.focus();
           return false;
         } //end if

	//validate the email address
	if(!isEMailAddr(frm.txt_email)){
		return false;
	}
*/	
if(frm.telefon.value=='')
         {
           alert("Va rugam sa introduceti un telefon la care puteti fi contactati...");
           frm.telefon.focus();
           return false;
         } //end if
if(frm.interes.selectedIndex == 0)
         {
           alert("Va rugam selectati o optiune...");
           frm.interes.focus();
           return false;
         } //end if
/*
if(frm.mesaj.value=='')
         {
           alert("Va rugam sa introduceti un mesaj...");
           frm.mesaj.focus();
           return false;
         } //end if
*/
/*********************************************/
return true;
}// end function validate_form


function validate_form_cerere(frm){
		//validate the nume_prenume
		//*********************************************
		if(frm.nume_prenume.value=='')
		{
			alert("Va rugam sa va introduceti numele si prenumele...");
			frm.nume_prenume.focus();
			return false;
		} //end if
		//*********************************************
		
		//validate the firma
		//*********************************************
		if(frm.nume_firma.value=='')
		{
			alert("Va rugam sa introduceti numele companiei...");
			frm.nume_firma.focus();
			return false;
		} //end if
		//*********************************************
		
		//validate the telefon
		//*********************************************
		if(frm.telefon.value=='')
		{
			alert("Va rugam sa introduceti un telefon la care puteti fi contactati...");
			frm.telefon.focus();
			return false;
		} //end if
		//*********************************************
		//validate the email
		//*********************************************
			if(frm.txt_email.value=='')
				 {
				   alert("Va rugam sa introduceti adresa de email la care puteti fi contactati...");
				   frm.txt_email.focus();
				   return false;
				 } //end if
		
			//validate the email address
			if(!isEMailAddr(frm.txt_email)){
				return false;
			}
			
		//validate the estimare buget
		//*********************************************
		if(frm.estimare_buget.value=='')
		{
			alert("Va rugam sa introduceti bugetul estimat...");
			frm.estimare_buget.focus();
			return false;
		} //end if
	
	return true;
}// end function validate_form_cerere



