$(document).ready(function(){


	$("#form_datos").submit( function() {
		//return $("input", this).val().length > 0;

		if ($("#Email").val() == "") {
			alert ("\n Por favor introduzca una cuenta de correo.")
			document.forms['form_datos'].elements['Email'].focus();
			return false;
		}


		if ($("#Email").val().indexOf('@',0) == -1 ||
		$("#Email").val().indexOf('.',0) == -1) {
			alert ("\n Debe utilizar una cuenta de correo valida.")
			document.forms['form_datos'].elements['Email'].select();
			document.forms['form_datos'].elements['Email'].focus();
			return false;
		}
	/*	if (document.getElementById("NO_Acepto").checked==true) {
			return true;
		} else {
			alert("Debe aceptar la ley de proteccion de Datos\npara  enviar este formulario.");
			return false;
		}
		*/
	} );


	$("#form_viajes_1").submit( function() {
		//return $("input", this).val().length > 0;

		if ($("#NOMBRE").val() == "") {
			alert ("\n Por favor introduzca el Nombre del Asegurado.")
			$("#NOMBRE").focus();
			return false;
		}
		if ($("#INICIO").val() == "dd/mm/aaaa" || $("#INICIO").val() == "") {
			alert ("\n Por favor introduzca la Fecha de Inicio Viaje.")
			$("#INICIO").focus();
			return false;
		}
		if ($("#FIN").val() == "dd/mm/aaaa" || $("#FIN").val() == "") {
			alert ("\n Por favor introduzca la Fecha de Fin Viaje.")
			$("#FIN").focus();
			return false;
		}
		if ($("#AMBITO").val() == "") {
			alert ("\n Por favor introduzca el Destino del viaje.")
			$("#AMBITO").focus();
			return false;
		}
		if ($("#PAXS").val() == "") {
			alert ("\n Por favor introduzca el Numero de Viajeros.")
			$("#PAXS").focus();
			return false;
		}

	} );

	$("#form_viajes_2").submit( function() {
			var items=$(".nombre_asegurado");
			//alert(items);
			for (h=0; h<items.length; h++) {
				if (items[h].value == "") {
					alert ("\n Por favor introduzca el Nombre del Asegurado.");
					items[h].focus();
					
					return false;
				}
								
			}
	});
	
	$("#form_viajes_finalizacion").submit( function() {

		if (document.getElementById("Acepto").checked==true) {
			return true;
		} else {
			alert("Debe aceptar la ley de proteccion de Datos\npara  enviar este formulario.");
			return false;
		}

	} );
	// ABRIR LINKS EXTERNOS EN VENTANA NUEVA
	$("a[@rel='external']").click(function(){this.target = "_blank";});

});



function embedFlash(ubicacion,pelicula,ancho,alto){
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"  width="'+ancho+'" height="'+alto+'">');
	document.write('<param name="movie" value="'+ubicacion+pelicula+'.swf" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<embed src="'+ubicacion+pelicula+'.swf" width="'+ancho+'" height="'+alto+'" quality="high"  type="application/x-shockwave-flash" wmode="transparent"></embed>');
	document.write('</object>');
}

//Aumentar y reducir el tamaÃ±o del texto
var prefsLoaded = false;
var original= 8;
var incremento = 0;
var tamano = 0;
function aumentar () {
	if(tamano<20){
		incremento+=2;
		tamano = original + incremento;
		document.getElementById("contenido_texto").style.fontSize = tamano + "pt";
	}
}
function reducir () {
	if(tamano>6){
		incremento-=2;
		tamano = original + incremento;
		document.getElementById("contenido_texto").style.fontSize = tamano + "pt";
	}
}

function verifyborrar(url){
	var conf;
	conf = confirm("¿ Desea eliminar el elemento seleccionado ?");
	if ( conf ) {
		window.location.href = url;
	}
}

function enviar_certificado(url){
	var conf;
	conf = confirm("¿ Desea enviar el elemento seleccionado ?");
	if ( conf ) {
		window.location.href = url;
	}
}

function enviar_lote(url){
	var conf;
	conf = confirm("¿ Desea enviar los elementos seleccionados ?");
	if ( conf ) {
		window.location.href = url;
	}
}

function abrir( web, alto, ancho ) {
	if ( window.pantmsg ) { pantmsg.close(); }
	pantmsg = open(web, 'pantmsg',"top=" + (screen.height - alto) / 2 + ",left=" + (screen.width - ancho) / 2 + ",toolbar=no,width=" + ancho + ",height=" + alto + ",directories=no,status=no,scrollbars=no,resize=no,menubar=no");
	pantmsg.focus();
}
