		
	function copiarnick() 
	{
		if ('' == 'R') 
		{
			window.document.form.txtnick1.value = window.document.form.usuario.value
		}
	}

	function setearTexto(obj,campo) 
	{
		var elemento = eval("document.form."+campo);
		elemento.value = obj.options[obj.selectedIndex].text;
		return true;
	}

	function atrapar_enter()
	{
		if (window.event.keyCode==13) Ingresar();
	}


	function Continuar()
	{
		var error = 0;
		var control='';		

		email=jtrim(window.document.form.email.value)
		arroba=etrim(email)
		if (arroba == -1)
		{
			return
		}
		else 
		{
			if (email == "")
			{
				document.getElementById("errorMail").style.display = "block";
				document.getElementById("errorEmailInvalido").style.display = "none";
				document.getElementById("lblemail").style.display = "none";
				if (control=='')
					control = 'email';
				error = 1;
			}
			else 
			{
				if (ValidarMail(email))
				{
					document.getElementById("errorEmailInvalido").style.display = "block";
					document.getElementById("errorMail").style.display = "none";
					document.getElementById("lblemail").style.display = "none";
					if (control=='')
						control = 'email';
					error = 1;
				}else
				{
					document.getElementById("errorMail").style.display = "none";
					document.getElementById("errorEmailInvalido").style.display = "none";					
					document.getElementById("lblemail").style.display = "block";
				}
			}
		}


		

		nombre = jtrim(window.document.form.nombre.value)
		if (nombre == "")
		{
			document.getElementById("errorNombre").style.display = "block";
			document.getElementById("lblnombre").style.display = "none";
			if (control=='')
				control = 'nombre';
			error = 1;
		}else
		{
			document.getElementById("errorNombre").style.display = "none";
			document.getElementById("lblnombre").style.display = "block";
		}

		apellido = jtrim(window.document.form.apellido.value)
		if ( apellido == "")
		{
			document.getElementById("errorApellido").style.display = "block";
			document.getElementById("lblapellido").style.display = "none";
			if (control=='')
				control = 'apellido';
			error = 1;
		}else
		{
			document.getElementById("errorApellido").style.display = "none";
			document.getElementById("lblapellido").style.display = "block";
		}
		
		direccion = jtrim(window.document.form.direccion.value)
		if ( direccion == "")
		{
			document.getElementById("errordireccion").style.display = "block";
			document.getElementById("lbldireccion").style.display = "none";
			if (control=='')
				control = 'direccion';
			error = 1;
		}else
		{
			document.getElementById("errordireccion").style.display = "none";
			document.getElementById("lbldireccion").style.display = "block";
		}
		
		CP = jtrim(window.document.form.CP.value)
		if ( CP == "")
		{
			document.getElementById("errorCP").style.display = "block";
			document.getElementById("lblCP").style.display = "none";
			if (control=='')
				control = 'CP';
			error = 1;
		}else
		{
			document.getElementById("errorCP").style.display = "none";
			document.getElementById("lblCP").style.display = "block";
		}
		
		poblacion = jtrim(window.document.form.poblacion.value)
		if ( poblacion == "")
		{
			document.getElementById("errorpoblacion").style.display = "block";
			document.getElementById("lblciudad").style.display = "none";
			if (control=='')
				control = 'poblacion';
			error = 1;
		}else
		{
			document.getElementById("errorpoblacion").style.display = "none";
			document.getElementById("lblciudad").style.display = "block";
		}
		
		provincia = jtrim(window.document.form.provincia.value)
		if ( provincia == "")
		{
			document.getElementById("errorprovincia").style.display = "block";
			document.getElementById("lblprovincia").style.display = "none";
			if (control=='')
				control = 'provincia';
			error = 1;
		}else
		{
			document.getElementById("errorprovincia").style.display = "none";
			document.getElementById("lblprovincia").style.display = "block";
		}
		
		pais = document.form.cbPais.options[document.form.cbPais.selectedIndex].value;
		if (pais=="")
		{
			document.getElementById("errorpais").style.display = "block";
			if (control=='')
				control = 'cbPais';
			error = 1;
		}else
			document.getElementById("errorpais").style.display = "none";
		
		centro = jtrim(window.document.form.centro.value)
		if ( centro == "")
		{
			document.getElementById("errorcentro").style.display = "block";
			document.getElementById("lblcentro").style.display = "none";
			if (control=='')
				control = 'centro';
			error = 1;
		}else
		{
			document.getElementById("errorcentro").style.display = "none";
			document.getElementById("lblcentro").style.display = "block";
		}
		
		
		telefono = jtrim(window.document.form.telefono.value)
		if ( telefono == "")
		{
			document.getElementById("errortelefono").style.display = "block";
			document.getElementById("lbltelefono").style.display = "none";
			if (control=='')
				control = 'telefono';
			error = 1;
		}else
		{
			document.getElementById("errortelefono").style.display = "none";
			document.getElementById("lbltelefono").style.display = "block";
		}
		
		telefonocontacto = jtrim(window.document.form.telefonocontacto.value)
		if ( telefonocontacto == "")
		{
			document.getElementById("errortelefonocontacto").style.display = "block";
			document.getElementById("lbltelefonocontacto").style.display = "none";
			if (control=='')
				control = 'telefonocontacto';
			error = 1;
		}else
		{
			document.getElementById("errortelefonocontacto").style.display = "none";
			document.getElementById("lbltelefonocontacto").style.display = "block";
		}
		
		titular = jtrim(window.document.form.titular.value)
		if ( titular == "")
		{
			document.getElementById("errortitular").style.display = "block";
			document.getElementById("lbltitular").style.display = "none";
			if (control=='')
				control = 'titular';
			error = 1;
		}else
		{
			document.getElementById("errortitular").style.display = "none";
			document.getElementById("lbltitular").style.display = "block";
		}
		
		tarjeta = jtrim(window.document.form.tarjeta.value)
		if ( tarjeta == "")
		{
			document.getElementById("errortarjeta").style.display = "block";
			document.getElementById("lbltarjeta").style.display = "none";
			if (control=='')
				control = 'tarjeta';
			error = 1;
		}else
		{
			document.getElementById("errortelefonocontacto").style.display = "none";
			document.getElementById("lbltelefonocontacto").style.display = "block";
		}
		
		caducidad = jtrim(window.document.form.caducidad.value)
		if ( caducidad == "")
		{
			document.getElementById("errorcaducidad").style.display = "block";
			document.getElementById("lblcaducidad").style.display = "none";
			if (control=='')
				control = 'caducidad';
			error = 1;
		}else
		{
			document.getElementById("errorcaducidad").style.display = "none";
			document.getElementById("lblcaducidad").style.display = "block";
		}
		
		/*cvc = jtrim(window.document.form.cvc.value)
		if ( caducidad == "")
		{
			document.getElementById("errorcvc").style.display = "block";
			document.getElementById("lblcvc").style.display = "none";
			if (control=='')
				control = 'cvc';
			error = 1;
		}else
		{
			document.getElementById("errorcvc").style.display = "none";
			document.getElementById("lblcvc").style.display = "block";
		}*/

		tyc = window.document.form.tyc.checked;
		if (!tyc)
		{
			document.getElementById("errorTyc").style.display = "block";
			if (control=='')
				control = 'tyc';
			error = 1;
		}else
			document.getElementById("errorTyc").style.display = "none";	
		/*captcha = document.form.codigo_seguro.value;
		if (captcha=="")
		{
			document.getElementById("errorCaptcha").style.display = "block";
			document.getElementById("errorCaptchaServidor").style.display = "none";
			document.getElementById("lblcaptcha").style.display = "none";
			if (control=='')
					control = 'codigo_seguro';
			error = 1;
		}else
		{
			document.getElementById("lblcaptcha").style.display = "block";
			document.getElementById("errorCaptcha").style.display = "none";
			document.getElementById("errorCaptchaServidor").style.display = "none";
		}*/
		
		window.document.form.action = "/procesarreserva.php";
		if (error==0)
		{
			document.getElementById("continuar").disabled=true;
			window.document.form.submit()
		}
		else
		{
			document.getElementById("mensajeError").style.display = "block";
			document.getElementById("mensajeError").innerText="Algunos campos estan vacios o incorrectos";
			document.getElementById(control).focus();
		}

	}

	function ValidarDNI(numero)
	{
		var exp = /[^\d]+/
		if (exp.test(numero))
			return 1
		else
			return 0
	}

	function ValidarTexto(cadena)
	{
		var exp = /[^A-Za-z0-9_]/

		if (exp.test(cadena))
			return 1
		else
			return 0
	}

	function Concatenar(checks)
	{
		var concatenados = ""
		var i=0;

		while ( i<document.form.elements.length)
		{
			if(document.form.elements[i].type=="checkbox")
				if(document.form.elements[i].name==checks)
					if (document.form.elements[i].checked)
						concatenados = concatenados + document.form.elements[i].value + ","
			i++
		}
		return concatenados
	}

	

	function Str2Sql(sParam)
	{
		var nuevo

		if (jtrim(sParam) == "")
			return "NULL"
		else
			nuevo = sParam.replace("'","")

		return "'" + nuevo + "'"
	}

	function Int2Sql(sParam)
	{
		if (jtrim(sParam) == "")
			return "NULL"
		else
			return sParam
	}

	function Date2Sql(sParam)
	{
		/*Formato DD/MM/YYYY a MM/DD/YYYY*/
		if (jtrim(sParam) == "")
			return "NULL"

		return "'" + sParam.slice(3,5) + "/" + sParam.slice(0,2) + "/" + sParam.slice(6,10) + "'"
	}
	function elegirUsuario(usuario)
	{
		window.alert(usuario);
	}