
<!-- Begin


function emailCheck (emailStr) 
{
	/*
	ok1 = true
	ok2 = true
    ok3 = true
	ok4 = true
	ok5 = true
	ok6 = true
	*/
	/* The following pattern is used to check if the entered e-mail address
   fits the user@domain format.  It also is used to separate the username
   from the domain. */
	var emailPat=/^(.+)@(.+)$/
	/* The following string represents the pattern for matching all special
   characters.  We don't want to allow special characters in the address. 
   These characters include ( ) < @ , ; : \ " . [ ]    */
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	/* The following string represents the range of characters allowed in a 
   username or domainname.  It really states which chars aren't allowed. */
	var validChars="\[^\\s" + specialChars + "\]"
	/* The following pattern applies if the "user" is a quoted string (in
   which case, there are no rules about which characters are allowed
   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
   is a legal e-mail address. */
	var quotedUser="(\"[^\"]*\")"
	/* The following pattern applies for domains that are IP addresses,
   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
   e-mail address. NOTE: The square brackets are required. */
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	/* The following string represents an atom (basically a series of
   non-special characters.) */
	var atom=validChars + '+'
	/* The following string represents one word in the typical username.
   For example, in john.doe@somewhere.com, john and doe are words.
   Basically, a word is either an atom or quoted string. */
	var word="(" + atom + "|" + quotedUser + ")"
	// The following pattern describes the structure of the user
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	/* The following pattern describes the structure of a normal symbolic
   domain, as opposed to ipDomainPat, shown above. */
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


	/* Finally, let's start trying to figure out if the supplied address is
   valid. */

	/* Begin with the coarse pattern to simply break up user@domain into
   different pieces that are easy to analyze. */
	var matchArray=emailStr.match(emailPat)
	if (matchArray==null) 
	{
	  	/* Too many/few @'s or something; basically, this address doesn't
     	even fit the general mould of a valid e-mail address. */
		alert("Adresa de e-mail invalida!")
		return false
		//ok1=false
	}
	var user=matchArray[1]
	var domain=matchArray[2]

	// See if "user" is valid 
	if (user.match(userPat)==null) 
	{
    	// user is not valid
    	alert("Adresa de e-mail invalida!")
    	return false
		//ok2=false
	}

	/* if the e-mail address is at an IP address (as opposed to a symbolic
   host name) make sure the IP address is valid. */
	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) 
	{
    	// this is an IP address
		  for (var i=1;i<=4;i++) 
		  {
	    	if (IPArray[i]>255) 
			{
	        	alert("Adresa de e-mail invalida!")
				return false
				//ok3=false
	    	}			
	     }
    	return true
		//ok3=true
	}

	// Domain is symbolic name

	var domainArray=domain.match(domainPat)
	if (domainArray==null) 
	{
		alert("Adresa de e-mail invalida!")
    	return false
		//ok4=false
	}

	/* domain name seems valid, but now make sure that it ends in a
   three-letter word (like com, edu, gov) or a two-letter word,
   representing country (uk, nl), and that there's a hostname preceding 
   the domain or country. */

	/* Now we need to break up the domain to get a count of how many atoms
   it consists of. */
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>6) 
	{
   		// the address must end in a two letter or other TLD including museum
   		alert("Adresa de e-mail invalida!")
   		return false
		//ok5=false
	}

	// Make sure there's a host name preceding the domain.
	if (len<2) 
	{
   		var errStr="Adresa de e-mail invalida!"
	    alert(errStr)
   		return false
		//ok6=false
	}
   
	
	// If we've got this far, everything's valid!
	return true;
	
}

/* check campuri inscriere fotografi */

  function checkForm(form)
  {
    if(form.user.value == "") {
      alert("Error: Username cannot be blank!");
      form.user.focus();
      return false;
    }
    re = /^\w+$/;
    if(!re.test(form.user.value)) {
      alert("Error: Username must contain only letters, numbers and underscores!");
      form.user.focus();
      return false;
    }

    if(form.pwd1.value != "" && form.pwd1.value == form.pwd2.value) {
      if(form.pwd1.value.length < 6) {
        alert("Error: Password must contain at least six characters!");
        form.pwd1.focus();
        return false;
      }
      if(form.pwd1.value == form.username.value) {
        alert("Error: Password must be different from Username!");
        form.pwd1.focus();
        return false;
      }
      re = /[0-9]/;
      if(!re.test(form.pwd1.value)) {
        alert("Error: password must contain at least one number (0-9)!");
        form.pwd1.focus();
        return false;
      }
      re = /[a-z]/;
      if(!re.test(form.pwd1.value)) {
        alert("Error: password must contain at least one lowercase letter (a-z)!");
        form.pwd1.focus();
        return false;
      }
      re = /[A-Z]/;
      if(!re.test(form.pwd1.value)) {
        alert("Error: password must contain at least one uppercase letter (A-Z)!");
        form.pwd1.focus();
        return false;
      }
    } else {
      alert("Error: Please check that you've entered and confirmed your password!");
      form.pwd1.focus();
      return false;
    }

    alert("You entered a valid password: " + form.pwd1.value);
    return true;
  }


function checkInscriere()
{
	var x=document.form_add;
	var stringEroare = "";
	
	oku = true;
	okp = true;
	okvp = true;
	
	okn = true;
	okl = true;
	oke = true;
	emailStr = x.email.value;	
	
	okt = true;
	okw = true;
	okpo = true;
	
	//user name
	if (x.user.value == "" ||  !/^[a-z()+ A-Z()+ 0-9()+ _() - ]*$/.test(x.user.value))
	{
		 stringEroare += "-user - se accepta numai: a-z   A-Z   0-9   _ <br>"
		 oku=false
	}
	else
	{
		if(x.user.value.length < 5)
		{
		 stringEroare += "-user - minim 5 caractere <br>"
		 oku=false			
		}
		
	}
	//parola
	if (x.parola.value == "" ||  !/^[a-z()+ A-Z()+ 0-9()+ _() - ]*$/.test(x.parola.value))
	{
		 stringEroare += "-parola - se accepta numai: a-z   A-Z   0-9   _ <br>"
		 okp=false
	}	
	else
	{
		if(x.parola.value.length < 6)
		{
		 stringEroare += "-parola - minim 6 caractere<br>"
		 okp=false			
		}
		else
		{
			if(x.parola.value == x.user.value)
			{
				 stringEroare += "-parola nu poate fi identica cu user<br>"
				 x.parola.focus();
				 okp=false					
			}
		}
	}
	if(x.reparola.value == "" || x.reparola.value != x.parola.value)
	{
		 stringEroare += "-confirmarea parolei verificati - daca ati reintrodus parola in campul dedicat <br>"
		 x.reparola.focus();
		 okvp=false		
	}
	//nume
	if (x.nume.value == "" ||  !/^[a-z()+ A-Z()-]*$/.test(x.nume.value))
	{
		 stringEroare += "-nume<br>"
		 x.nume.focus();
		 okn=false
	}	
	//localitate
	if (x.localitate.value == "" ||  !/^[a-z()+ A-Z()-]*$/.test(x.localitate.value))
	{
		 stringEroare += "-localitate<br>"
		 x.localitate.focus();
		 okl=false
	}	
	if (emailCheck (emailStr) == false)
	{
		 stringEroare += "-e-mail<br>"
		 x.email.focus();
		 oke=false
	} 	
	if(x.tel.value != "")
	{
		if(!/^[0-9()-]*$/.test(x.tel.value))
		{
			stringEroare += "-telefon<br>"
			okt = false
		}
	}
	if(x.web.value != "")
	{
		if(!/^[a-z()+ A-Z() + .()-]*$/.test(x.web.value))
		{
			stringEroare += "-web site personal<br>"
			okw = false
		}
	}
	//poza
	/*
	if(x.poza1.value != "")
	{



			 stringEroare += "-poza<br>"
			 x.poza1.focus();
			 okpo=false
			
	}
	*/
	if (oku && okp && okvp && okn && okl && oke && okt && okw && okpo)
	{
		document.getElementById('eroare').innerHTML = '';
		x.add_fotograf.value = "save";
		x.submit();
		
	}
	else			
	{
		document.getElementById('eroare').innerHTML = 'Completati corect:<br> <div style="color:red">' + stringEroare + '</div>';
	}	
}


function getFile(file){
var fObj = new ActiveXObject("Scripting.FileSystemObject");
var form = document.forms['form'];

if(fObj.GetFile(file).Type.match(/image/gi)){
var image = new Image();
image.src = file;
form.size.value = fObj.GetFile(file).Size+' Bytes';
form.type.value = fObj.GetFile(file).Type;
form.width.value = image.width+' px'; 
form.height.value = image.height+' px'; 
} 

else{ 
for(var i=0; i<form.elements.length; i++){
form.elements[i].value = '';
} alert('Please choose an image!!');
}
}

// verificare mod date fotograf
/* check campuri inscriere fotografi */
function checkModDate()
{	
	var x=document.form_add;
	var stringEroare = "";
	
	oku = true;
	okp = true;
	okvp = true;
	
	okn = true;
	okl = true;
	oke = true;
	emailStr = x.email.value;	
	
	okt = true;
	okw = true;
	
	//user name
	if (x.user.value == "" ||  !/^[a-z()+ A-Z()+ 0-9()+ _()]*$/.test(x.user.value))
	{
		 stringEroare += "-user - se accepta numai: a-z &nbsp;&nbsp;  A-Z &nbsp;&nbsp;  0-9 &nbsp;&nbsp;  _ <br>"
		 oku=false
	}
	else
	{
		if(x.user.value.length < 5)
		{
		 stringEroare += "-user - minim 5 caractere <br>"
		 oku=false			
		}
		
	}
	//parola
	if(x.parola.value != "")
	{
		if (!/^[a-z()+ A-Z()+ 0-9()+ _()]*$/.test(x.parola.value))
		{
			 stringEroare += "-parola - se accepta numai: a-z &nbsp;&nbsp;  A-Z &nbsp;&nbsp;  0-9 &nbsp;&nbsp;  _ <br>"
			 okp=false
		}	
		else
		{
			if(x.parola.value.length < 6)
			{
			 stringEroare += "-parola - minim 6 caractere<br>"
			 okp=false			
			}
			else
			{
				if(x.parola.value == x.user.value)
				{
					 stringEroare += "-parola nu poate fi identica cu user<br>"
					 x.parola.focus();
					 okp=false					
				}
			}
		}
	}
	if(x.parola.value != "")
	{
		if(x.reparola.value == "" || x.reparola.value != x.parola.value)
		{
			 stringEroare += "-confirmarea parolei - verificati daca ati reintrodus parola in campul dedicat <br>"
			 x.reparola.focus();
			 okvp=false		
		}
	}
	//nume
	if (x.nume.value == "" ||  !/^[a-z()+ A-Z()-]*$/.test(x.nume.value))
	{
		 stringEroare += "-nume<br>"
		 x.nume.focus();
		 okn=false
	}	
	//localitate
	if (x.localitate.value == "" ||  !/^[a-z()+ A-Z()+ 0-9()-]*$/.test(x.localitate.value))
	{
		 stringEroare += "-localitate<br>"
		 x.localitate.focus();
		 okl=false
	}	
	if (emailCheck (emailStr) == false)
	{
		 stringEroare += "-e-mail<br>"
		 x.email.focus();
		 oke=false
	} 	
	if(x.tel.value != "")
	{
		if(!/^[0-9()+ -]*$/.test(x.tel.value))
		{
			stringEroare += "-telefon<br>"
			okt = false
		}
	}
	if(x.web.value != "")
	{			  
		if(!/^[a-z()+ A-Z() + 0-9() + .()-]*$/.test(x.web.value))
		{
			stringEroare += "-web site personal<br>"
			okw = false
		}
	}
	if (oku && okp && okvp && okn && okl && oke && okt && okw)
	{
		document.getElementById('eroare').innerHTML = '';
		x.add_fotograf.value = "save";
		x.submit();
		
	}
	else			
	{
		document.getElementById('eroare').innerHTML = 'Completati corect:<br> <div style="color:red">' + stringEroare + '</div>';
	}	
}

function checkAddPoza()
{
	var x=document.form_add;
	var stringEroare = "";
	
	okt = true;
	okp = true;
	
	
	//titlu
	if (x.titlu.value != "")
	{
		if (!/^[a-z()+ A-Z() + 0-9()-]*$/.test(x.titlu.value))
		{
			 stringEroare += "-titlu poza<br>"
			 x.titlu.focus();
			 okt=false
		}
	}
	//poza ||  !/^[a-z()+ A-Z() + 0-9() + .() + _() + -() + /() + :() +  -]*$/.test(x.poza1.value)
	if (x.poza1.value == "" )
	{
		 stringEroare += "-poza<br>"
		 x.poza1.focus();
		 okp=false
	}
	
	if (okt && okp)
	{
		document.getElementById('eroare').innerHTML = '';
		x.add_poza.value = "save";
		x.submit();
		
	}
	else			
	{
		document.getElementById('eroare').innerHTML = 'Completati corect:<br> <div style="color:red">' + stringEroare + '</div>';
	}			
		
}

function checkModPoza()
{
	var x=document.form_mod;
	var stringEroare = "";
	// alert ("intra pe fct java");
	 
	okt = true;
	okp = true;
	
	//titlu
	if (x.titlu_mod.value != "")
	{	
		if (!/^[a-z()+ A-Z()+ 0-9()-]*$/.test(x.titlu_mod.value))
		{
			 stringEroare += "-titlu poza<br>"
			 x.titlu_mod.focus();
			 okt=false
		}
	}
	/*
	//poza ||  !/^[a-z()+ A-Z() + 0-9() + .() + _() + -() + /() + :() +  -]*$/.test(x.poza1.value)
	if (x.poza1.value == "" )
	{
		 stringEroare += "-poza<br>"
		 x.poza1.focus();
		 okp=false
	}
	*/
	if (okt && okp)
	{
		document.getElementById('eroare_mod').innerHTML = '';
		x.mod_poza.value = "save";
		x.submit();
		
	}
	else			
	{
		document.getElementById('eroare').innerHTML = 'Completati corect:<br> <div style="color:red">' + stringEroare + '</div>';
	}			
		
}

// check stiri propuse
function checkAddStire()
{
	var x=document.form_adds;
	var stringEroare = "";
	
	okt = true;
	okc = true;	
	
	//titlu
	if (x.titlu.value == "" ||  !/^[a-z()+ A-Z() + 0-9()-]*$/.test(x.titlu.value))
	{
		 stringEroare += "-titlu stire<br>"
		 x.titlu.focus();
		 okt=false
	}
	//continut
	if (x.continut.value == "" || x.continut.value == " ")
	{
		 stringEroare += "-continut stire<br>"
		 x.continut.focus();
		 okc=false
	}
	if (okt && okc)
	{
		document.getElementById('eroare').innerHTML = '';
		x.add_stire.value = "save";
		x.submit();
		
	}
	else			
	{
		document.getElementById('eroare').innerHTML = 'Completati corect:<br> <div style="color:red">' + stringEroare + '</div>';
	}			
}

// check informatii
function checkAddInfo()
{
	var x=document.form_adds;
	var stringEroare = "";
	
	okc = true;	

	//continut
	if (x.continut.value == "" || x.continut.value == " ")
	{
		 stringEroare += "-continut stire<br>"
		 x.continut.focus();
		 okc=false
	}
	if (okc)
	{
		document.getElementById('eroare').innerHTML = '';
		x.add_stire.value = "save";
		x.submit();
		
	}
	else			
	{
		document.getElementById('eroare').innerHTML = 'Completati corect:<br> <div style="color:red">' + stringEroare + '</div>';
	}	
}

function getWidthAndHeight() {
    alert("'" + this.name + "' is " + this.width + " by " + this.height + " pixels in size.");
    return true;
}
function loadFailure() {
    alert("'" + this.name + "' failed to load.");
    return true;
}

// check comentarii
function checkAddComent()
{
	var x=document.form_add;
	var stringEroare = "";
	
	
	okc = true;	
	oks = true;
	
	//continut
	if (x.continut.value == "" || x.continut.value == " ")
	{
		 stringEroare += "-comentariu<br>"
		 x.continut.focus();
		 okc=false
	}
	//semnatura
	if (x.semnatura.value == "" ||  !/^[a-z()+ A-Z() + 0-9()-]*$/.test(x.semnatura.value))
	{
		 stringEroare += "-semnatura<br>"
		 x.semnatura.focus();
		 oks=false
	}	
	if (okc && oks)
	{
		document.getElementById('eroare').innerHTML = '';
		x.add_coment.value = "save";
		x.submit();
		
	}
	else			
	{
		document.getElementById('eroare').innerHTML = 'Completati corect:<br> <div style="color:red">' + stringEroare + '</div>';
	}			
}

function NameCheck()
{
	var x=document.newsletter;
	var stringEroare = "";
	
	okn = true;
	oke = true;
	emailStr = document.newsletter.email.value;
		
	//nume
	if (x.nume.value == "" ||  !/^[a-z()+ A-Z()-]*$/.test(x.nume.value))
	{
		 stringEroare += "-nume si prenume<br>"
		 okn=false
	}	
	if (emailCheck (emailStr) == false)
	{
		 stringEroare += "-e-mail<br>"
		 oke=false
	} 	
	if (okn && oke)
	{
		document.getElementById('eroare').innerHTML = '';
		x.submit();
		
	}
	else			
	{
		document.getElementById('eroare').innerHTML = 'Completati corect:<br> <div style="color:red">' + stringEroare + '</div>';
	}	
}

function checkGroup()
{
	var x=document.addgroup;
	var stringEroare = "";
	okd = true;
	
	// denumire
	if (x.den.value == "" ||  !/^[a-z()+ A-Z()-]*$/.test(x.den.value))
	{
		stringEroare += "-denumire<br>"
		okd=false
	}
	if (okd)
	{
		document.getElementById('eroare').innerHTML = '';
		x.add_group1.value='save';
		x.submit();
		
	}
	else			
	{
		document.getElementById('eroare').innerHTML = 'Completati corect:<br> <div style="color:red">' + stringEroare + '</div>';
	}		
}
// fct pentru verificare dimensiuni configurator
function checkDim()
{
	var x=document.form_configurator;
	var stringEroare = "";
	okh = true;
	okw = true;
	
	if (!/^[0-9]+$/.test(x.height.value)  || parseInt(x.height.value) == 0 )
	{
		stringEroare += "-inaltimea<br>"
		okh=false		
	}
	else
	{
		if(x.tip.value == 1)
		{
			if(x.height.value > 10)
			{			
				alert ("Inaltime prea mare! Nu poate fi reprezentata.");
				stringEroare += "-inaltimea<br>"
				okh=false
			}			
		}
		else
		{
			if(x.height.value > 40)
			{			
				alert ("Inaltime prea mare! Nu poate fi reprezentata.");
				stringEroare += "-inaltimea<br>"
				okh=false
			}
		}
	}
	if (!/^[0-9]+$/.test(x.width.value)  || parseInt(x.width.value) == 0 )
	{
		stringEroare += "-lungimea<br>"
		okw=false		
	}	
	else
	{
		if(x.tip.value == 1)
		{
			if(x.width.value > 10)
			{
				alert ("Lungime prea mare! Nu poate fi reprezentata.");
				stringEroare += "-lungime<br>"
				okw=false
			}			
		}
		else
		{
			if(x.width.value > 40)
			{
				alert ("Lungime prea mare! Nu poate fi reprezentata.");
				stringEroare += "-lungime<br>"
				okw=false
			}
		}
	}	
	if (okh && okw)
	{
		document.getElementById('eroare').innerHTML = '';		
		x.submit();		
	}
	else			
	{
		document.getElementById('eroare').innerHTML = 'Urmatoarele rubrici sunt incomplete sau completate incorect:<br> <div style="color:red">' + stringEroare + '</div>';
	}		
}
// fct pentru verificare campuri din formular contact
function CheckContact()
{
	var x=document.form_contact;
	
 	okn = true;
	
	okt = true;
	oke = true;	
	okm = true;
	
 	var stringEroare = "";
 	// e-mail
 	emailStr = x.email.value;
	if (emailCheck (emailStr) == false)
	{
		 stringEroare += "-e-mail<br>"
		 oke=false
	}
	//nume
	if (x.nume.value == 0 ||  !/^[a-z()+ A-Z()-]*$/.test(x.nume.value))
	{
		 stringEroare += "-nume si prenume<br>"
		 okn=false
	}

	//telefon
	if (x.telefon.value == 0 ||  !/^[0-9()+ / -]*$/.test(x.telefon.value)) 
	{
		 stringEroare += "-telefon<br>"
		 okt=false
	}	 	
	//mesaj
	if (x.mesaj.value == "")
	{
		 stringEroare += "-mesaj<br>"
		 okm=false
	}	
	if (okn && okt && oke && okm)
	{
		document.getElementById('eroare').innerHTML = '';
		x.submit();

	}
	else
	{
		document.getElementById('eroare').innerHTML = 'Urmatoarele rubrici sunt incomplete sau completate incorect:<br> <div style="color:red">' + stringEroare + '</div>';
	}
}
//  End -->

