// JavaScript Document
function menuInicio(){
	parent.location.href="/";
}

function showDetalleReservacion(){
	procesarRedireccion("vistaExtra", "Vistas/Reservaciones/Detalle.php");
}


function contactUs(){
	procesarRedireccion("vistaExtra", "Vistas/Otras/Contacto.php");	
}

function showRecommendationsSent(){
	procesarRedireccion("vistaExtra", "Vistas/Otras/RecommendationsSent.php");
}

function showExistingReservations(){
	procesarRedireccion("vistaExtra", "Vistas/Reservaciones/CheckIn.php");	
}

function showPromotions(){
	procesarRedireccion("vistaExtra", "Vistas/Promociones/Promociones.php");		
}

function showAboutAlamo(){
	procesarRedireccion("vistaExtra", "Vistas/Otras/AboutAlamo.php");	
}

function showLocalLinks(){
	procesarRedireccion("vistaExtra", "Vistas/Otras/LocalLinks.php");	
}

function showPolicies(){
	procesarRedireccion("vistaExtra", "Vistas/Otras/Policies.php");	
}

function showLocalNews(){
	procesarRedireccion("vistaExtra", "Vistas/Otras/LocalNews.php");	
}

function showFranchise(){
	procesarRedireccion("vistaExtra", "Vistas/Otras/Franchise.php");	
}

function showRecommendUs(){
	procesarRedireccion("vistaExtra", "Vistas/Otras/Recomendar.php");	
}

function showModificarReservacion(){
	procesarRedireccion2("contenedorPrincipal", "Vistas/Reservaciones/ModificarReservacion.php");
}

function menuDeals(){

	document.getElementById("menuHome").style.backgroundColor='#DA0029';
	showPromotions();
}

function menuRates(){
	
	document.getElementById("menuHome").style.backgroundColor='#FF850D';
}

function menuLocations(){
	procesarRedireccion("vistaExtra", "Vistas/Ubicaciones/Buscador.php");	
	document.getElementById("menuHome").style.backgroundColor='#A6BB08';
}

function menuCars(){
	//procesarRedireccionMenu("Vistas/Menu/Cars.php");
	procesarRedireccion("vistaExtra", "Vistas/Automoviles/Automoviles.php");
	document.getElementById("menuHome").style.backgroundColor='#557DB9';
}

function showBuyACar(){
	//procesarRedireccionMenu("Vistas/Menu/Cars.php");
	procesarRedireccion("vistaExtra", "Vistas/Automoviles/AutomovilesVenta.php");
	
}

function menuHome(){
	procesarRedireccionMenu("Vistas/Menu/Home.php");
}

function inicio(){
	procesarRedireccionMenu("Vistas/Menu/Home.php");
}

function procesarRedireccion(ubicacion, destino){
	$("#vistaExtra").load(destino);
	if(pasoActual>1){
		esconderDetalle();
	}
}

function procesarRedireccion2(ubicacion, destino){
	$("#contenedorPrincipal").load(destino);
	if(pasoActual>1){
		esconderDetalle();
	}
}


function procesarRedireccionMenu(destino){
	request_menu = false;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		request_menu = new XMLHttpRequest();
		if (request_menu.overrideMimeType) {
			request_menu.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) { // IE
		try {
			request_menu = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				request_menu = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!request_menu) {
		alert('Cannot create XMLHTTP instance');
		return false;
	}
	request_menu.onreadystatechange = function(){
		if(request_menu.readyState == 4){
			document.getElementById("subMenu").innerHTML=request_menu.responseText;
			
			
		}
	};
	request_menu.open('GET', destino, true);
	request_menu.send(null);
}

function abrirMapaUbicaciones(destino){
	procesarRedireccion("vistaExtra", "Vistas/Ubicaciones/Buscador.php?destino="+destino);
}

function buscarUbicaciones(){
	//1 BUSQUEDA POR CIUDAD
	//2 BUSQUEDA POR UBICACION
	//3 BUSQUEDA COMPLETA
	//4 BUSCAR POR ESTADO
	switch(parseInt(document.getElementById("tipoBusqueda").value)){
		case 1:
			procesarRedireccion("vistaExtra", "Vistas/Ubicaciones/Resultados.php?ciudad="+escape(document.getElementById("ciudadBuscar").value)+"&destino="+document.getElementById("destinoBusqueda").value);
		break;
		case 2:
			procesarRedireccion("vistaExtra", "Vistas/Ubicaciones/Resultados.php?ubicacion="+document.getElementById("selectUbicacionBuscador").value+"&destino="+document.getElementById("destinoBusqueda").value);
		break;
		case 3:
			procesarRedireccion("vistaExtra", "Vistas/Ubicaciones/Resultados.php?destino="+document.getElementById("destinoBusqueda").value);
		break;
		case 4:
			procesarRedireccion("vistaExtra", "Vistas/Ubicaciones/Resultados.php?estado="+escape(document.getElementById("estadoUbicar").value)+"&destino="+document.getElementById("destinoBusqueda").value);
		break;
	}
}