//*** ventana centrada ***
function ventanaCentrada(doc,nombre,anchura,altura, noScroll){
	noScroll = noScroll ? "no" : "yes";
	xpos = ((screen.width)/2)-(anchura/2);
	ypos = ((screen.height)/2)-(altura/2);
	ventanaFlotante = window.open(doc,nombre,'width='+anchura+',height='+altura+',left='+xpos+',top='+ypos+'directories=0,resizable=0,location=0,status=0,scrollbars='+noScroll+',toolbar=0,menubar=0,titlebar=1');
}


//*** Menú lateral izquierdo ***
function rescatalink(src) {
	if(event.srcElement.tagName=='TD'){
	src.children.tags('A')[0].click();
	}
}


//*** preload imagenes para roollover ***
function preload(imgObj,imgSrc) {
	if (document.images) {
		eval(imgObj+' = new Image()')
		eval(imgObj+'.src = "'+imgSrc+'"')
	}
}


//*** css formularios ***
function cambiaCSS(obj, nombreCSS)	{
	obj.className = nombreCSS;
}

//*** cif/nif ***
function validacifnif (cif){
if (cif != "") {
  par = 0
  non = 0
  letras="ABCDEFGHKLMNPQS"
  let=cif.charAt(0)
  
  if (!isNaN(let))  {
    nif=cif
    validar(nif)
    return false
    }
  
  if (cif.length!=9)  {
    alert('Debe de tener 9 dígitos.')
    return false
    }
  
  if (letras.indexOf(let.toUpperCase())==-1)  {
    alert("El dato no es correcto, por favor vuelva a intentarlo.")
    return false
    }
  
  for (zz=2;zz<8;zz+=2)  {
    par = par+parseInt(cif.charAt(zz))
    }
  
  for (zz=1;zz<9;zz+=2)  {
    nn = 2*parseInt(cif.charAt(zz))
    if (nn > 9) nn = 1+(nn-10)
    non = non+nn
    }
  
  parcial = par + non
  control = (10 - ( parcial % 10))
  
  if (control==10) control=0
  if (control!=cif.charAt(8))  {
    alert("El dato no es correcto, por favor vuelva a intentarlo.")
    return false
    }
  //alert("El Cif es válido")
  }
  
  function validar(abc){
  dni=abc.substring(0,abc.length-1)
  let=abc.charAt(abc.length-1)
  if (!isNaN(let)) {
    alert('Falta la letra.')
    return false
   } else {
    cadena="TRWAGMYFPDXBNJZSQVHLCKET"
    posicion = dni % 23
    letra = cadena.substring(posicion,posicion+1)
    if (letra!=let.toUpperCase())   {
      alert("El dato no es correcto, por favor vuelva a intentarlo.")
      return false
     }
   }
  //alert("Nif válido")
}

}

//*** chekea campo mail ***
function check_email(e) {
	ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
	for(i=0; i < e.length ;i++) {
		if(ok.indexOf(e.charAt(i))<0) {
			return (false);
		}	
	}
	
	if (document.images) {
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!e.match(re) && e.match(re_two)) {
			return (-1);		
		} 
	}
}




//*** chekea vencimiento tarjeta credito ***
function vencetarjeta (m, a, asd) {
	asd.value = ""
	fecha = new Date(); 
	mes = fecha.getMonth()+1
	anio = fecha.getYear()
	if (a == anio) { 
		if (m > mes) {
			asd.value = 1
		} else {
			asd.value = ""
		}
	}
	if (a > anio) {
		asd.value = 1
	} 
}




function compruebaEmail(obj) 	{
	msg = "La dirección de correo electrónico introducida no es correcta.\nPor favor, introduce una dirección válida.";
	if (obj.value!="")
		if (!check_email(obj.value)) 	{
			alert (msg);
			obj.focus();
			return false
		}
}
	
	
function testForm()	{
	msg = "Debe rellenar todos los datos ogligatorios.\n\nFaltan:\n\n";
	camposNoRellenados = new Array();
	cont = 0;
	primero = "";
	
	if (document.getElementById("aceptoLegal").checked == true) {
		
			for (i=0;i<camposObligatorios.length;i++) {
				if (camposObligatorios[i].indexOf(";") != -1) {
					chbox = new Array();
					chbox = camposObligatorios[i].split(";");
					valor = "";
					
					for (p=0;p<chbox.length;p++) {
						if (chbox[p].length > 1 && document.getElementById(chbox[p]).checked == true) {
							valor = "ok";
						}
					}
					if (primero == "") {
						primero = chbox[0];
					}
				} else {
					elemento = document.getElementById(camposObligatorios[i]);
					valor = elemento.value;
					if (primero == "") {
						primero = camposObligatorios[i];
					}
				}
				if (valor == undefined || valor == "" || valor == null) {
					camposNoRellenados[cont++] = textoCamposObligatorios[i];
				}
			}
			
			if (cont > 0) {
		
				for (i=0;i<cont;i++) { msg += " · "+camposNoRellenados[i]+".\n";}
				alert (msg);
				//document.getElementById(primero).focus();
			} else {
				document.formulario1.submit()
			}
			
	} else {
		
		alert ("Debe aceptar la clausula legal");
	}
}




function testForm1()	{
	camposObligatorios = new Array ("nombre", "email", "comentarios");
	textoCamposObligatorios = new Array ("Nombre", "Correo electrónico", "Comentarios");
	msg = "Debe rellenar todos los datos ogligatorios.\n\nFaltan:\n\n";
	camposNoRellenados = new Array();
	cont = 0;
	primero = "";
	
		
			for (i=0;i<camposObligatorios.length;i++) {
				if (camposObligatorios[i].indexOf(";") != -1) {
					chbox = new Array();
					chbox = camposObligatorios[i].split(";");
					valor = "";
					
					for (p=0;p<chbox.length;p++) {
						if (chbox[p].length > 1 && document.getElementById(chbox[p]).checked == true) {
							valor = "ok";
						}
					}
					if (primero == "") {
						primero = chbox[0];
					}
				} else {
					elemento = document.getElementById(camposObligatorios[i]);
					valor = elemento.value;
					if (primero == "") {
						primero = camposObligatorios[i];
					}
				}
				if (valor == undefined || valor == "" || valor == null) {
					camposNoRellenados[cont++] = textoCamposObligatorios[i];
				}
			}
			
			if (cont > 0) {
		
				for (i=0;i<cont;i++) { msg += " · "+camposNoRellenados[i]+".\n";}
				alert (msg);
				//document.getElementById(primero).focus();
			} else {
				document.formulario1.submit()
			}
}


function testForm2()	{
	hoteles = new Array
	hotelestxt = new Array
	tarjeta2 = new Array
	tarjeta2txt = new Array	
	facturacion1hot = new Array	
	facturacion1hottxt = new Array	
	personales = new Array ("apellidos", "nombre", "direccion", "cp", "ciudad", "pais", "telefono", "email", "cifnif");
	personalestxt = new Array ("Apellidos", "Nombre", "Dirección", "Código postal", "Ciudad", "País", "Teléfono", "Correo electrónico", "NIF");

	if (getRadioButtonSelectedValue(document.formulario1.formadepago1) == 0){
	ValidarTJ (document.formulario1.pagoi_numa.value, document.formulario1.pagoi_numb.value, document.formulario1.pagoi_numc.value, document.formulario1.pagoi_numd.value, "inscripción")
	tarjeta1 = new Array ("pagoi_tarjeta_oculto","pagoi_tarjeta_ok", "pagoi_titular", "pagoi_fechaok", "pagoi_ccc")
	tarjeta1txt = new Array ("Inscripción: Tipo de tarjeta","Inscripción: Número de tarjeta",  "Inscripción: Titular de la tarjeta", "Inscripción: Caducidad de la tarjeta", "Inscripción: Código de seguridad de la tarjeta")
	} else {
	tarjeta1 = new Array
	tarjeta1txt = new Array
	}
	
		
	if (document.formulario1.pagoi_transferencia.checked) {	
		tarjeta1 = new Array ("pagoi_comprobante")
		tarjeta1txt = new Array ("Comprobante de pago")
	}
	
	
	
	if (getRadioButtonSelectedValue(document.formulario1.facturacion) == 1){
		facturacion1 = new Array ("factu1_apellidos", "factu1_nombre", "factu1_nif", "factu1_direccion")
		facturacion1txt = new Array ("Facturación: Apellidos", "Facturación: Nombre", "Facturación: NIF", "Facturación: Dirección de facturación")
	} else {
		facturacion1 = new Array ("factu2_empresa", "factu2_cif", "factu2_direccion");
		facturacion1txt = new Array ("Facturación: Nombre de la Empresa", "Facturación: CIF", "Facturación: Dirección fiscal de la empresa");
	}
	
	
	
	
	
	if (getRadioButtonSelectedValue(document.formulario1.reserva) == 1){
	hoteles = new Array ("hotel1")
	hotelestxt = new Array ("Eleccion de Hotel")
	
		if (document.formulario1.hotel1.options.value.length > 0) {
			hoteles = new Array ("hotel_noreservas", "hotel_noches_total")
			hotelestxt = new Array ("Reservas de habitaciones", "Dias de reservas")
		
			if (getRadioButtonSelectedValue(document.formulario1.formadepago2) == 0) {	
				ValidarTJ2 (document.formulario1.pagoh_numa.value, document.formulario1.pagoh_numb.value, document.formulario1.pagoh_numc.value, document.formulario1.pagoh_numd.value, "hotel")
				tarjeta2 = new Array ("pagoh_tarjeta_oculto", "pagoh_tarjeta_ok", "pagoh_titular", "pagoh_fechaok", "pagoh_ccc")
				tarjeta2txt = new Array ("Hotel: Tipo de tarjeta","Hotel: Número de tarjeta", "Hotel: Titular de la tarjeta", "Hotel: Caducidad de la tarjeta", "Hotel: Código de seguridad de la tarjeta")
				
			}
			
			if (document.formulario1.pagoh_transferencia.checked) {	
				tarjeta1 = new Array ("pagoh_comprobante")
				tarjeta1txt = new Array ("Comprobante de pago")
			}
		}
		
		
		if (getRadioButtonSelectedValue(document.formulario1.facturacion_hotel) == 1){
			facturacion1hot = new Array ("factu1_hotel_apellidos", "factu1_hotel_nombre", "factu1_hotel_nif", "factu1_hotel_direccion")
			facturacion1hottxt = new Array ("Facturación del hotel: Apellidos", "Facturación del hotel: Nombre", "Facturación del hotel: NIF", "Facturación del hotel: Dirección de facturación")
		}
		if (getRadioButtonSelectedValue(document.formulario1.facturacion_hotel) == 0){
			facturacion1hot = new Array ("factu2_hotel_empresa", "factu2_hotel_cif", "factu2_hotel_direccion");
			facturacion1hottxt = new Array ("Facturación del hotel: Nombre de la Empresa", "Facturación del hotel: CIF", "Facturación del hotel: Dirección fiscal de la empresa");
		}
		if (getRadioButtonSelectedValue(document.formulario1.facturacion_hotel) == 2){
			facturacion1hot = new Array ();
			facturacion1hottxt = new Array ();
		}			
		
		
		
		
		
	}
	
	
	inspago = personales.concat (tarjeta1, facturacion1)
	inspagotxt = personalestxt.concat (tarjeta1txt, facturacion1txt)
	
	hotpago = hoteles.concat (tarjeta2, facturacion1hot)
	hotpagotxt = hotelestxt.concat (tarjeta2txt, facturacion1hottxt)
	
	datofinal =  inspago.concat(hotpago)
	datofinaltxt =  inspagotxt.concat(hotpagotxt)
	

	camposObligatorios = datofinal
	textoCamposObligatorios = datofinaltxt
	
	testForm()
}



function testForm3()	{	
	personal = new Array("apellidos", "nombre", "direccion", "cp", "ciudad", "pais", "telefono", "email", "cifnif")
	personaltxt = new Array("Apellidos", "Nombre", "Direccion", "Código Postal", "Ciudad", "País", "Teléfono", "Correo electrónico", "NIF")
	if (document.getElementById('poster_radio1').checked){	
		var poster = new Array("poster_archivo1");
		var postertxt = new Array("Adjuntar fichero");
	}
	
	if (document.getElementById('poster_radio2').checked){	
		var poster = new Array("poster_archivo2");
		var postertxt = new Array("Adjuntar fichero");
	}
	
	if (document.getElementById('poster_radio3').checked){	
		var poster = new Array("poster_archivo3");
		var postertxt = new Array("Adjuntar fichero");
	}
	
	datofinal =  personal.concat(poster)
	datofinaltxt =  personaltxt.concat(postertxt)
	

	camposObligatorios = datofinal
	textoCamposObligatorios = datofinaltxt
	
	testForm()
}






// Funcion que comprueba que "valor" es un numero entero
function EsNumeroEntero(valor){
    var cadena = valor.toString();
	var longitud = cadena.length;
	if (longitud == 0){return false;}
	var ascii = null;
    for (var i=0; i<longitud; i++) {
		ascii = cadena.charCodeAt(i);
        if (ascii < 48 || ascii > 57){return false;}
    }
	return true;
}


// Funcion que valida la tarjeta de credito
function ValidarTJ(numa,numb,numc,numd,seccion) {
	if  (numa.length + numb.length + numc.length + numd.length == 16){
		document.formulario1.pagoi_tarjeta_ok.value = "1"
	} else {
		document.formulario1.pagoi_tarjeta_ok.value = ""
		alert ("El número de tarjeta en la sección inscripción es incorrecto");
	};
}


function ValidarTJ2(numa,numb,numc,numd,seccion) {

	if  (numa.length + numb.length + numc.length + numd.length == 16){
		document.formulario1.pagoh_tarjeta_ok.value = "1"
	} else {
		document.formulario1.pagoh_tarjeta_ok.value = ""
		alert ("El número de tarjeta en la sección hotel es incorrecto");
	};
}



function numbersonly(myfield, e, dec){
	var key;
	var keychar;
	
	if (window.event)
	   key = window.event.keyCode;
	else if (e)
	   key = e.which;
	else
	   return true;
	keychar = String.fromCharCode(key);
	
	// control keys
	if ((key==null) || (key==0) || (key==8) ||
	    (key==9) || (key==13) || (key==27) )
	   return true;
	
	// numbers
	else if ((("0123456789").indexOf(keychar) > -1))
	   return true;
	
	// decimal point jump
	else if (dec && (keychar == "."))
	   {
	   myfield.form.elements[dec].focus();
	   return false;
	   }
	else
	   return false;
}



function definepagoi(){
document.formulario1.pagoi_tarjeta_oculto.value = getRadioButtonSelectedValue(document.formulario1.pagoi_tarjeta)
} 

function definepagoh(){
document.formulario1.pagoh_tarjeta_oculto.value = getRadioButtonSelectedValue(document.formulario1.pagoh_tarjeta)
} 


function transferencia1(){

if (document.getElementById('pagoi_transferencia').checked) {
document.getElementById('pagoi_comprobante').disabled= false
} 

if (document.getElementById('pagoi_transferencia').checked == false) {
document.getElementById('pagoi_comprobante').disabled= true
}

}

function transferencia2(){

if (document.getElementById('pagoh_transferencia').checked) {
document.getElementById('pagoh_comprobante').disabled= false
} 

if (document.getElementById('pagoh_transferencia').checked == false) {
document.getElementById('pagoh_comprobante').disabled= true
}

}


function muestrahotel() {
	document.getElementById('hotel').style.display='';
}

function ocultahotel() {
	document.getElementById('hotel').style.display='none';
}


function muestrapago1() {
	document.formulario1.pagoi_tarjeta_oculto.value = ""
	document.getElementById('pagoi_transferencia').checked= false
	document.getElementById('pagoi_comprobante').disabled= true
	document.getElementById('pago1c').style.display='none';
	document.getElementById('pago1t').style.display='';
	document.formulario1.formadepago2[2].disabled= true
}

function ocultapago1() {
	document.formulario1.pagoi_tarjeta_oculto.value = ""
	document.getElementById('pagoi_transferencia').checked= false
	document.getElementById('pagoi_comprobante').disabled= true
	document.getElementById('pago1c').style.display='';
	document.getElementById('pago1t').style.display='none';
	document.formulario1.formadepago2[2].disabled= false
}


function muestrapago2() {
	document.formulario1.pagoh_tarjeta_oculto.value = ""
	document.getElementById('pagoh_transferencia').checked= false
	document.getElementById('pagoh_comprobante').disabled= true
	document.getElementById('pago2c').style.display='none';
	document.getElementById('pago2t').style.display='';
}

function ocultapago2() {
	document.formulario1.pagoh_tarjeta_oculto.value = ""
	document.getElementById('pagoh_transferencia').checked= false
	document.getElementById('pagoh_comprobante').disabled= true
	document.getElementById('pago2c').style.display='';
	document.getElementById('pago2t').style.display='none';
}

function clonapago2() {
	document.formulario1.pagoh_tarjeta_oculto.value = ""
	document.getElementById('pagoh_transferencia').checked= false
	document.getElementById('pagoh_comprobante').disabled= true
	document.getElementById('pago2c').style.display='none';
	document.getElementById('pago2t').style.display='none';
}


function muestrafactu() {
	document.getElementById('factu1').style.display='none';
	document.getElementById('factu2').style.display='';
}

function ocultafactu() {
	document.getElementById('factu1').style.display='';

	document.getElementById('factu2').style.display='none';
}


function muestrafactuhotel() {
	document.getElementById('factu1hotel').style.display='none';
	document.getElementById('factu2hotel').style.display='';
}

function ocultafactuhotel() {
	document.getElementById('factu1hotel').style.display='';
	document.getElementById('factu2hotel').style.display='none';
}

function antesfactuhotel() {
	document.getElementById('factu1hotel').style.display='none';
	document.getElementById('factu2hotel').style.display='none';
}
 










function muestraposter1() {
		document.getElementById('poster_archivo1').reset = true
		document.getElementById('poster_archivo2').reset = true
		document.getElementById('poster_archivo3').reset = true		
	document.getElementById('poster1').style.display='';
	document.getElementById('poster2').style.display='none';
	document.getElementById('poster3').style.display='none';
}

function muestraposter2() {
		document.getElementById('poster_archivo1').reset = true
		document.getElementById('poster_archivo2').reset = true
		document.getElementById('poster_archivo3').reset = true			
	document.getElementById('poster1').style.display='none';
	document.getElementById('poster2').style.display='';
	document.getElementById('poster3').style.display='none';
}

function muestraposter3() {
		document.getElementById('poster_archivo1').reset = true
		document.getElementById('poster_archivo2').reset = true
		document.getElementById('poster_archivo3').reset = true			
	document.getElementById('poster1').style.display='none';
	document.getElementById('poster2').style.display='none';
	document.getElementById('poster3').style.display='';
}












function muestralegales() {
	if (document.getElementById('legales').style.display=="none") {
		document.getElementById('legales').style.display="";
	} else {
		document.getElementById('legales').style.display="none";
	}
}


function muestralegales2() {
	if (document.getElementById('legales2').style.display=="none") {
		document.getElementById('legales2').style.display="";
	} else {
		document.getElementById('legales2').style.display="none";
	}
}



function formatCurrency(num) {
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
	num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
	num = num.substring(0,num.length-(4*i+3))+'.'+
	num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + num );
}


function hotelreserva (){

	rhotel= new Array()
	rhotel[0]=""
	rhotel[1]="<img src='img/propias/hotel_1.JPG' border='0' vspace='10' align='absmiddle'>"
	rhotel[2]="<img src='img/propias/hotel_2.JPG' border='0' vspace='10' align='absmiddle'>"
	
	desc= new Array()
	desc[0]=""
	desc[1]="<br> El hotel InterContinental Madrid, se encuentra en el área cultural y de negocios de una de las calles más conocidas de la ciudad, se ubica en un antiguo palacio del siglo XVIII. Está muy bien comunicado con los Museos del Prado, Thyssen-Bornemisza, Reina Sofia, el estadio Santiago Bernabéu, la elegante calle comercial de Serrano, el Palacio Real. Este hotel de estilo clásico cuenta con unas impresionantes instalaciones, tanto en habitaciones como en el resto del edificio y ofrece un extraordinario servicio.<br><br><a href='http://www.ichotelsgroup.com/intercontinental/es/us/locations/madrid' class='link' target='_blank'>http://www.ichotelsgroup.com</a><br><br>"
	
	desc[2]="<br>El hotel Hesperia Emperatriz disfruta de una ubicación ideal en una tranquila calle cercana al transitado Paseo de la Castellana, en pleno centro de Madrid.<br><br>Construido en un edificio clásico, el establecimiento cuenta con 158 encantadoras habitaciones totalmente equipadas y amuebladas con un estilo clásico y acogedor combinando antigüedades y piezas modernas.<br><br><a href='http://www.hesperia.es/hoteles/Hesperia-Emperatriz/' class='link' target='_blank'>http://www.www.hesperia.es/hoteles/Hesperia-Emperatriz/</a><br><br>"
	

	indice= document.formulario1.hotel1.selectedIndex
	
	titulohotel.innerHTML = document.formulario1.hotel1.options[document.formulario1.hotel1.selectedIndex].value
	imagenhotel.innerHTML = rhotel[indice]
	textohotel.innerHTML  = desc[indice]

	calcula(document.formulario1.desde.value, document.formulario1.hasta.value)
}

function none() {
	descripcionreserva.innerHTML = ""
	resultadoreserva.innerHTML = "<font class='subtitulo'>Selecciona hotel ,reservas de habitación y fechas en el formulario.</font>"
}

function calcula (desde , hasta){

	indivi= new Array()
	indivi[0]=""
	indivi[1]="227"
	indivi[2]="116"
	
	dual= new Array()
	dual[0]=""
	dual[1]="250"
	dual[2]="130"

	indice= document.formulario1.hotel1.selectedIndex

	today = new Date(desde)
	BigDay = new Date(hasta)
	msPerDay = 24 * 60 * 60 * 1000 ;
	timeLeft = (BigDay.getTime() - today.getTime());
	e_daysLeft = timeLeft / msPerDay;
	daysLeft = Math.floor(e_daysLeft);
	
	rhotel = document.formulario1.hotel1.options[document.formulario1.hotel1.selectedIndex].value
	rhotel2 = document.formulario1.hotel2.options[document.formulario1.hotel2.selectedIndex].value
	
	reserv_indiv = document.formulario1.rindividuales.value *1
	reserv_dobles = document.formulario1.rdobles.value *1
	
	desde2= document.formulario1.desde.options[document.formulario1.desde.selectedIndex].text
	hasta2= document.formulario1.hasta.options[document.formulario1.hasta.selectedIndex].text
	
	totalreserva= ((reserv_indiv * indivi[indice])+(reserv_dobles * dual[indice]))*daysLeft
	condireservas = ((reserv_dobles *1) + (reserv_indiv *1)) *1

	
	if (reserv_indiv == 1){
	reserv_indiv_texto = " habitación individual"
	} else {
	reserv_indiv_texto = " habitaciones individuales"
	}
	
	if (reserv_dobles == 1){
	reserv_dobles_texto = " habitación doble"
	} else {
	reserv_dobles_texto = " habitaciones dobles"
	}
	
	if (daysLeft > 1){
	nochetxt = "noches"
	} else {
	nochetxt = "noche"
	}
	
	
	if (condireservas > 1){
	reservastxt = "reservas"
	} else {
	reservastxt = "reserva"
	}
	
	if (condireservas>0){
	
		descripcionreserva.innerHTML = "Reserva de " + daysLeft + " " + nochetxt + " en el hotel " + rhotel + ", reservando " + reserv_indiv + reserv_indiv_texto + " y " + reserv_dobles  + reserv_dobles_texto + " desde el " + desde2 + " hasta el " + hasta2 + ".";

		resultadoreserva.innerHTML = "<span class='subtitulo'>" + daysLeft + " " +   nochetxt + " x " + condireservas + " " + reservastxt + " :&nbsp;&nbsp;</span><span class='precio_total'>"+ formatCurrency(totalreserva) +"&nbsp;€</span>"

	/*	areaoculta.innerHTML = "<input name='hotel_noches_total' type='hidden' value='"+ daysLeft +"' size='2'><input name='hotel_habitaciones_indivi' type='hidden' value='"+ reserv_indiv +"' size='2'><input name='hotel_habitaciones_dobles' type='hidden' value='"+ reserv_dobles +"' size='2'><input name='hotel_precio_simple' type='hidden' value='"+ indivi[indice] +"' size='2'><input name='hotel_precio_doble' type='hidden' value='"+ dual[indice] +"' size='2'><input name='hotel_entrada' type='hidden' value='"+ desde +"' size='12'><input name='hotel_salida' type='hidden' value='"+ hasta +"' size='12'><input name='hotel_totales' type='hidden' value='"+ totalreserva +"' size='2'><input name='rhotel_eleccion1' type='hidden' value='"+ rhotel +"' size='2'><input name='rhotel_eleccion2' type='hidden' value='"+ rhotel2 +"' size='2'><input name='rhotel_eleccion3' type='hidden' value='"+ rhotel3 +"' size='2'>"

*/
document.formulario1.hotel_noches_total.value = daysLeft
document.formulario1.hotel_habitaciones_indivi.value = reserv_indiv
document.formulario1.hotel_habitaciones_dobles.value = reserv_dobles
document.formulario1.hotel_precio_simple.value = indivi[indice]
document.formulario1.hotel_precio_doble.value = dual[indice]
document.formulario1.hotel_entrada.value = desde
document.formulario1.hotel_salida.value = hasta
document.formulario1.hotel_totales.value = totalreserva
document.formulario1.rhotel_eleccion1.value = rhotel
document.formulario1.rhotel_eleccion2.value = rhotel2
if ((reserv_indiv + reserv_dobles) == 0){
document.formulario1.hotel_noreservas.value = ""
} else {
document.formulario1.hotel_noreservas.value = reserv_indiv + reserv_dobles
}


	} else {
	document.formulario1.hotel_noches_total.value = daysLeft
document.formulario1.hotel_habitaciones_indivi.value = reserv_indiv
document.formulario1.hotel_habitaciones_dobles.value = reserv_dobles
document.formulario1.hotel_precio_simple.value = indivi[indice]
document.formulario1.hotel_precio_doble.value = dual[indice]
document.formulario1.hotel_entrada.value = desde
document.formulario1.hotel_salida.value = hasta
document.formulario1.hotel_totales.value = totalreserva
document.formulario1.rhotel_eleccion1.value = rhotel
document.formulario1.rhotel_eleccion2.value = rhotel2
if ((reserv_indiv + reserv_dobles) == 0){
document.formulario1.hotel_noreservas.value = ""
} else {
document.formulario1.hotel_noreservas.value = reserv_indiv + reserv_dobles
}

		none()
	}
	if (daysLeft <= 0){
		none()
	}
	if ((document.formulario1.hotel1.options[document.formulario1.hotel1.selectedIndex].index) < 1){
		none()
	}
}

function getRadioButtonSelectedValue(ctrl){
    for(i=0;i<ctrl.length;i++)
        if(ctrl[i].checked) return ctrl[i].value;
}


function resultadototal(){
	antes = new Array ()
	antes[0] = 0
	antes[1] = 638 
	antes[2] = 850 
	antes[3] = 500 
	
	medio = new Array ()
	medio[0] = 0
	medio[1] = 750 
	medio[2] = 1000
	medio[3] = 650 
	
	despues = new Array ()
	despues[0] = 0
	despues[1] = 938 
	despues[2] = 1250 
	despues[3] = 850 
	
	if (document.formulario1.tarde.value == 0){
		var rtotal1 = antes[getRadioButtonSelectedValue(document.formulario1.cirusecpre)]
	} 
	
	if (document.formulario1.tarde.value == 1){
		var rtotal1 = medio[getRadioButtonSelectedValue(document.formulario1.cirusecpre)]
	}
	
	if (document.formulario1.tarde.value == 2){
		var rtotal1 = despues[getRadioButtonSelectedValue(document.formulario1.cirusecpre)]
	}
	
	rtotal =  rtotal1
	
	resultadoinscripcion.innerHTML= "<span class='subtitulo'>IMPORTE TOTAL INSCRIPCIÓN :&nbsp;&nbsp;</span><span class='precio_total'>" + formatCurrency(rtotal) + "&nbsp;€</span><input type='hidden' name='inscripciontotal' value='"+formatCurrency(rtotal)+"'>"
}


function generaParticipantes () {
cuantos = (document.formulario1.cuantosparticipan.options[document.formulario1.cuantosparticipan.selectedIndex].value)*1
generaparti.innerHTML= ""
for (var x = 1; x <= cuantos; x++) {
generaparti.innerHTML += "<strong>&middot;&nbsp;&nbsp;&nbsp;&nbsp;Coautor " + x + "&nbsp;>></strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nombre:&nbsp;<input size='11' name='co" + x + "nombre' type='text' class='campo_input'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Apellidos:&nbsp;<input size='11' name='co" + x + "apellidos' type='text' class='campo_input'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Centro:&nbsp;<input size='11' name='co" + x + "centro' type='text' class='campo_input'><br><br>"
}
generaparti.innerHTML += "<input type='hidden' name='cuantos' value='" + cuantos + "'>"
}