function goToUrl(myUrl)
	{
	var x = document.body.clientWidth;
	var x_offset = parseInt((x-960)/2);
	window.open(myUrl,'mywindow','width=800,height=568,toolbar=no,left='+x_offset+'; top=5;location=yes,directories=yes,status=yes,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');
	}
	
function show_hide_form(id, cond)
{
	x = document.getElementById(id);
	if (cond==true) x.style.display = 'block';
	else x.style.display = 'none';
}	

function checkSearch(f)
{
	if (isEmpty(f.sh.value))
		  {  
		    f.sh.focus();
			alert('Nu ai introuds nici un cuvant pentru cautare');
			return false;
		  }
return true;		  
}

function checkAddComment(f)
{
	if (isEmpty(f.nume.value)) {  
	  f.nume.focus();
	  alert('Nu ai introdus Numele');
	  return false;
	}
	if (isEmpty(f.comentariu.value)) {  
	  f.comentariu.focus();
	  alert('Nu ai introdus Comentariu');
	  return false;
	}
return true;		
}

function checksendFriendForm(f)
{
	if (!isEMailAddr(f.friend_email.value)) {  
	  f.friend_email.focus();
	  alert('Email invalid!');
	  return false;
	}
	if (!isEMailAddr(f.my_email.value)) {  
	  f.my_email.focus();
	  alert('Email invalid!');
	  return false;
	}
return true;	
}

function checkContactForm(f)
{
	if (!isEMailAddr(f.email.value)) {  
	  f.email.focus();
	  alert('Email invalid!');
	  return false;
	}
	if (isEmpty(f.mesaj.value)) {  
	  f.mesaj.focus();
	  alert('Nu ai introdus Mesajul');
	  return false;
	}
return true;
}

function doRegister()
{
	regForm = document.getElementById('reg_form');
	    if (isEmpty(regForm.prenume.value))
		  {  
		    regForm.prenume.focus();
			alert('Vezi \'Preume\'');
			return false;
		  }
	   if (isEmpty(regForm.nume.value))
		  {  
		    regForm.nume.focus();
			alert('Vezi \'Nume\'');
			return false;
		  }
	   if (isEmpty(regForm.af_line1.value))
		  {  
		    regForm.af_line1.focus();
			alert('Vezi \'Adresa\'');
			return false;
		  }
	  if (isEmpty(regForm.af_oras.value))
		  {  
		    regForm.af_oras.focus();
			alert('Vezi \'Oras\'');
			return false;
		  }
		  
	  if (document.getElementById('adr_liv').checked){
			if (isEmpty(regForm.al_line1.value))
			  {  
				regForm.al_line1.focus();
				alert('Vezi \'Adresa livrare\'');
				return false;
			  }
			if (isEmpty(regForm.al_oras.value))
			  {  
				regForm.al_oras.focus();
				alert('Vezi \'Oras\' livrare');
				return false;
			  }
	   }

	   if (isEmpty(regForm.telefon.value))
		  {  
		    regForm.telefon.focus();
			alert('Vezi \'Telefon\'');
			return false;
		  }
	  if (isEmpty(regForm.email.value) || !isEMailAddr(regForm.email.value))
		  {  
		    regForm.email.focus();
			alert('Vezi \'Email\'');
			return false;
		  }

      if (isEmpty(regForm.username.value))
		  {  
		    regForm.username.focus();
			alert('Vezi \'Utilizator\'');
			return false;
		  }
	  if (isEmpty(regForm.password1.value) || isEmpty(regForm.password2.value) || regForm.password1.value!=regForm.password2.value)
		  {  
		    regForm.password1.focus();
			alert('Vezi \'Parola\'');
			return false;
		  }

return true;
}

function show_pprod()
{
	document.getElementById('pp_short').style.display = 'none';
	document.getElementById('pp_large').style.display = 'block';
}

function addToCart(lnk)
{
	if(document.getElementById('marime')){
		lnk += '&marime='+document.getElementById('marime').value;
	}
	if(document.getElementById('model')){
		lnk += '&model='+document.getElementById('model').value;
	}
	document.location=lnk;
}