function send_info_card(md5_contactar){
	html = $.ajax({
		type: "POST",
		url: "/pr/send_info_credit_card/" + md5_contactar,
		async: false
  	 }).responseText;
	alert('The hidden details have been sent to you by email');
}

function generate_pdf(md5_contactar, id_lang){
	html = $.ajax({
		type: "POST",
		url: "/pr/pdf/" + md5_contactar + "/" + id_lang,
		async: false
  	 }).responseText;		
}

function estilos()
{
	navegador = navigator.appName
	version = parseInt(navigator.appVersion)
	if ((navegador=="Netscape") && (version < 5))
	{
		document.write('<link rel="stylesheet" href="/public/css/estilos_n.css" type="text/css">');	
	}else {	
		document.write('<link rel="stylesheet" href="/public/css/estilos.css" type="text/css">');		
	}
}

function dibuja_espacioh()
{
	if (screen.width > 800)
	{
		document.write ("<td bgcolor='#385674' width='115'></td>");
	}
}

function dibuja_espacio_home(alto)
{
	if (screen.height > 600)
	{
		document.write ("<tr><td height="+alto+" colspan='3'></td></tr>")
	}
}

var sumaAncho = 0;
function dibuja_espaciov()
{
  sumaAncho = 0;
	if (screen.width > 800)
	{
    sumaAncho = 115;
		document.write ("<td width='115' height='1'></td>")
	}
}
function recomienda(url){
	window.location="/home/recomienda/0/"+url;
}

function replace_1(texto,s1,s2){
	var texto_split = texto.split(s1);
	return texto_split.join(s2);
}


function coloca_foto(src){
	document.fotogrande.src=src;
}

function abrir_plano(ruta){
	window.open('Plano.jsp?ruta='+ruta+'','','resizable=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,height=400,width=400');		
}

function abrir_web(idHotel){
	window.open('/multi/estadisticas/botonweb/'+idHotel+'/1','','resizable=1,toolbar=1,location=1,directories=0,status=1,menubar=1,scrollbars=1,height=512,width=682');		
}


function abrir_reserva(idHotel,tipo){	
	window.open('/multi/contact_hotel/'+idHotel+'/'+tipo,'','resizable=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,height=550,width=610');		
}

function imprimir(idHotel)
{
	window.open('/multi/print_hotel/'+idHotel+'','','resizable=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,top=100,left=100,height=512,width=667');		
}

function print_voucher(md5_contactar, id_lang, action, msg_alert)
{

//		if (navigator.userAgent.toLowerCase()=="msie" )
//		{
			// The following change has been made otherwise IE will open the file 
			// browser on a different server session (on some cases):
			// http://support.microsoft.com/default.aspx?scid=kb;en-us;831678
			// by Simone Chiaretta.
			var oWindow = window.open('/pr/print_voucher/' + md5_contactar + "/" + id_lang + "/" + action,'','resizable=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,top=100,left=100,height=612,width=635');		
			if ( oWindow )
			{
				// Detect Yahoo popup blocker.
				try
				{
					var sTest = oWindow.name ; // Yahoo returns "something", but we can't access it, so detect that and avoid strange errors for the user.
					oWindow.opener = window ;
				}
				catch(e)
				{
					alert( msg_alert ) ;
				}
			}else{
				alert( msg_alert ) ;
			}
//	    }else{
//			window.open('/users/print_voucher/' + md5_contactar + "/" + id_lang,'','resizable=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,top=100,left=100,height=612,width=635');		
//		}



//	window.open('/users/print_voucher/' + md5_contactar + "/" + id_lang,'','resizable=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,top=100,left=100,height=612,width=635');		
}

function ir_tarifas()
{
	document.tarifas.focus()
}



function mailcorrecto(mail) {
	var c1,c2,c3,c4,c5,c6,cf;
	var len,i,error;
		len = mail.length;
		if (len==0) {
			return 0;
		} else {
			i=0;
			c1 = mail.charAt(i);
			cf = mail.charAt(len-1);
			i++;
			if (c1=='@' || c1=='.' || c1==' ' || cf=='@' || cf=='.' || cf==' ') {
				error=0; 
			} else {	
				while (i<len && c2!='@' && c2!=' ') {
					c2 = mail.charAt(i);
					i++;
				}
				if (c2!='@') error=0; 
				else {
					c3 = mail.charAt(i);
					i++;
					if (c3=='@' || c3=='.' || c3==' ') {
						error=0; 
					} else {
						while (i<len && c4!='.' && c4!='@' && c4!=' ') {
							c4 = mail.charAt(i);
							i++;
						}	
						if (c4!='.') error=0; 
						else {
							c5 = mail.charAt(i);
							if (c5!='.' && c5!='@' && c5!=' ') {
								while (i<len && c6!='.' && c6!='@' && c6!=' ') {
									c6 = mail.charAt(i);
									i++;
								}	
								if (c6=='@' || c6==' ') {
									error=0; 
								} else {
									error=1; 
								}
							} else error=0; 
						}
					}
				}	
			}
			return error;
		}	
}

function change_destinos(destino) {  
  country = $('#country').attr("value");

  var html = '';	 	
  if(country == undefined || country == '') country = "0";
  
  html = $.ajax({
	type: "POST",
	url: "/multi/get_destinos/" + country + "/" + destino,
	async: false
 }).responseText;
	
	var newOptions = unescape(html);
	newOptions = newOptions.replace(/\+/gi," ");
	
	$("#div_destinos").html(newOptions);		
}

function change_hoteles() {  
  country = $('#country').attr("value");
  destination = $('#destination').attr("value");

  var html = '';	 	
  if(country == undefined || country == '') country = "0";
  if(destination == undefined || destination == '') destination = "";
  
  html = $.ajax({
	type: "POST",
	url: "/multi/get_hoteles/" + country + "/" + destination,
	async: false
 }).responseText;
	
	var newOptions = unescape(html);
	newOptions = newOptions.replace(/\+/gi," ");
	
	$("#div_hoteles").html(newOptions);		
}

function hoteles_online(codigos_hoteles, check_in, check_out, nr_adults, orderby){
	var html = '';	 	

	html = $.ajax({
		type: "POST",
		data: "codigos_hoteles="+codigos_hoteles,
		url: "/multi/lista_disponibilidad/"+check_in+"/"+check_out + "/" + nr_adults + "/" + orderby,
		async: false
	 }).responseText;
	
	$("#hoteles_book_online").html(html);
}

function comprobar_search(content, home_search_name, empty_fields, invalid_date){
		if(content != "/mapas/paisCont" && content != "/listas/listHotelesCont" && content != "/listas/nuestraSeleccionCont" && content != '/listas/listHotels_homeCont'){ 
			if(($("#name_hotel_destination").attr("value") == undefined || $("#name_hotel_destination").attr("value") == '' || $("#name_hotel_destination").attr("value") == home_search_name) && ($('#country').attr("value") == undefined || $('#country').attr("value") == '0') && ($('#destination').attr("value") == undefined || $('#destination').attr("value") == '') && ($('#hotel').attr("value") == undefined || $('#hotel').attr("value") == '0')){
				alert(empty_fields);
				return false;
			}			
			
		}
	/*	fechaEntrada = $("#b_in").attr('value');			
		
		fechaEntradaV = fechaEntrada.split("-");
		var fechaEntradaStr = fechaEntradaV[1]+"/"+fechaEntradaV[2]+"/"+fechaEntradaV[0];		
		fechaE = new Date(fechaEntradaStr);
		var hoy= new Date();
		
		if(fechaE < hoy){
			alert(invalid_date);				
			return false;
		}*/			
		return true; 
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages(idioma) {
	if(idioma == 1){
	if (document.images) {
		gsh_mapa_franja_219x130_eng_01_Mapa_de_im_genes_RUSSIA_over = newImage("/public/img/left_map/eng/gsh-mapa-franja-219x130--02.gif");
		gsh_mapa_franja_219x130_eng_01_Mapa_de_im_genes_FAR_EAST_over = newImage("/public/img/left_map/eng/gsh-mapa-franja-219x130--03.gif");
		gsh_mapa_franja_219x130_eng_01_Mapa_de_im_genes_SOUTH_PACIFIC_over = newImage("/public/img/left_map/eng/gsh-mapa-franja-219x130--04.gif");
		gsh_mapa_franja_219x130_eng_01_Mapa_de_im_genes_MIDDLE_EAST_over = newImage("/public/img/left_map/eng/gsh-mapa-franja-219x130--05.gif");
		gsh_mapa_franja_219x130_eng_01_Mapa_de_im_genes_EUROPE_over = newImage("/public/img/left_map/eng/gsh-mapa-franja-219x130--06.gif");
		gsh_mapa_franja_219x130_eng_01_Mapa_de_im_genes_MEXICO_AND_CENTRAL_AMERICA_over = newImage("/public/img/left_map/eng/gsh-mapa-franja-219x130--07.gif");
		gsh_mapa_franja_219x130_eng_01_Mapa_de_im_genes_CARIBBEAN_over = newImage("/public/img/left_map/eng/gsh-mapa-franja-219x130--08.gif");
		gsh_mapa_franja_219x130_eng_01_Mapa_de_im_genes_CANADA_over = newImage("/public/img/left_map/eng/gsh-mapa-franja-219x130--09.gif");
		gsh_mapa_franja_219x130_eng_01_Mapa_de_im_genes_AFRICA_over = newImage("/public/img/left_map/eng/gsh-mapa-franja-219x130--10.gif");
		gsh_mapa_franja_219x130_eng_01_Mapa_de_im_genes_AUSTRALIA_over = newImage("/public/img/left_map/eng/gsh-mapa-franja-219x130--11.gif");
		gsh_mapa_franja_219x130_eng_01_Mapa_de_im_genes_SOUTH_AMERICA_over = newImage("/public/img/left_map/eng/gsh-mapa-franja-219x130--12.gif");
		gsh_mapa_franja_219x130_eng_01_Mapa_de_im_genes_UNITED_STATES_ALASKA_over = newImage("/public/img/left_map/eng/gsh-mapa-franja-219x130--13.gif");
		preloadFlag = true;
	}
	}
	else if(idioma == 2){
	if (document.images) {
		gsh_mapa_franja_219x130_esp_01_Mapa_de_im_genes_FEDERACION_RUSA_over = newImage("/public/img/left_map/es/gsh-mapa-franja-219x130--02.gif");
		gsh_mapa_franja_219x130_esp_01_Mapa_de_im_genes_LEJANO_ORIENTE_over = newImage("/public/img/left_map/es/gsh-mapa-franja-219x130--03.gif");
		gsh_mapa_franja_219x130_esp_01_Mapa_de_im_genes_OCEANIA_over = newImage("/public/img/left_map/es/gsh-mapa-franja-219x130--04.gif");
		gsh_mapa_franja_219x130_esp_01_Mapa_de_im_genes_ORIENTE_MEDIO_over = newImage("/public/img/left_map/es/gsh-mapa-franja-219x130--05.gif");
		gsh_mapa_franja_219x130_esp_01_Mapa_de_im_genes_EUROPA_over = newImage("/public/img/left_map/es/gsh-mapa-franja-219x130--06.gif");
		gsh_mapa_franja_219x130_esp_01_Mapa_de_im_genes_MEXICO_Y_CENTROAMERICA_over = newImage("/public/img/left_map/es/gsh-mapa-franja-219x130--07.gif");
		gsh_mapa_franja_219x130_esp_01_Mapa_de_im_genes_CARIBE__BAHAMAS_Y_BERMUDAS_over = newImage("/public/img/left_map/es/gsh-mapa-franja-219x130--08.gif");
		gsh_mapa_franja_219x130_esp_01_Mapa_de_im_genes_CANADA_over = newImage("/public/img/left_map/es/gsh-mapa-franja-219x130--09.gif");
		gsh_mapa_franja_219x130_esp_01_Mapa_de_im_genes_AFRICA_over = newImage("/public/img/left_map/es/gsh-mapa-franja-219x130--10.gif");
		gsh_mapa_franja_219x130_esp_01_Mapa_de_im_genes_AUSTRALIA_over = newImage("/public/img/left_map/es/gsh-mapa-franja-219x130--11.gif");
		gsh_mapa_franja_219x130_esp_01_Mapa_de_im_genes_AMERICA_DEL_SUR_over = newImage("/public/img/left_map/es/gsh-mapa-franja-219x130--12.gif");
		gsh_mapa_franja_219x130_esp_01_Mapa_de_im_genes_ESTADOS_UNIDOS_ALASKA_over = newImage("/public/img/left_map/es/gsh-mapa-franja-219x130--13.gif");
		preloadFlag = true;
	}
	}
	else if(idioma == 3){
	if (document.images) {
		gsh_mapa_franja_219x130_ale_01_Mapa_de_im_genes_RUSSISCHE_over = newImage("/public/img/left_map/al/gsh-mapa-franja-219x130--02.gif");
		gsh_mapa_franja_219x130_ale_01_Mapa_de_im_genes_FERNER_OSTEN_over = newImage("/public/img/left_map/al/gsh-mapa-franja-219x130--03.gif");
		gsh_mapa_franja_219x130_ale_01_Mapa_de_im_genes_OZEANIEN_over = newImage("/public/img/left_map/al/gsh-mapa-franja-219x130--04.gif");
		gsh_mapa_franja_219x130_ale_01_Mapa_de_im_genes_NAHER_OSTEN_over = newImage("/public/img/left_map/al/gsh-mapa-franja-219x130--05.gif");
		gsh_mapa_franja_219x130_ale_01_Mapa_de_im_genes_EUROPA_over = newImage("/public/img/left_map/al/gsh-mapa-franja-219x130--06.gif");
		gsh_mapa_franja_219x130_ale_01_Mapa_de_im_genes_MEXICO_UND_MITTELAMERIKA_over = newImage("/public/img/left_map/al/gsh-mapa-franja-219x130--07.gif");
		gsh_mapa_franja_219x130_ale_01_Mapa_de_im_genes_KARIBIK__BAHAMAS_UND_BERMUDA_over = newImage("/public/img/left_map/al/gsh-mapa-franja-219x130--08.gif");
		gsh_mapa_franja_219x130_ale_01_Mapa_de_im_genes_KANADA_over = newImage("/public/img/left_map/al/gsh-mapa-franja-219x130--09.gif");
		gsh_mapa_franja_219x130_ale_01_Mapa_de_im_genes_AFRIKA_over = newImage("/public/img/left_map/al/gsh-mapa-franja-219x130--10.gif");
		gsh_mapa_franja_219x130_ale_01_Mapa_de_im_genes_AUSTRALIEN_over = newImage("/public/img/left_map/al/gsh-mapa-franja-219x130--11.gif");
		gsh_mapa_franja_219x130_ale_01_Mapa_de_im_genes_SUDAMERIKA_over = newImage("/public/img/left_map/al/gsh-mapa-franja-219x130--12.gif");
		gsh_mapa_franja_219x130_ale_01_Mapa_de_im_genes_USA_ALASKA_over = newImage("/public/img/left_map/al/gsh-mapa-franja-219x130--13.gif");
		preloadFlag = true;
	}
	}
	else if(idioma == 4){
	if (document.images) {
		gsh_mapa_franja_219x130_fr_01_Mapa_de_im_genes_RUSSIE_over = newImage("/public/img/left_map/fr/gsh-mapa-franja-219x130--02.gif");
		gsh_mapa_franja_219x130_fr_01_Mapa_de_im_genes_EXTREME_ORIENT_over = newImage("/public/img/left_map/fr/gsh-mapa-franja-219x130--03.gif");
		gsh_mapa_franja_219x130_fr_01_Mapa_de_im_genes_OCEANIE_over = newImage("/public/img/left_map/fr/gsh-mapa-franja-219x130--04.gif");
		gsh_mapa_franja_219x130_fr_01_Mapa_de_im_genes_MOVEN_ORIENT_over = newImage("/public/img/left_map/fr/gsh-mapa-franja-219x130--05.gif");
		gsh_mapa_franja_219x130_fr_01_Mapa_de_im_genes_EUROPE_over = newImage("/public/img/left_map/fr/gsh-mapa-franja-219x130--06.gif");
		gsh_mapa_franja_219x130_fr_01_Mapa_de_im_genes_MEXIQUE_ET_L_AMERIQUE_CENTRALE__BOUTIQUE_HOT_over = newImage("/public/img/left_map/fr/gsh-mapa-franja-219x130--07.gif");
		gsh_mapa_franja_219x130_fr_01_Mapa_de_im_genes_CARAIBE__BAHAMAS_ET_BERMUDES_over = newImage("/public/img/left_map/fr/gsh-mapa-franja-219x130--08.gif");
		gsh_mapa_franja_219x130_fr_01_Mapa_de_im_genes_CANADA_over = newImage("/public/img/left_map/fr/gsh-mapa-franja-219x130--09.gif");
		gsh_mapa_franja_219x130_fr_01_Mapa_de_im_genes_AFRIQUE_over = newImage("/public/img/left_map/fr/gsh-mapa-franja-219x130--10.gif");
		gsh_mapa_franja_219x130_fr_01_Mapa_de_im_genes_AUSTRALIE_over = newImage("/public/img/left_map/fr/gsh-mapa-franja-219x130--11.gif");
		gsh_mapa_franja_219x130_fr_01_Mapa_de_im_genes_AMERIQUE_DU_SUD___over = newImage("/public/img/left_map/fr/gsh-mapa-franja-219x130--12.gif");
		gsh_mapa_franja_219x130_fr_01_Mapa_de_im_genes_ETATS_UNIS_ALASKA_over = newImage("/public/img/left_map/fr/gsh-mapa-franja-219x130--13.gif");
		preloadFlag = true;
	}
	}
}

function doSubmit(id_form, action){
	$("#"+id_form).attr('action', action);
	$("#"+id_form).submit(); 
}

function comprueba_boletin(boletin_mail_requerido, boletin_mail_valido){		
		if ($('#email_home').attr("value") == undefined || $('#email_home').attr("value")=="") {
		  alert(boletin_mail_requerido);
		  $('#email_home').focus();
		  return false;
		}else if (!mailcorrecto($('#email_home').attr("value"))) {
		  alert(boletin_mail_valido);
		  $('#email_home').focus();
		 return false;
		}else $("#form_boletin").submit();
	}