function open_fereastra(cale,x,y){
        eval("window.open('"+cale+"','','height='+y+',width='+x+',type=fullWindow,alwaysLowered=0,alwaysRaised=1,channelmode=0,dependent=0,directories=0,fullscreen=0,hotkeys=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,titlebar=0,toolbar=0, z-lock=1,screenX=0,screeny=0,left=10,top=50,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,fullscreen=no')");
}

function echeck(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		var bun=true; 
		
		if (str.indexOf(at)==-1){
		   bun=false
		}
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   bun=false
		}
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    bun=false
		}
		 if (str.indexOf(at,(lat+1))!=-1){
		    bun=false
		 }
		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    bun=false
		 }
		 if (str.indexOf(dot,(lat+2))==-1){
		    bun=false
		 }
		 if (str.indexOf(" ")!=-1){
		    bun=false
		 }
 		 return bun	;}


 


/*** DHTML phone number validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/) */

// Declaring required variables
var digits = "0123456789";
var phoneNumberDelimiters = "()-. "; // non-digit characters which are allowed in phone numbers
var validWorldPhoneChars = phoneNumberDelimiters + "+"; // characters which are allowed in international phone numbers  // (a leading + is OK)
var minDigitsInIPhoneNumber = 10; // Minimum no of digits in an international phone no.

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    { // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    return true; // All characters are numbers.
}
function trim(s)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not a whitespace, append to returnString.
    for (i = 0; i < s.length; i++)
    { // Check that current character isn't whitespace.
        var c = s.charAt(i);  if (c != " ") returnString += c;
    }
    return returnString;
}
function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {// Check that current character isn't whitespace.
        var c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function checkInternationalPhone(strPhone){
var bracket=3
strPhone=trim(strPhone)
if(strPhone.indexOf("+")>1) return false
if(strPhone.indexOf("-")!=-1)bracket=bracket+1
if(strPhone.indexOf("(")!=-1 && strPhone.indexOf("(")>bracket)return false
var brchr=strPhone.indexOf("(")
if(strPhone.indexOf("(")!=-1 && strPhone.charAt(brchr+2)!=")")return false
if(strPhone.indexOf("(")==-1 && strPhone.indexOf(")")!=-1)return false
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

 
 

function verificare_trimite_mesaj_oferta(_f){
         var eroare="";
         
         if(_f.txt_mail.value!=""){
			 err= echeck(_f.txt_mail.value);
	         if(err==false) {eroare="ATENTIE: Campul EMAIL nu a fost completat corect!";_f.txt_mail.focus();}
         }
        
         if (checkInternationalPhone(_f.area_telefon.value)==false){
			eroare="ATENTIE: Campul TELEFON nu a fost completat corect!" 
			_f.area_telefon.focus();
		 }
         if( (_f.area_telefon.value=="") || (_f.area_telefon.value==null) ){
          eroare="ATENTIE: Campul TELEFON nu a fost completat !"
          _f.area_telefon.focus();
         }
         
         if(_f.area_prenume.value==""){
          eroare="ATENTIE: Campul PRENUME nu a fost completat !"
          _f.area_prenume.focus();
         }
         if(_f.area_nume.value==""){
          eroare="ATENTIE: Campul NUME nu a fost completat !"
          _f.area_nume.focus();
         }

         if(eroare=="") return true
         else{
              alert(eroare);
              return false
         }
}

