var popup="Thank you for visit us";
var debug = true; 

function noway(go) { 
	if (document.all) { 
		if (event.button == 2) { 
			alert(popup); 
			return false; 
		} 
	} 
	if (document.layers) { 
		if (go.which == 3) { 
			alert(popup); return false; 
		} 
	} 
} 

function right(e) { 
	if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) return false; 
	else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) { 
		alert('Thank you for visit us'); 
		return false; 
	} 
	return true; 
} 

document.onmousedown=right; 
if (document.layers) window.captureEvents(Event.MOUSEDOWN); 
window.onmousedown=right; 

if (document.layers) document.captureEvents(Event.MOUSEDOWN); 
document.onmousedown=noway; 





function nuevoAjax(){
	var xmlhttp=false;
 	try {
 		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 	} catch (e) {
 		try {
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 		} catch (E) {
 			xmlhttp = false;
 		}
  	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}


function inscribe_newsletter(){
	var nombre, apellido, correo, origen, contenedor;
	contenedor = document.getElementById('newsletter');
	nombre = document.getElementById('news_nombre').value;
	apellido = document.getElementById('news_apellido').value;
	correo = document.getElementById('news_correo').value;
	origen = document.getElementById('news_origen').value;
	pais = document.getElementById('news_pais').value;
	ajax=nuevoAjax();
	ajax.open("GET", "/src/inscripcion.php?nombre="+nombre+"&apellido="+apellido+"&correo="+correo+"&origen="+origen+"&pais="+pais,true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
		contenedor.innerHTML = ajax.responseText
	 	}
	}
	ajax.send(null)
}

function recarga_formulario(){
	var bus_tipo, bus_pais, bus_barco, bus_fecha, bus_orig_tipo, bus_orig_pais, bus_orig_barco, bus_orig_fecha, contenedor;

	contenedor = document.getElementById('contenedor');
	bus_tipo = document.getElementById('bus_tipo').value;
	bus_pais = document.getElementById('bus_pais').value;
	bus_barco = document.getElementById('bus_barco').value;
	bus_fecha = document.getElementById('bus_fecha').value;
	bus_orig_tipo = document.getElementById('bus_orig_tipo').value;
	bus_orig_pais = document.getElementById('bus_orig_pais').value;
	bus_orig_barco = document.getElementById('bus_orig_barco').value;
	bus_orig_fecha = document.getElementById('bus_orig_fecha').value;	
	ajax=nuevoAjax();
	ajax.open("GET", "/src/buscador.php?bus_orig_tipo="+bus_orig_tipo+"&bus_orig_pais="+bus_orig_pais+"&bus_orig_barco="+bus_orig_barco+"&bus_orig_fecha="+bus_orig_fecha+"&bus_tipo="+bus_tipo+"&bus_pais="+bus_pais+"&bus_barco="+bus_barco+"&bus_fecha="+bus_fecha,true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
		contenedor.innerHTML = ajax.responseText
	 	}
	}
	ajax.send(null)
}

function VerificaCampos() {

	loserrores = "";
	
	if (document.cotiza.cot_nombre.value == "") loserrores += "\n- Nombre"; 
	
	if ((document.cotiza.cot_correo.value == "") || 
			(document.cotiza.cot_correo.value.indexOf('@') == -1) || 
			(document.cotiza.cot_correo.value.indexOf('.') == -1)) 
			loserrores += "\n- Correo Electrónico"; 

	if (document.cotiza.cot_pais.value == "") loserrores += "\n- País"; 

	if ((document.cotiza.cot_oficina_pais.value == "Clave País") || 
		  (document.cotiza.cot_oficina_area.value == "Clave Ciudad") || 
			(document.cotiza.cot_oficina_telefono.value == "Teléfono")) loserrores += "\n- Telefono"; 
	
	if (document.cotiza.cot_opcion_1.value == "") loserrores += "\n- Opción de Interés"; 

	if (document.cotiza.cot_personas.value == "") loserrores += "\n- Número de Personas"; 

	if (document.cotiza.cot_tipo_habitacion.value == "") loserrores += "\n- Tipo de Habitación/Camarote"; 

	if (loserrores != "") {
		alert('Todos los datos marcados con * son obligatorios\n'+loserrores);
		return false;
	}	else return true;
}


