function updateFields(selectObj) {

   var VISIBLE = "visible";
   var HIDDEN = "hidden";
   // get the index of the current selection
   var index= selectObj.selectedIndex;
   // use the index to determine the value of the current selection
   var pick = selectObj.options[index].value; 
   var vTime = VISIBLE; 
   if ((pick == 7) || (pick == 8)) {  
	 vTime =HIDDEN;  
   }
   else if (pick < 7) {  
     vTime =VISIBLE; 	      
   }  
   var timeElem = document.getElementById("hideElement");  
   if (timeElem != null) {
     timeElem.style.visibility = vTime;
   } 
}


function display(myimage,alt) {
 html = "<HTML><HEAD><TITLE>"+alt+"</TITLE>" +
  "</HEAD><BODY LEFTMARGIN=0 " 
  + "MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0><CENTER>" 
  + "<IMG SRC='" + myimage + "' BORDER=0 NAME=image " 
  + "onload='window.resizeTo(document.image.width*1.2,document.image.height*1.2)'>"
  + "</CENTER>" 
  + "</BODY></HTML>";
 popup=
 window.open
  ('','image',
  'toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=1');
 popup.document.open();
 popup.document.write(html);
 popup.document.focus();
 popup.document.close()
 };
 
 function send_newsletter() {
	 
	 var mesaj = '';
	 if  ((document.formNews.nume.value=='')||(document.formNews.nume.value=='nume si prenume *'))
 		{
 			mesaj += "Completati campul: nume si prenume *!\n";
 		}
	if  ((document.formNews.adresaEmail.value=='')||(document.formNews.adresaEmail.value=='e-mail *'))
		{
			mesaj += "Completati campul: e-mail *!\n";
		}
	else{
 			var x = document.formNews.adresaEmail.value;
 			var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
 			if (!filter.test(x)) {
 				mesaj += "Campul: e-mail *!  - nu este valid! \n";

 			}
 		}
		if  (document.formNews.selOras.selectedIndex ==0)
		{
			mesaj += "Selectati campul: Oras *!\n";
		}
		 if  (document.formNews.ver.value!='9')
		 {
			 mesaj += "Raspuns gresit la intrebare de verificare!\n";
		 }
		 if(mesaj!='')
 		{
 			alert(mesaj);
 			return false;
 		}
 		else { 				
 				document.formNews.submit();
 		}
 }
 
 function checkRecomandaPrieteni () { 
 	
 		var mesaj = ''; 
 		
 		
 		if  ((document.recomandaPrieteni.numePren.value=='')||(document.recomandaPrieteni.numePren.value=='numele tau*'))
 		{
 			mesaj += "Completati campul: numele tau *!\n";
 		}

 		if  ((document.recomandaPrieteni.adresaEmailR1.value=='')||(document.recomandaPrieteni.adresaEmailR1.value=='e-mail-ul tau*'))
 		{
 			mesaj += "Completati campul: e-mail-ul tau*!\n";
 		}
 		else{
 			var x = document.recomandaPrieteni.adresaEmailR1.value;
 			var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
 			if (!filter.test(x)) {
 				mesaj += "Campul: e-mail-ul tau*  - nu este valid! \n";

 			}
 		}
 		
 		if  ((document.recomandaPrieteni.numePren2.value=='')||(document.recomandaPrieteni.numePren2.value=='numele prietenului*'))
 		{
 			mesaj += "Completati campul: numele prietenului*!\n";
 		}
 		
 		if  ((document.recomandaPrieteni.adresaEmailR2.value=='')||(document.recomandaPrieteni.adresaEmailR2.value=='e-mail-ul prietenului*'))
 		{
 			mesaj += "Completati campul: e-mail-ul prietenului*!\n";
 		}
 		else{
 			var x = document.recomandaPrieteni.adresaEmailR2.value;
 			var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
 			if (!filter.test(x)) {
 				mesaj += "Campul: e-mail-ul prietenului*  - nu este valid! \n";

 			}
 		}
		 if  (document.recomandaPrieteni.ver.value!='7')
		 {
			 mesaj += "Raspuns gresit la intrebare de verificare!\n";
		 }

 		if(mesaj!='')
 		{
 			alert(mesaj);
 			return false;
 		}
 		else {
 			//tempConfirm = confirm_entry();
 			//if(tempConfirm == true) { 				
 				document.recomandaPrieteni.submit();
 			
 			//else {
 			//	alert('Modificati campurile care nu sunt corecte si apasati trimite din nou!');
 			//}
 		}
}
function getXmlHttpRequestObject() 
{
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest(); //Not IE
	} else if(window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP"); //IE
	} else {
		//Display your error message here. 
		//and inform the user they might want to upgrade
		//their browser.
	}
}
function SaveState(url,vot,divv)
{
	url=url+"&vote="+vot;
  var req = getXmlHttpRequestObject();
  var div=document.getElementById(divv)
  if (req.readyState == 4 || req.readyState == 0) 
  {	
	  req.open("GET", url, true);
	  req.onreadystatechange =function handleXmlHttpRequestObject() {if (req.readyState == 4) 
	  { 
	 	div.innerHTML =req.responseText; 
	 	 var newdiv = document.createElement("div");
		newdiv.innerHTML = ""; 
		div.appendChild(newdiv);

	  }}; 		
	  req.send(null);
  }
}