function opacity_controller() {

	if( !($.browser.msie && (parseInt(jQuery.browser.version) <= 6) ) ) {
		var opacity_parent = $('.opacity_box').parent();
	
		opacity_parent.bind('mouseover',function(){
			$(this).children('.opacity_box').stop().fadeTo(250, 0.90);
		}).bind('mouseout',function(){
			$(this).children('.opacity_box').stop().fadeTo(250, 0.55);
		});
		
		var opacity_parent2 = $('.opacity_box2').parent();
	
		opacity_parent2.bind('mouseover',function(){
			$(this).children('.opacity_box2').stop().fadeTo(250, 0.60);
		}).bind('mouseout',function(){
			$(this).children('.opacity_box2').stop().fadeTo(250, 0.35);
		});
	}


	$('div[id^=opbg]').bind('mouseover',function(){
		var t = $(this).attr('id').split('_');
		var op = parseInt(t[1]) / 100;
		
		$(this).stop().fadeTo(0, op).fadeTo(250, op - 0.2);
	});
	
	$('div[id^=opbg]').bind('mouseout',function(){
		var t = $(this).attr('id').split('_');
		var op = parseInt(t[1]) / 100;
		
		$(this).stop().fadeTo(0, op - 0.2).fadeTo(250, op);
	});
}








function displayImagen (foto) {
		document.getElementById('fotoPrincipal_1').src = foto;
		var pic = foto;
	}

	function MM_swapImgRestore() { //v3.0
		var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}

	function MM_findObj(n, d) { //v4.01
		var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
		if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
		for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
		if(!x && d.getElementById) x=d.getElementById(n); return x;
	}

	function MM_swapImage() { //v3.0
		var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
		if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
	
	function MM_reloadPage(init) {  //reloads the window if Nav4 resized
		if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
			document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
		else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
		}
		

	function moveTo(nr, orden) {
		var oForm = document.forms['aptSelectorForm'];
		oForm.pageNum.value = nr;
		oForm.tipoOrdenacion.value = orden;
		oForm.submit();
	}
	
	
	
	function cambiarPrefijos(pais) {
		document.getElementById('prefijotelf').value= '+'+prefijos[pais];
		document.getElementById('prefijomovil').value= '+'+prefijos[pais];
		
	}
	
	
	
	// Controlamos si la fecha que nos están introduciendo es menor que el día actual
	function comprobarDia(yearSel, mesSel, diaSel, yearHoy, monthHoy, dayHoy, msg) {	
		var fechaHoy= yearHoy+monthHoy+dayHoy;
		var fechaSel= yearSel+mesSel+diaSel;
		
		if (fechaHoy>fechaSel) {
			alert (msg);
			return false;
		}
		return true;
	}
	
	// 
	function anadirCarro(id, reservar) {
		var oForm = document.forms['cestaAptForm'];
		oForm.anadir_carro.value = 'anadir';
		oForm.reservar.value = reservar;
		oForm.submit();
	}
	
	// 
	function eliminarCarro(id_res) {
		var oForm = document.forms['reserAptForm'];
		oForm.eliminar_reserva.value = id_res;
		oForm.submit();
	}
	
	// 
	function irMonuSearch(monu_id, nombre) {
		var oForm = document.forms['aptMonumentosForm'];
		oForm.monumento.value = monu_id;
		oForm.monu_name.value = nombre;
		oForm.submit();
	}
	
	// 
	function monuPosterior(ini, rutaweb) {
		var oForm = document.forms['aptMonumentosForm'];
		var i= oForm.primer.value;
		var tot= oForm.count.value;
		
		total= parseInt(tot);
		next_index= ini
		for (var j = 1; j <= 5; j++) {
			next_index= next_index + 1;
			if (next_index < 1) next_index= total;
			if (next_index > total) next_index= 1;
			
			//oForm.enlaceMonu[j].value= i;
			id_source = 'imgMonu' + (j);
			img = document.getElementById(id_source);
			
//			img.src = '../_fotosmonu/'+fotos[next_index];
			img.src = rutaweb+fotos[next_index];
			img.alt= nombre[next_index];
			document.getElementById('imgMonu'+(j)).alt= nombre[next_index];
			document.getElementById('imgMonu'+(j)).title= nombre[next_index];
			document.getElementById('enlaceMonu'+(j)).href= 'javascript:irMonuSearch(\''+codigo[next_index]+'\', \''+nombre[next_index]+'\')';
			document.getElementById('autorMonu'+(j)).innerHTML= autor[next_index];
		}
		ini= ini + 1;
		if (ini > total) ini= 1;
  		return ini;
	}
	// 
	function monuAnterior(ini, rutaweb) {
		var oForm = document.forms['aptMonumentosForm'];
		var i= oForm.primer.value;
		var tot= oForm.count.value;
		
		total= parseInt(tot);
		next_index= ini-2;
		for (var j = 1; j <= 5; j++) {
			next_index= next_index + 1;
			if (next_index < 1) next_index= total;
			if (next_index > total) next_index= 1;
			
			//oForm.enlaceMonu[j].value= i;
			id_source = 'imgMonu' + (j);
			img = document.getElementById(id_source);
			
//			img.src = '../_fotosmonu/'+fotos[next_index];
			img.src = rutaweb+fotos[next_index];
			img.alt= nombre[next_index];
			document.getElementById('imgMonu'+(j)).alt= nombre[next_index];
			document.getElementById('imgMonu'+(j)).title= nombre[next_index];
			document.getElementById('enlaceMonu'+(j)).href= 'javascript:irMonuSearch(\''+codigo[next_index]+'\', \''+nombre[next_index]+'\')';
			document.getElementById('autorMonu'+(j)).innerHTML= autor[next_index];
			
		}
		ini= ini - 1;
		if (ini < 1) ini= total;
  		return ini;
	}
	
	
	// 
	function testiPosterior(ini) {
		var oForm = document.forms['aptTestimoniosForm'];
		var i= oForm.primer.value;
		var tot= oForm.count.value;
		
		total= parseInt(tot);
		next_index= ini

			next_index= next_index + 1;
			if (next_index < 1) next_index= total;
			if (next_index > total) next_index= 1;
			
			document.getElementById('textTestimonio').innerHTML= '<b>"'+testimonio[next_index]+'"</b><br /><br />';
			document.getElementById('nombreTestimonio').innerHTML= autor[next_index];
			document.getElementById('paisTestimonio').innerHTML= pais[next_index];
			document.getElementById('fecTestimonio').innerHTML= fechas[next_index];

		ini= ini + 1;
		if (ini > total) ini= 1;
  		return ini;
	}
	
	// 
	function testiAnterior(ini) {
		var oForm = document.forms['aptTestimoniosForm'];
		var i= oForm.primer.value;
		var tot= oForm.count.value;
		
		total= parseInt(tot);
		next_index= ini-2;
		
			next_index= next_index + 1;
			if (next_index < 1) next_index= total;
			if (next_index > total) next_index= 1;
			
			document.getElementById('textTestimonio').innerHTML= '<b>'+testimonio[next_index]+'</b><br /><br />';
			document.getElementById('nombreTestimonio').innerHTML= autor[next_index];
			document.getElementById('paisTestimonio').innerHTML= pais[next_index];
			document.getElementById('fecTestimonio').innerHTML= fechas[next_index];
			
		
		ini= ini - 1;
		if (ini < 1) ini= total;
  		return ini;
	}
	

	
	function checkReservaForm(f, idioma) {
		ERROR = "";
		if (f.nombre.value == '' || f.nombre.value == ' ' ) {
			if (idioma==1) {
				ERROR += "Please enter your first name.<br/>";
			} else if (idioma==3) {
				ERROR += "Please enter your first name.<br/>";
			} else if (idioma==4) {
				ERROR += "Bitte geben Sie Ihren Vornamen ein.<br/>";
			} else if (idioma==2) {
				ERROR += "Rellene el campo de nombre.<br/>";
			} else if (idioma==5) {
				ERROR += "Compila il nome.<br/>";
			}
		}
		
		if (f.apellido.value == '' || f.apellido.value == ' ' ) {
			if (idioma==1) {
				ERROR += "Please enter your last name.<br/>";
			} else if (idioma==3) {
				ERROR += "Saisissez votre nom.<br/>";
			} else if (idioma==4) {
				ERROR += "Geben Sie bitte Ihren Namen ein.<br/>";
			} else if (idioma==2) {
				ERROR += "Rellene el campo de apellido.<br/>";
			} else if (idioma==5) {
				ERROR += "Compila il cognome.<br/>";
			}
		}
		
		if (f.direccion.value == '') {
			if (idioma==1) {
				ERROR += "Please enter your address.<br/>";
			} else if (idioma==3) {
				ERROR += "Saisissez votre adresse.<br/>";
			} else if (idioma==4) {
				ERROR += "Geben Sie Ihre Adresse ein.<br/>";
			} else if (idioma==2) {
				ERROR += "Rellene su direcci&oacute;n de residencia.<br/>";
			} else if (idioma==5) {
				ERROR += "Riempi il tuo indirizzo di casa.<br/>";
			}
		}
		
		if (f.codpos.value == '') {
			if (idioma==1) {
				ERROR += "Please enter your ZIP.<br/>";
			} else if (idioma==3) {
				ERROR += "Saisissez votre code postal.<br/>";
			} else if (idioma==4) {
				ERROR += "Geben Sie bitte Ihre Postleitzahl an.<br/>";
			} else if (idioma==2) {
				ERROR += "Rellene su c&oacute;digo postal.<br/>";
			} else if (idioma==5) {
				ERROR += "Inserisci il tuo codice ZIP.<br/>";
			}
		}
		
		if (f.ciudad.value == '') {
			if (idioma==1) {
				ERROR += "Please enter your city.<br/>";
			} else if (idioma==3) {
				ERROR += "Saisissez votre ville.<br/>";
			} else if (idioma==4) {
				ERROR += "Tragen Sie Ihren Wohnort ein.<br/>";
			} else if (idioma==2) {
				ERROR += "Rellene su ciudad.<br/>";
			} else if (idioma==5) {
				ERROR += "Compila il tuo citt&agrave;.<br/>";
			}
		}
		
		if (f.paisresidencia.value == '') {
			if (idioma==1) {
				ERROR += "Please select a country.<br/>";
			} else if (idioma==3) {
				ERROR += "Choisissez un pays.<br/>";
			} else if (idioma==4) {
				ERROR += "Suchen Sie bitte Ihr Wohnland aus.<br/>";
			} else if (idioma==2) {
				ERROR += "Seleccione su pa&igrave;s de residencia.<br/>";
			} else if (idioma==5) {
				ERROR += "Seleziona il tuo paese di residenza.<br/>";
			}
		}

/*
	    if (f.prefijotelf.value == '' || f.prefijotelf.value == ' ' ) {
			if (idioma==1) {
				ERROR += "Please enter your prefix phone.<br/>";
			} else if (idioma==3) {
					ERROR += "Saisissez votre prefix t&eacute;l&eacute;phone.<br/>";
				} else if (idioma==2) {
						ERROR += "Rellene el prefijo telefonico.<br/>";
					}
	    }
	    if (f.telf.value == '' || f.telf.value == ' ' ) {
			if (idioma==1) {
				ERROR += "Please enter your day time phone.<br/>";
			} else if (idioma==3) {
					ERROR += "Saisissez votre num&eacute;ro de t&eacute;l&eacute;phone.<br/>";
				} else if (idioma==2) {
						ERROR += "Rellene el numero de tel&eacute;fono.<br/>";
					}
	    }
	    if (f.prefijomovil.value == '' || f.prefijomovil.value == ' ' ) {
			if (idioma==1) {
				ERROR += "Please enter your prefix phone.<br/>";
			} else if (idioma==3) {
					ERROR += "Saisissez votre prefix t&eacute;l&eacute;phone.<br/>";
				} else if (idioma==2) {
						ERROR += "Rellene el prefijo telefonico.<br/>";
					}
	    }
	    if (f.movil.value == '' || f.movil.value == ' ' ) {
			if (idioma==1) {
				ERROR += "Please enter your mobile phone.<br/>";
			} else if (idioma==3) {
					ERROR += "Saisissez votre mobile t&eacute;l&eacute;phone.<br/>";
				} else if (idioma==2) {
						ERROR += "Rellene el campo de tel&eacute;fono m&oacute;vil.<br/>";
					}
	    }
*/
	 
		 
	   if ((f.movil.value == '' || f.movil.value == ' ' ) && (f.telf.value == '' || f.telf.value == ' ' )) {
			if (idioma==1) {
				ERROR += "Please enter your mobile phone or your phone.<br/>";
			} else if (idioma==3) {
				ERROR += "Saisissez votre mobile t&eacute;l&eacute;phone o votre t&eacute;l&eacute;phone.<br/>";
			} else if (idioma==4) {
				ERROR += "Geben Sie bitte Ihre Handy- oder Telefonnummer an.<br/>";
			} else if (idioma==2) {
				ERROR += "Rellene el campo de tel&eacute;fono m&oacute;vil o su tel&eacute;fono.<br/>";
			} else if (idioma==5) {
				ERROR += "Compila il tuo telefono o cellulare.<br/>";
			}
	   }
		
		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(f.email.value))) {
			if (idioma==1) {
				ERROR += "Please enter a valid email.<br/>";
			} else if (idioma==3) {
				ERROR += "Saisissez une adresse email valide.<br/>";
			} else if (idioma==4) {
				ERROR += "Geben Sie bitte Ihre g&uuml;ltige Emailadresse ein.<br/>";
			} else if (idioma==2) {
				ERROR += "Escriba una direccion email v&aacute;lida.<br/>";
			} else if (idioma==5) {
				ERROR += "Inserisci un indirizzo e-mail valido.<br/>";
			}
		}
		
		if (f.email.value != f.reemail.value) {
			if (idioma==1) {
				ERROR += "The two mails have to be the same.<br/>";
				f.reemail.value = "";
			} else if (idioma==3) {
				ERROR += "Les deux mails doivent être identiques.<br/>";
				f.reemail.value = "";
			} else if (idioma==4) {
				ERROR += "Beide Emailadressen m&uuml;ssen gleich sein.<br/>";
				f.reemail.value = "";
			} else if (idioma==2) {
				ERROR += "Los dos emails deben ser iguales.<br/>";
				f.reemail.value = "";
			} else if (idioma==5) {
				ERROR += "Entrambe le e-mail dovrebbe essere uguale.<br/>";
				f.reemail.value = "";
			}
		}
		
		if (f.aceptar.checked != true) {
			if (idioma==1) {
				ERROR += "You have to agree to the terms and conditions.<br/>";
			} else if (idioma==3) {
				ERROR += "Vous devez lire et accepter les conditions g&eacute;n&eacute;rales.<br/>";
			} else if (idioma==4) {
				ERROR += "Bitte lesen und akzeptieren Sie die AGB&#39;s.<br/>";
			} else if (idioma==2) {
				ERROR += "Debe leer y aceptar las condiciones generales.<br/>";
			} else if (idioma==5) {
				ERROR += "&Egrave; necessario leggere e accettare le condizioni generali.<br/>";
			}
		}
		
		if (ERROR == "") {
			return true;
		} else{
			ERROR+= "<br/><br/>";
			document.getElementById('errorDiv').innerHTML= ERROR;
			return false;
		}
	}

	function checkamigosForm(f, idioma) {
		ERROR = "";
		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(f.emailpropio.value))) {
			if (idioma==1) {
				ERROR += "Please enter a valid email.<br/>";
			} else if (idioma == 3) {
				ERROR += "Saisissez une adresse email valide.<br/>";
			} else if (idioma == 4) {
				ERROR += "Geben Sie bitte Ihre g&uuml;ltige Emailadresse ein.<br/>";
			} else if (idioma == 2) {
				ERROR += "Escriba una direccion email v&aacute;lida.<br/>";
			} else if (idioma == 5) {
				ERROR += "Inserisci un indirizzo e-mail valido.<br/>";
			}
		}

		if (f.emailpropio.value != f.reemailpropio.value) {
			if (idioma == 1) {
				ERROR += "The two mails have to be the same.<br/>";
				f.reemailpropio.value= "";
			} else if (idioma == 3) {
				ERROR += "Les deux mails doivent &ecirc;tre identiques.<br/>";
				f.reemailpropio.value= "";
			} else if (idioma == 4) {
				ERROR += "Beide Emailadressen m&uumlssen gleich sein.<br/>";
				f.reemailpropio.value= "";
			} else if (idioma == 2) {
				ERROR += "Los dos emails deben ser iguales.<br/>";
				f.reemailpropio.value= "";
			} else if (idioma == 5) {
				ERROR += "Entrambe le e-mail dovrebbe essere uguale.<br/>";
				f.reemailpropio.value= "";
			}
		}
		
		if (f.email1.value != "") {
			if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(f.email1.value))) {
				if (idioma==1) {
					ERROR += "Please enter a valid email.<br/>";
				} else if (idioma==3) {
						ERROR += "Saisissez une adresse email valide.<br/>";
				} else if (idioma==4) {
						ERROR += "Geben Sie bitte Ihre g&uuml;ltige Emailadresse ein.<br/>";
				} else if (idioma==2) {
						ERROR += "Escriba una direccion email v&aacute;lida.<br/>";
				} else if (idioma==5) {
						ERROR += "Inserisci un indirizzo e-mail valido.<br/>";
				}
			}
		}

		if (f.email2.value!="") {
			if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(f.email2.value))) {
				if (idioma==1) {
					ERROR += "Please enter a valid email.<br/>";
				} else if (idioma==3) {
					ERROR += "Saisissez une adresse email valide.<br/>";
				} else if (idioma==4) {
					ERROR += "Geben Sie bitte Ihre g&uuml;ltige Emailadresse ein.<br/>";
				} else if (idioma==2) {
					ERROR += "Escriba una direccion email v&aacute;lida.<br/>";
				} else if (idioma==5) {
					ERROR += "Inserisci un indirizzo e-mail valido.<br/>";
				}
			}
		}

		if (f.email3.value!="") {
			if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(f.email3.value))) {
				if (idioma==1) {
					ERROR += "Please enter a valid email.<br/>";
				} else if (idioma==3) {
					ERROR += "Saisissez une adresse email valide.<br/>";
				} else if (idioma==4) {
					ERROR += "Geben Sie bitte Ihre g&uuml;ltige Emailadresse ein.<br/>";
				} else if (idioma==2) {
					ERROR += "Escriba una direccion email v&aacute;lida.<br/>";
				} else if (idioma==5) {
					ERROR += "Inserisci un indirizzo e-mail valido.<br/>";
				}
			}
		}		

		if (ERROR == "") {
			return true;
		} else{
			ERROR+= "";
			document.getElementById('errorDiv').innerHTML= ERROR;
			return false;
		}
	}

	
	function checkContactoForm (f, idioma) {
		ERROR = "";
		if ((f.form_nombre.value == '') || (f.form_nombre.value == ' ') || (f.form_nombre.value == 'nombre') || (f.form_nombre.value == 'nom') || (f.form_nombre.value == 'name')) {
			if (idioma==1) {
				ERROR += "Por favor, introduzca su nombre.<br/>";
			} else if (idioma==2) {
				ERROR += "Per favor, ompleni el seu nom.<br/>";
			} else if (idioma==3) {
				ERROR += "Please enter your first name.<br/>";
			}
		}
	    
		if ((!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(f.form_email.value))) || (f.form_nombre.value == 'email')) {
			if (idioma==1) {
				ERROR += "Escriba una direccion email v&aacute;lida.<br/>";
			} else if (idioma==2) {
				ERROR += "L'email no es correcte.<br/>";
			} else if (idioma==3) {
				ERROR += "Please enter a valid email.<br/>";
			}
		}
		 
		if ((f.form_responder.value == '') || (f.form_responder.value == ' ' )) {
				if (idioma==1) {
					ERROR += "Seleccione forma de contacto.<br/>";
				} else if (idioma==2) {
					ERROR += "Seleccioni el tipus de contacte.<br/>";
				} else if (idioma==3) {
					ERROR += "Please enter contact's kind.<br/>";
				}
		}
		 
		if ((f.form_telefono.value == '') || (f.form_telefono.value == ' ' ) || (f.form_telefono.value == 'telefono' ) || (f.form_telefono.value == 'telefon' ) || (f.form_telefono.value == 'phone' )) {
				if (idioma==1) {
					ERROR += "Rellene el campo de tel&eacute;fono.<br/>";
				} else if (idioma==2) {
					ERROR += "Per favor, ompleni el tel&egrave;fon.<br/>";
				} else if (idioma==3) {
					ERROR += "Please enter your phone.<br/>";
				}
		}
		
		if (ERROR == "") {
			return true;
		} else{
			ERROR += "<br/><br/>";
			document.getElementById("errorDiv").innerHTML=ERROR;
			return false;
		}
	}

	
	function checkVentaForm (f, idioma) {
		ERROR = "";
		if ((f.form_nombre.value == '') || (f.form_nombre.value == ' ') || (f.form_nombre.value == 'nombre') || (f.form_nombre.value == 'nom') || (f.form_nombre.value == 'name')) {
			if (idioma==1) {
				ERROR += "Por favor, introduzca su nombre.<br/>";
			} else if (idioma==2) {
				ERROR += "Per favor, ompleni el seu nom.<br/>";
			} else if (idioma==3) {
				ERROR += "Please enter your first name.<br/>";
			}
		}
		if ((f.form_ciudad.value == '') || (f.form_ciudad.value == ' ') || (f.form_ciudad.value == 'ciudad') || (f.form_ciudad.value == 'ciutat') || (f.form_ciudad.value == 'city')) {
			if (idioma==1) {
				ERROR += "Por favor, introduzca el nombre de la ciudad.<br/>";
			} else if (idioma==2) {
				ERROR += "Per favor, ompleni el nom de la ciutat.<br/>";
			} else if (idioma==3) {
				ERROR += "Please enter the name of the city.<br/>";
			}
		}
	    
		if ((!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(f.form_email.value))) || (f.form_nombre.value == 'email')) {
			if (idioma==1) {
				ERROR += "Escriba una direccion email v&aacute;lida.<br/>";
			} else if (idioma==2) {
				ERROR += "L'email no es correcte.<br/>";
			} else if (idioma==3) {
				ERROR += "Please enter a valid email.<br/>";
			}
		}
		 
		if ((f.form_responder.value == '') || (f.form_responder.value == ' ' )) {
				if (idioma==1) {
					ERROR += "Seleccione forma de contacto.<br/>";
				} else if (idioma==2) {
					ERROR += "Seleccioni el tipus de contacte.<br/>";
				} else if (idioma==3) {
					ERROR += "Please enter contact's kind.<br/>";
				}
		}
		 
		if ((f.form_telefono.value == '') || (f.form_telefono.value == ' ' ) || (f.form_telefono.value == 'telefono' ) || (f.form_telefono.value == 'telefon' ) || (f.form_telefono.value == 'phone' )) {
				if (idioma==1) {
					ERROR += "Rellene el campo de tel&eacute;fono.<br/>";
				} else if (idioma==2) {
					ERROR += "Per favor, ompleni el tel&egrave;fon.<br/>";
				} else if (idioma==3) {
					ERROR += "Please enter your phone.<br/>";
				}
		}
		 
		if ((f.form_direccion.value == '') || (f.form_direccion.value == ' ' ) || (f.form_direccion.value == 'direccion inmueble' ) || (f.form_direccion.value == 'telefon' ) || (f.form_direccion.value == 'phone' )) {
				if (idioma==1) {
					ERROR += "Rellene el campo de direcci&oacute;n del inmueble.<br/>";
				} else if (idioma==2) {
					ERROR += "Per favor, ompleni l'adreça.<br/>";
				} else if (idioma==3) {
					ERROR += "Please enter address.<br/>";
				}
		}
		
		if (ERROR == "") {
			return true;
		} else{
			ERROR += "<br/><br/>";
			document.getElementById("errorDiv").innerHTML=ERROR;
			return false;
		}
	}


	
	function checkAmigosForm (f, idioma) {
		ERROR = "";
		if ((f.form_nombre.value == '') || (f.form_nombre.value == ' ') || (f.form_nombre.value == 'nombre') || (f.form_nombre.value == 'nom') || (f.form_nombre.value == 'name')) {
			if (idioma==1) {
				ERROR += "Por favor, introduzca su nombre.<br/>";
			} else if (idioma==2) {
				ERROR += "Per favor, ompleni el seu nom.<br/>";
			} else if (idioma==3) {
				ERROR += "Please enter your first name.<br/>";
			}
		}
	    
		if ((!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(f.emailpropio.value))) || (f.emailpropio.value == 'emailpropio')) {
			if (idioma==1) {
				ERROR += "Escriba una direccion email v&aacute;lida.<br/>";
			} else if (idioma==2) {
				ERROR += "L'email no es correcte.<br/>";
			} else if (idioma==3) {
				ERROR += "Please enter a valid email.<br/>";
			}
		}
		if ((f.form_nombre_amigo1.value == '') || (f.form_nombre_amigo1.value == ' ') || (f.form_nombre_amigo1.value == 'nombre amigo 1') || (f.form_nombre_amigo1.value == 'nom amic 1') || (f.form_nombre_amigo1.value == 'name')) {
			if (idioma==1) {
				ERROR += "Por favor, introduzca el nombre de su amigo.<br/>";
			} else if (idioma==2) {
				ERROR += "Per favor, ompleni el nom del sue amic.<br/>";
			} else if (idioma==3) {
				ERROR += "Please enter name.<br/>";
			}
		}
	    
		if ((!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(f.email1.value))) || (f.email1.value == 'email amigo 1')) {
			if (idioma==1) {
				ERROR += "Escriba una direccion email para el amigo v&aacute;lida.<br/>";
			} else if (idioma==2) {
				ERROR += "L'email del amic no es correcte.<br/>";
			} else if (idioma==3) {
				ERROR += "Please enter a valid email.<br/>";
			}
		}
		
		if (ERROR == "") {
			return true;
		} else{
			ERROR += "<br/><br/>";
			document.getElementById("errorDiv").innerHTML=ERROR;
			return false;
		}
	}

	
	
	function cambiarParam(param1, param2, change_param3) {
		if (param1.checked) var checked= '1';
		else var checked= '0';
		
		if (param2.value != checked) {
			document.aptSelectorForm.elements[change_param3.name].value = '1';
		} else 
			document.aptSelectorForm.elements[change_param3.name].value = '0';
	}
	
	
		
	
	// Controlamos si la fecha que nos están introduciendo es menor que el día actual
	function comprobarDiaNew(dateSel, dateSelFin, yearHoy, monthHoy, dayHoy, msg1, msg2) {	
		var fechaHoy= yearHoy + monthHoy + dayHoy;
		var fechaSel= dateSel.substr(6, 4) + dateSel.substr(3, 2) + dateSel.substr(0, 2);
		var fechaSelFin= dateSelFin.substr(6, 4) + dateSelFin.substr(3, 2) + dateSelFin.substr(0, 2);
		
		if (fechaHoy>fechaSel) {
			alert (msg1);
			return false;
		}
		if (fechaSelFin <= fechaSel) {
//			alert ('Departure date must be greater than the arrival.');
			alert (msg2);
			return false;
		}
		return true;
	}
