// JavaScript Document

var hoy = new Date ();
document.BuscVuelo.fmenorI.value = fecha_text (hoy);
hoy.setMonth(hoy.getMonth () + 10)
document.BuscVuelo.fmayorI.value = fecha_text (hoy);
document.BuscVuelo.fmenorV.value = document.BuscVuelo.fmenorI.value;
document.BuscVuelo.fmayorV.value = document.BuscVuelo.fmayorI.value;
document.getElementById('fechas').style.zIndex='2000';

function cambioPestana (enlace)
{
	window.location=enlace;
}

function colocacapa (capa,x,y)
{
	var estado = DevuelveEstado (capa);

	if (estado == true)
	{
		MuestraCapa(capa,"0")
	}
	else
	{
		var posx = window.event.clientX - x
		var posy = window.event.clientY + y

		CalculaPosicion (capa,posx,posy);

		MuestraCapa(capa,"1")
	}
}

function muestraVuelta (valor)
{
	if (valor)
		document.getElementById('trfechavuelta').style.display="block";
	else
	{
		document.getElementById('trfechavuelta').style.display="none";
		document.getElementById('cbohoraregreso').value="";
		document.getElementById('fechavuelta').value="";
	}
}

function borracampos (valor)
{
	switch (valor)
	{
		case "1": document.BuscVuelo.fechaida.value = '';
				document.BuscVuelo.fechavuelta.value = '';
				break;
		case "2": document.BuscVuelo.fechavuelta.value = '';
				break;
	}
}

function buscar_vuelos ()
{
	idpag = "VIAJES: BUSCA AVION"
	idcateg = 'BUSCAAVION';
	cadBusqueda = document.BuscVuelo.origen.value + " - " + document.BuscVuelo.destino.value;
	cmSetProduction();
	cmCreatePageviewTag(idpag,idcateg,cadBusqueda)
	Buscar();
/*	
	switch (valor)
	{
		case 1: 
				break;
		case 2: idpag = "VIAJES: BUSCA AVION"
				idcateg = 'BUSCAAVIONAVANZADO';
				cmSetProduction();
				cmCreatePageviewTag(idpag,idcateg)
				location.href = "http://www.elcorteingles.es/viajes/avion/programas/buscadoravanzadolit_ES.asp?codwebor=ESP"
				break;
	}*/
}

function Buscar()
{	
	if (document.getElementById('rdtipovuelo01').checked) //si se selecciona 1 vuelo de solo ida se deja el campo de fechavuelta vacio
			document.getElementById('fechavuelta').value="";
			
	if (Validar())
	{
		if (document.getElementById('escalas').checked)
		{
			document.getElementById('hidEscalas').value="0";
		}else
		{
			document.getElementById('hidEscalas').value="";
		}


		if (document.getElementById('destino').value=="PARÍS" || document.getElementById('destino').value=="PARIS" || document.getElementById('destino').value=="Paris" || document.getElementById('destino').value=="París" || document.getElementById('destino').value=="paris" || document.getElementById('destino').value=="parís")
		{
			document.getElementById('destino').value="PARI";
		}
		
		document.BuscVuelo.hidPaginaDestino.value="http://www.viajeselcorteinglesusa.com/viajes/avion/programas/listadovuelospreciolit_US";
		document.BuscVuelo.action="http://www.viajeselcorteinglesusa.com/viajes/avion/programas/paginaIntermedialit_US.asp?proceso=L&codWebor=USA&idcentro=VECIUSA";		
		var valida=controlahora(); 
		if (valida==1)
			document.BuscVuelo.submit(); 	  
	}
}