<!--
// JavaScript Document
//========== validare formular adaugare produs =============//
function validare_new_firma_web(form){
	
	
	if(form.firms_nume.value.length < 3){
		alert("Va rugam sa completati numele firmei...");
		form.firms_nume.select(); 
		return false;
	}
	
	if(is_invalid_nume_produs(form.firms_nume.value) == false)
		{
		alert("Numele nu trebuie sa contina caractere speciala ca: + &");
		form.firms_nume.select(); 
		return false;
	}
	
	
	return true;
}

function validare_new_download(form){
	
	if(document.getElementById("nume_ro").value.length<3) {
		alert("Va rugam sa completati numele ...");
		return false;
	}
	
	if(is_invalid_nume_produs(document.getElementById("nume_ro").value) == false)
		{
		alert("Numele nu trebuie sa contina caractere speciala ca: + &");
		return false;
	}
	
	if(document.getElementById("nume_en").value.length > 0) {
		if(is_invalid_nume_produs(document.getElementById("nume_en").value) == false)
		{
			alert("Numele nu trebuie sa contina caractere speciala ca: + &");
			return false;
		}	
	}
	
	if(document.getElementById("url").value.length<3) {
		alert("Va rugam sa completati url-ul ...");
		return false;
	}
	
	return true;	
	
}

///////////////////////
function is_invalid_nume_produs(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "&+";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) >= 0 )
         {
         blnResult = false;
         }
      }
   return blnResult;
}


//---validare form adaugare firma ---///
function validare_new_isp(form)
{

	if(form.firms_nume.value.length == 0)
	{
		alert("N-ati completat numele ISP - ului");
		form.firms_nume.select();
		return false;
	}
	if( verifica_email() == false ||  form.firms_email.value.length == 0){
		alert("Introduceti o adresa de mail valida");
		form.firms_email.select();
		return false;
	}
	
	return true;

}


////////////////////////////////////////////////////
function checkemail()
{
var str=document.dsl.firms_email.value;
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
testresults=true;
else{

testresults=false;
}
return (testresults)
}

function verifica_email(){
if (document.layers||document.getElementById||document.all)
return checkemail()
else
return true
}

function is_numeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = ".0123456789";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
}




//--> 
