function Focus(id){if(document.getElementById(id).value=='What'||document.getElementById(id).value=='Where(optional)')
document.getElementById(id).value='';}
function Blur(id){if(document.getElementById(id).value==''){if(document.getElementById(id).id=='h_id_q')
document.getElementById(id).value='What';if(document.getElementById(id).id=='h_id_w')
document.getElementById(id).value='Where(optional)';}}


  blankRE=/^(\s)+$/;

  
		function formValidator()
		{
		
			this.nrMaxWordChars=30;
			this.minimChars=3;
			this.minimCharsPrenume=1;
			
			this.errorList=new Array();
			
			this.isEmpty=isEmpty;
			this.raiseError=raiseError;
			this.numErrors=numErrors;
			this.displayErrors=displayErrors;
			this.isAlphaNumeric=isAlphaNumeric;
//			this.hasAcceptedCharacters=hasAcceptedCharacters;
			this.hasLength=hasLength;
			this.hasMax=hasMax;
			this.isAlphabetic=isAlphabetic;
			this.isNumeric=isNumeric;
			this.isAlphaNumeric_siSpatiu=isAlphaNumeric_siSpatiu;
			this.isValidEmailAdress=isValidEmailAdress;
			this.showErrors=showErrors;
			this.hideErrors=hideErrors;
			this.isPicture=isPicture;
			this.isPicturejpeg=isPicturejpeg;
			this.hasExtraWords=hasExtraWords;
			this.isValidURL=isValidURL;
		}		
	
	function hasExtraWords(str)
	{
		var arrWords=str.split(' ');
		for(var i=0; i<arrWords.length; i++)
		{
			if(arrWords[i].length>this.nrMaxWordChars)
				return true;
		}
		return false;
	}

    function isPicture(str)
    {
      if(str.substring(str.lastIndexOf("."))!='.jpg' &&  str.substring(str.lastIndexOf("."))!='.JPG' && str.substring(str.lastIndexOf("."))!='.JPEG' && str.substring(str.lastIndexOf("."))!='.jpeg' && str.substring(str.lastIndexOf("."))!='.gif' && str.substring(str.lastIndexOf("."))!='.GIF' && str.substring(str.lastIndexOf("."))!='.png' && str.substring(str.lastIndexOf("."))!='.PNG')
        return false;
       else
        return true;      
    }
    
    function isPicturejpeg(str)
    {
      if(str.substring(str.lastIndexOf("."))!='.jpg' &&  str.substring(str.lastIndexOf("."))!='.JPG' && str.substring(str.lastIndexOf("."))!='.JPEG' && str.substring(str.lastIndexOf("."))!='.jpeg' )
        return false;
       else
        return true;      
    }

		function isEmpty(val)
		{
			if(val.match(/^(\s)+$/) || val=="")
				return true;
			else
				return false;
		}

		function isValidEmailAdress(str)
		{
	
			var at="@"
			var dot="."
			var lat=str.indexOf(at)
			var lstr=str.length
			var ldot=str.indexOf(dot)
			if (str.indexOf(at)==-1){
//			   alert("Nu am @")
			   return false
			}
	
			if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
//			   alert("Nu am @ sau @ pe prima pozitie")
			   return false
			}
	
			if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
//				alert("Nu am punct sau punct pe prima pozitie" + str.indexOf(dot))
				return false
			}
	
			 if (str.indexOf(at,(lat+1))!=-1){
//				alert("Prea multe @")
				return false
			 }
	
			 if (str.substring(lat-1,lat)==dot || str.substring(lat+1, str.indexOf(dot, (lat+2))).length<3 || str.substring(lat+1, lat+2)==dot){
//				alert("Punct inainte sau dupa @. "+str.substring(lat+1,lat+2))
				return false
			 }
	
			 if (str.indexOf(dot,(lat+2))==-1){
//				alert("a")
				return false
			 }
			
			 if (str.indexOf(" ")!=-1){
//				alert("Este spatiu in adresa")
				return false
			 }
			 
			 if(str.substring(str.length-3, str.length-2)!=dot && str.substring(str.length-4, str.length-3)!=dot) {
				 return false;
			 }
			 
			 return true		
		}

		function isNumeric(val)
		{
			if(val.match(/^[0-9\s-.]+$/))
				return true;
			else
				return false;
		}

		function isAlphabetic(val)
		{
			if(val.match(/^[a-zA-Z\s-]+$/))
				return true;
			else
				return false;
		}

		function isAlphaNumeric(val)
		{
			if(val.match(/^[a-zA-Z0-9_\-|]+$/))
				return true;
			else
				return false;
		}
		
		function isAlphaNumeric_siSpatiu(val)
		{
		   	if(val.match(/^[a-zA-Z0-9_\s-|]+$/))
				return true;
			else
				return false;
	    }
	
		function raiseError(msg)
		{
			this.errorList[this.errorList.length]=msg;
		}
	
		function numErrors()
		{
			return this.errorList.length;
		}

		function displayErrors()
		{			
			for(var x=0; x<this.errorList.length; x++)
				document.write(this.errorList[x]+"<br><br>"); 
		}
////////////////////////////
/*		function hasAcceptedCharacters(val)
		{
			for(var x=0; x<val.length; x++)
			{
				if(val.charCodeAt(i)==45 || val.charCodeAt(i)==95)
					return true;
				else
					return false;
			}
		}
////////////////////////////		*/
    
		function hasLength(val)
		{
			if(val.length<this.minimChars && val.length!=0)
				return false;
			else
				return true;
		}
		
		function hasMax(val)
		{
		  	if(val.length>this.nrMaxWordChars && val.length!=0)
				return false;
			else
				return true;
	    }
	    
    function isValidURL(str) {
    var dot=".";
    var i=2;
    var lstr=str.length;
    var ldot=str.lastIndexOf(dot);
   
            if (ldot==-1) {
              
			   return false;
			}
			
			if (ldot==0 || ldot==lstr-1){
                
				return false;
			
			}
			if (str.indexOf(" ")!=-1){

				return false;
			 }
			
			 if(str.substring(str.length-2, str.length-1)!=dot && str.substring(str.length-3, str.length-2)!=dot && str.substring(str.length-4, str.length-3)!=dot && str.substring(str.length-5, str.length-4)!=dot && str.substring(str.length-6, str.length-5)!=dot && str.substring(str.length-7, str.length-6)!=dot && str.substring(str.length-8, str.length-7)!=dot && str.substring(str.length-9, str.length-8)!=dot && str.substring(str.length-10, str.length-9)!=dot && str.substring(str.length-11, str.length-10)!=dot && str.substring(str.length-12, str.length-11)!=dot && str.substring(str.length-13, str.length-12)!=dot && str.substring(str.length-14, str.length-13)!=dot && str.substring(str.length-15, str.length-14)!=dot && str.substring(str.length-16, str.length-15)!=dot && str.substring(str.length-17, str.length-16)!=dot && str.substring(str.length-18, str.length-17)!=dot && str.substring(str.length-19, str.length-18)!=dot && str.substring(str.length-20, str.length-19)!=dot && str.substring(str.length-21, str.length-20)!=dot && str.substring(str.length-22, str.length-21)!=dot && str.substring(str.length-23, str.length-22)!=dot && str.substring(str.length-24, str.length-23)!=dot && str.substring(str.length-25, str.length-24)!=dot) {
				 return false;
			 }
			

			 return true;		
		}	    
	
	    var allHTMLTags = new Array();
	    var allHTMLTags=document.getElementsByTagName("div");
		function showErrors(id)
		
		{
			    
			document.getElementById(id).innerHTML="";
			document.getElementById(id).style.display="block";
			document.getElementById(id).style.fontFamily="Verdana";
			document.getElementById(id).style.fontSize="12px";
			document.getElementById(id).style.color="#aa0000";
			document.getElementById(id).style.margin="10px 0px 0px 0px";
			
			for (i=0; i<allHTMLTags.length; i++) {
					if (allHTMLTags[i].className=="error") {

						allHTMLTags[i].style.display="none";

					}
			}
			
			for(var x=0; x<this.errorList.length; x++)
			{
				var oldHTML=document.getElementById(id).innerHTML;				
					
				document.getElementById(id).innerHTML=oldHTML+this.errorList[x]+"<br/>";			
			}
		}
	
		function hideErrors(id)
		{
			document.getElementById(id).style.display="block";
		}


function validate(form)

{
	var myForm=document.getElementById(form);
	

	fv=new formValidator();
	for(var i=0; i<myForm.elements.length; i++)
	{
		var input=myForm.elements[i]; 
		switch(input.id)
		{
			 
		  	case "username_register":
				if(fv.isEmpty(input.value))
				{
					fv.raiseError("Username is empty");
				}
				else if(!fv.hasLength(input.value))
				{					
					fv.raiseError("Username must be at least "+fv.minimChars+" characters long");
				}
			
				else if(!fv.hasMax(input.value))
				{				  	
					fv.raiseError("Username cannot be more than "+fv.nrMaxWordChars+" characters");
			    }
								
				break;	 
			 
          case "email_register":
				if(!fv.isValidEmailAdress(input.value))
				{
					fv.raiseError("Not a valid email");					
				}
				else if(fv.isEmpty(input.value))
				{	
					fv.raiseError("Email is empty");
				}								
			break;
			
		  	case "password_register":
		  	    if(input.value.length==0)
				{					
					fv.raiseError("Password is empty");
				}
				else if(!fv.hasLength(input.value))
				{
					fv.raiseError("Password must be at least "+fv.minimChars+" characters long");
					
				}									
			break;
			
			case "blog_name":
			    if(fv.isEmpty(input.value))
				{
					fv.raiseError("Name of Blog is empty");
				}
				
				else if(!fv.hasLength(input.value))
				{
					fv.raiseError("Name of Blog must be at least "+fv.minimChars+" characters long");
					
				}			     
			break;
			
			case "blog_url":
			  
			   if(fv.isEmpty(input.value) || blankRE.test(input.value) || input.value=="http://")
				{				      
					  fv.raiseError("Blog URL is empty");					  				
				}
				else if(!fv.isValidURL(input.value))
				{      
					  fv.raiseError("Invalid Blog URL");			  
				}			   								
			break;
			
			case "blog_description":
			    if(fv.isEmpty(input.value))
				{
					fv.raiseError("Blog Description is empty");
				}
				else if(!fv.hasLength(input.value))
				{
					fv.raiseError("Blog Description must be at least "+fv.minimChars+" characters long");					
				}
				
				else if(input.value.length>255)
				{					
					fv.raiseError("Description too long. Maximum is 255 characters.");
				}
					
			break;
			
			case "blog_city":
				if(input.value=="none")
			    {
					fv.raiseError("Invalid City.");
				}
			break;
			
			case "tags":
				if(fv.isEmpty(input.value))
				{
					fv.raiseError("You must enter at least one tag.");
				}
			break;
			
			case "edit_email":
			    if(!fv.isValidEmailAdress(input.value))
				{
					fv.raiseError("Not a valid email");					
				}
				else if(fv.isEmpty(input.value))
				{	
					fv.raiseError("Email is empty");
				}	
			break;
			
			case "new_pw":
		  	    if(input.value.length==0)
				{					
					fv.raiseError("New Password is empty");
				}
				else if(!fv.hasLength(input.value))
				{
					fv.raiseError("New Password must be at least "+fv.minimChars+" characters long");
					
				}									
			break;
			
			case "avatar":
		           if(fv.isEmpty(input.value) || blankRE.test(input.value))
			            {			              
					      fv.raiseError("Empty field");						  
				        }
				  	
                   else if(!fv.isPicture(input.value))    //daca nu este poza
                        {                     
                             fv.raiseError("Must be JPEG, GIF or PNG type");
                            
                        }
		 
			   break;
			   
			 case "contact_name":
			    if(fv.isEmpty(input.value))
				{
					fv.raiseError("Name is empty");
				}
			 
			 break; 
			 
			case "contact_email":
				if(!fv.isValidEmailAdress(input.value))
				{
					fv.raiseError("Not a valid email");					
				}
				else if(fv.isEmpty(input.value))
				{	
					fv.raiseError("Email is empty");
				}								
			break;
			
			case "contact_message" :
			    if(fv.isEmpty(input.value))
				{
					fv.raiseError("Message is empty");
				}
			break;
			
			case "name_report":
				if(fv.isEmpty(input.value))
				{
					fv.raiseError("Name is empty");
				}
			break;
			
			case "email_report":
				if(!fv.isValidEmailAdress(input.value))
				{
					fv.raiseError("Not a valid email");					
				}
				else if(fv.isEmpty(input.value))
				{	
					fv.raiseError("Email is empty");
				}								
			break;
			
			case "reason":
				if(input.value=="0")
			    {
					fv.raiseError("Choose Type");
				}
			break;
			
			case "message_report" :
			    if(fv.isEmpty(input.value))
				{
					fv.raiseError("Message is empty");
				}
			break;
			
			case "id_name":
			    if(fv.isEmpty(input.value))
				{
					fv.raiseError("Company Name is empty");
				}
			break;
			
			case "id_phone":
			    if(fv.isEmpty(input.value))
				{
					fv.raiseError("Phone is empty");
				}
			break;
			
			case "id_email":
			    if(!fv.isValidEmailAdress(input.value))
				{
					fv.raiseError("Not a valid email");					
				}
				else if(fv.isEmpty(input.value))
				{	
					fv.raiseError("Your Email is empty");
				}	
			break;
			
			case "id_city":
			    
				if(fv.isEmpty(input.value))
				{	
					fv.raiseError("City is empty");
				}	
			break;
			
			case "id_zip_code":
			    
				if(fv.isEmpty(input.value))
				{	
					fv.raiseError("Zip code is empty");
				}	
			break;
			
			case "id_address":
			    
				if(fv.isEmpty(input.value))
				{	
					fv.raiseError("Address is empty");
				}	
			break;
			
			case "id_category1":
			    
				if(fv.isEmpty(input.value))
				{	
					fv.raiseError("Category is empty");
				}	
			break;
			
			case "photo_title":
			    if(fv.isEmpty(input.value))
				{	
					fv.raiseError("Photo Title is empty");
				}
				else if(!fv.hasLength(input.value))
				{
					fv.raiseError("Photo Title be at least "+fv.minimChars+" characters long");
					
				}	
			break;
			
			case "photo_file":
		           if(fv.isEmpty(input.value) || blankRE.test(input.value))
			            {			              
					      fv.raiseError("File is empty");						  
				        }
				  	
                   else if(!fv.isPicturejpeg(input.value))    //daca nu este poza
                        {                     
                             fv.raiseError("File must be JPEG");
                            
                        }
		    break;
		    
		    case "photo_file2":
		           if(!fv.isEmpty(input.value) && !fv.isPicturejpeg(input.value))
			            {			              
					      fv.raiseError("File must be JPEG");					  
				        }                  
		    break;
			
				
						
		  case "uploadFile1":
		    if(input.value!='')
          if(!fv.isPicture(input.value))    
          {
            input.style.border="1px solid red";
            fv.raiseError("- Fisierul din campul imaginea 1 trebuie sa fie: *.jpg, *.gif sau *.png");
          }
          else
  				{
  					input.style.border="1px solid #ccc";
  				}
		  break;


			case "acord":
				if(!input.checked)
					fv.raiseError("&raquo; Trebuie sa fiti de acord cu termenii si conditiile noastre!");
			break;



			case "mailUserProfile":
				if(!fv.isValidEmailAdress(input.value))
				{
					fv.raiseError("&raquo; Adresa de e-mail "+input.value+" nu este valida!");
					input.style.border="1px solid red";
				}
				else
					input.style.border="1px solid #ccc";										
			break;
			
			



			case "telAnunt":
				if(fv.isEmpty(input.value))
				{
					input.style.border="1px solid red";
					fv.raiseError("&raquo; Campul 'Telefon' nu este completat!");
				}
				else if(!fv.isNumeric(input.value))
				{
					fv.raiseError("&raquo; Campul 'Telefon' contine caractere nepermise!");
					input.style.border="1px solid red";
				}				
				else if(!fv.hasLength(input.value))
				{
					input.style.border="1px solid red";
					fv.raiseError("&raquo; Camplul 'Telefon' nu are lungimea de minim "+fv.minimChars+" caractere!");
				}
				else
					input.style.border="1px solid #ccc";
			break;
			
			case "phone":
				if(fv.isEmpty(input.value))
				{
					input.style.border="1px solid red";
					fv.raiseError("&raquo; Camplul 'Telefon' nu este completat!");
				}
			     if(!fv.isNumeric(input.value))
				{
					fv.raiseError("&raquo; Campul 'Telefon' contine caractere nepermise!");
					input.style.border="1px solid red";
				}				
				else if(input.value.length<10)
				{
					input.style.border="1px solid red";
					fv.raiseError("&raquo; Camplul 'Telefon' nu are lungimea de minim 10 caractere! (Ex. 0700.000.000 sau 0230.000.000)");
				}
				else
					input.style.border="1px solid #ccc";										
			break;
			
			

		

			case "firstname":			
				if(fv.isEmpty(input.value)  || blankRE.test(input.value))
				{
					fv.raiseError("&raquo; Camplul 'Prenume' nu este completat!");
					input.style.border="1px solid red";
				}
				else if(!fv.isAlphabetic(input.value))
				{
					input.style.border="1px solid red";
					fv.raiseError("&raquo; Campul 'Prenume' contine caractere nepermise!");
				}
		
				
				else
					input.style.border="1px solid #ccc";										
			break;
			
			case "surename":			
				if(fv.isEmpty(input.value)|| blankRE.test(input.value))
				{
					
					fv.raiseError("&raquo; Campul 'Nume' nu este completat!");
					input.style.border="1px solid red";	
				}
				else if(!fv.isAlphabetic(input.value))
				{
					input.style.border="1px solid red";
					fv.raiseError("&raquo; Campul 'Nume' contine caractere nepermise!");
				}
				
				else
					input.style.border="1px solid #ccc";										
			break;

			case "parola2":
				if(fv.isEmpty(input.value))
				{
					input.style.border="1px solid red";
					fv.raiseError("&raquo; Campul 'Confirmare parola' nu este completat!");
				}
				else if(!fv.hasLength(input.value))
				{
					input.style.border="1px solid red";
					fv.raiseError("&raquo; Campul 'Confirmare parola' nu are lungimea de minim "+fv.minimChars+" caractere!");
				}
				else if(!fv.hasMax(input.value))
				{
				  	input.style.border="1px solid red";
					fv.raiseError("&raquo; Campul 'Confirmare parola' nu are lungimea de max "+fv.nrMaxWordChars+" caractere!");
			    }
				else
					input.style.border="1px solid #ccc";										
			break;

			case "parola1":
				if(fv.isEmpty(input.value))
				{
					input.style.border="1px solid red";

					fv.raiseError("&raquo; Campul 'Parola' nu este completat!");
				}
				else if(!fv.hasLength(input.value))
				{
					input.style.border="1px solid red";
					fv.raiseError("&raquo; Campul 'Parola' nu are lungimea de minim "+fv.minimChars+" caractere!");
				}
				
				else if(!fv.hasMax(input.value))
				{
				  	input.style.border="1px solid red";
					fv.raiseError("&raquo; Campul 'Parola' nu are lungimea de max "+fv.nrMaxWordChars+" caractere!");
			    }
				else
					input.style.border="1px solid #ccc";										
			break;
			
			case "parola_veche":
				if(fv.isEmpty(input.value))
				{
					input.style.border="1px solid red";

					fv.raiseError("&raquo; Campul 'Parola veche' nu este completat!");
				}
				else if(!fv.hasLength(input.value))
				{
					input.style.border="1px solid red";
					fv.raiseError("&raquo; Campul 'Parola veche' nu are lungimea de minim "+fv.minimChars+" caractere!");
				}
				
				else if(!fv.hasMax(input.value))
				{
				  	input.style.border="1px solid red";
					fv.raiseError("&raquo; Campul 'Parola veche' nu are lungimea de max "+fv.nrMaxWordChars+" caractere!");
			    }
				else
					input.style.border="1px solid #ccc";										
			break;
			
			case "parola4":
				if(fv.isEmpty(input.value))
				{
					input.style.border="1px solid red";
					fv.raiseError("&raquo; Campul 'Confirmare parola noua' nu este completat!");
				}
				else if(!fv.hasLength(input.value))
				{
					input.style.border="1px solid red";
					fv.raiseError("&raquo; Campul 'Confirmare parola noua' nu are lungimea de minim "+fv.minimChars+" caractere!");
				}
				else if(!fv.hasMax(input.value))
				{
				  	input.style.border="1px solid red";
					fv.raiseError("&raquo; Campul 'Confirmare parola noua' nu are lungimea de max "+fv.nrMaxWordChars+" caractere!");
			    }
				else
					input.style.border="1px solid #ccc";										
			break;

			case "parola3":
				if(fv.isEmpty(input.value))
				{
					input.style.border="1px solid red";

					fv.raiseError("&raquo; Campul 'Parola noua' nu este completat!");
				}
				else if(!fv.hasLength(input.value))
				{
					input.style.border="1px solid red";
					fv.raiseError("&raquo; Campul 'Parola noua' nu are lungimea de minim "+fv.minimChars+" caractere!");
				}
				
				else if(!fv.hasMax(input.value))
				{
				  	input.style.border="1px solid red";
					fv.raiseError("&raquo; Campul 'Parola noua' nu are lungimea de max "+fv.nrMaxWordChars+" caractere!");
			    }
				else
					input.style.border="1px solid #ccc";										
			break;
			
			
			case "passUserProfile":
				if(!fv.hasLength(input.value) && input.value.length!="")
				{
					input.style.border="1px solid red";
					fv.raiseError("&raquo; Campul 'Parola noua' nu are lungimea de minim "+fv.minimChars+" caractere!");
				}
				else
					input.style.border="1px solid #ccc";										
			break;

		

			case "an":
			 if(input.value=="an")
			    {
			        input.style.border="1px solid red";
					fv.raiseError("&raquo;Alegeti anul nasterii dvs!");
				}
				else
			     input.style.border="1px solid #ccc";	
			break;
			
			case "luna":
			 if(input.value=="luna")
			    {
			        input.style.border="1px solid red";
					fv.raiseError("&raquo;Alegeti luna de nastere a dvs!");
				}
				else
			     input.style.border="1px solid #ccc";	
			break;
			
			case "zi":
			 if(input.value=="zi")
			    {
			        input.style.border="1px solid red";
					fv.raiseError("&raquo;Alegeti ziua de nastere a dvs!");
				}
				else
			     input.style.border="1px solid #ccc";	
			break;
			
			case "address":
			     if(fv.isEmpty(input.value) || blankRE.test(input.value))
				{
					input.style.border="1px solid red";
					fv.raiseError("&raquo; Campul 'Localitate' nu este completat");
				}
				else
			     input.style.border="1px solid #ccc";	
		     break;	
			 
			 case "titlu":
			 if(fv.isEmpty(input.value) || blankRE.test(input.value))
				{
					input.style.border="1px solid red";
					fv.raiseError("&raquo; Campul 'Titlu' nu este completat");
				}
				else
				if(!fv.hasLength(input.value))
				{
					input.style.border="1px solid red";
					fv.raiseError("&raquo; Campul 'Titlu' nu are lungimea de minim "+fv.minimChars+" caractere!");
				}
				
			
				else
					input.style.border="1px solid #ccc";
			 
			 break;
			     
			 
			 case "descriere":
			      if(fv.isEmpty(input.value) || blankRE.test(input.value))
				{
					input.style.border="1px solid red";
					fv.raiseError("&raquo; Campul 'Descriere' nu este completat");
				}
				else if(!fv.hasLength(input.value))
				{
					input.style.border="1px solid red";
					fv.raiseError("&raquo; Campul 'Descriere' nu are lungimea de minim "+fv.minimChars+" caractere!");
				}
				
				
				else
					input.style.border="1px solid #ccc";
			 break;
			 
			 
			 case "categorie":
			       if(input.value=="none")
				   {
					    input.style.border="1px solid red";
					    fv.raiseError("&raquo;Alegeti categoria!");
				   }
				   else
				     input.style.border="1px solid #ccc";	
			 break;
			 
			
				
				
			   case "uploadFile":
		           if(fv.isEmpty(input.value))
			            {
				          input.style.border="1px solid red";
					      fv.raiseError("&raquo; Campul 'Upload' nu este completat");   
				        }
				  	
                   else if(!fv.isPicture(input.value))    //daca nu este poza
                        {
                            input.style.border="1px solid red";
                            fv.raiseError("&raquo; Fisierul din campul 'Upload' trebuie sa fie de tip JPEG");
                        }
                     else
  			        	{
  					    input.style.border="1px solid #ccc";
  				         }
		 
			   break;
			 
			   case "expeditor":
			         if(fv.isEmpty(input.value) || blankRE.test(input.value))
			            {
				          input.style.border="1px solid red";
					      fv.raiseError("&raquo; Campul 'Numele' nu este completat");  
						  
				        }
						
				  
						
					 else
  			            {
  					      input.style.border="1px solid #ccc";
  				         }
				   
			   break;	   
			 
			  case "titlu_comentariu":
			           if(fv.isEmpty(input.value) || blankRE.test(input.value))
			            {
				          input.style.border="1px solid red";
					      fv.raiseError("&raquo; Campul 'Titlul comentariului' nu este completat");  
						
				        }
					 else
  			            {
  					      input.style.border="1px solid #ccc";
  				         }
			
			  break;
			  
			  case "comentariu":
			          if(fv.isEmpty(input.value) || blankRE.test(input.value))
			            {
				          input.style.border="1px solid red";
					      fv.raiseError("&raquo; Campul 'Textul comentariului' nu este completat");   
				        }
					 else
  			            {
  					      input.style.border="1px solid #ccc";
  				         }
			  
			  
			  break;
			 
			 case "text_cautare":
			          if(fv.isEmpty(input.value) || blankRE.test(input.value) || input.value.length<4 )
			            {
					 
				         alert("Introduceti cel putin 4 caractere pentru cautare");
						 return false;
				        }
					 else
  			            {
  					      return true;
  				         }
			  
			  
			  break;
			  
			default:
					
			break;


		}
	}
	


	if(document.getElementById("parola1")!=null && document.getElementById("parola1")!=null)
	{
		var parola1=document.getElementById("parola1").value;
		var parola2=document.getElementById("parola2").value;
		if (parola1!=parola2)
		{

			document.getElementById("parola2").style.border="1px solid red";		
			fv.raiseError("&raquo; Parolele nu coincid");
		}
	}
	
	if(document.getElementById("parola3")!=null && document.getElementById("parola4")!=null)
	{
		var parola3=document.getElementById("parola3").value;
		var parola4=document.getElementById("parola4").value;
		if (parola3!=parola4)
		{
	
			document.getElementById("parola3").style.border="1px solid red";		
			fv.raiseError("&raquo; Parolele nu coincid");
		}
	}
	
	if(document.getElementById("passUserProfile")!=null && document.getElementById("confirmUserProfile")!=null)
	{
		var parola1=document.getElementById("passUserProfile").value;
		var parola2=document.getElementById("confirmUserProfile").value;
		if (parola1!=parola2)
		{

			document.getElementById("confirmUserProfile").style.border="1px solid red";		
			fv.raiseError("&raquo; Parolele nu coincid");
		}
	}
	


	if(fv.numErrors()>0)
	{
		if(form=="form_modifica_parola")
		   {
			fv.showErrors("erori2");
		    return false;
		   }
		if(form=="form_modifica_cont")
		  {
		    fv.showErrors("erori1");
		    return false;
		  }
		else
		   {
		   fv.showErrors("erori");
		   return false;		
		   }
	}
	else
	{
		/*fv.hideErrors("erori");
	    fv.hideErrors("erori1");
		fv.hideErrors("erori2");*/
		return true;
	}
	
}

