function validate(thisform){
	
	var name = thisform;
  
	 // el teu nom
	 ////////////////////////////////////////////////////////////////////////////// 
    if (document.forms[thisform].nom.value==""){
      alert("No ha omplert el camp: El teu Nom.");
      document.forms[thisform].nom.focus();
      return false;
    }

   // E-mail
	 ////////////////////////////////////////////////////////////////////////////// 
    if (document.forms[thisform].mail.value=="") 	{
      alert("No ha omplert el camp: El teu mail.");
      document.forms[thisform].mail.focus();
      return false;
    }
    
    
    if (document.forms[thisform].mail.value!="") {
      if (document.forms[thisform].mail.value.indexOf("@")==-1 || document.forms[thisform].mail.value.indexOf(".")==-1 || document.forms[thisform].mail.value.indexOf(" ")!=-1) {
        alert("El teu mail: .");
        document.forms[thisform].mail.focus();
        return false;
      }
    
    }

	// el seu nom
	 ////////////////////////////////////////////////////////////////////////////// 
    if (document.forms[thisform].amic.value==""){
      alert("No ha omplert el camp: Nom del teu amic.");
      document.forms[thisform].amic.focus();
      return false;
    }
	
	
	// E-mail amic
	 ////////////////////////////////////////////////////////////////////////////// 
    if (document.forms[thisform].email_amic.value=="") 	{
      alert("No ha omplert el camp: Email del teu amic.");
      document.forms[thisform].email.focus();
      return false;
    }
    
    
    if (document.forms[thisform].email_amic.value!="") {
      if (document.forms[thisform].email_amic.value.indexOf("@")==-1 || document.forms[thisform].email_amic.value.indexOf(".")==-1 || document.forms[thisform].email_amic.value.indexOf(" ")!=-1) {
        alert("Email del teu amic: .");
        document.forms[thisform].email_amic.focus();
        return false;
      }
    
    }
		
        setTimeout("document.getElementById('friend').style.display = 'none';",4000);
		setTimeout("document.getElementById('sendframe').contentWindow.document.body.innerHTML = '';",4000);
		if(name == "clients_enviar") {
			document.forms[thisform].id.value = window.location.href;
			document.forms[thisform].target = "sendframe";
		}
		return true;
    	
}


function preview(ruta,x,y)
{
	x=100;
	y=100
	t=(screen.height-y)/2;
	l=(screen.width-x)/2;
//alert(ruta);
//win=window.open('http://www.apartamentos-ata.com/preview.php?src='+ruta,'preview','status=yes,scrollbars=no,left='+l+',top='+t+',width='+x+',height='+y);
win=window.open('http://www.apartamentos-ata.com/foto.php?src='+ruta,'preview','status=yes,scrollbars=no,left='+l+',top='+t+',width='+x+',height='+y); 
win.resizeTo(x,y);
}

function ves_a_item(pob,id)
{
	location="http://www.apartamentos-ata.com/CA/Poblacio/"+id+"/"+pob+".html";
}