// PONE EL LINK "ARRIBA"
function poner_arriba() {
	document.write("<p><a title=\"Subir al comienzo de la página\" onMouseOver=\"javascript:window.status=this.title;\" onMouseOut=\"javascript:window.status='';\" onClick=\"javascript:location.href='#Arriba';\" class=\"arriba\">Arriba</a></p>");
}
// ALERTS PARA EL FORMULARIO MI PROYECTO
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
function formularioFlash_DoFSCommand(command, args) {
  var formularioFlashObj = InternetExplorer ? formularioFlash : document.formularioFlash;
	if (command=="demasiadasHs") {
		alert('El número máximo de horas es 24');
	}
	if (command=="error_1") {
		alert('No ha completado el cuadro Nº2, \"En la cantidad de: \" y/o el cuadro Nº3, \"En jornadas de: \" y/o el cuadro Nº4, \"Días laborables: \". Deberá ingresar esa información para poder completar este dato.');
	}
	if (command=="error_2") {
		alert("La cantidad de leche que proyecta producir es menor que la suma de los destinos que piensa darle. Se ha excedido en "+ args +" litros. Se devuelve el valor del campo actual a 0. Por favor reingrese correctamente las cantidades.");
	}
	if (command=="error_3") {
		alert('Uno o más de los cuadros obligatorios (*) del formulario de sus datos personales se encuentra incompleto. Por favor ingrese la información para poder continuar.');
	}
	if (command=="error_4") {
		alert(args);
	}
	if (command=="error_5") {
		alert('La suma de las cantidades es menor al total de leche que va a producir.');
	}
	if (command=="error_6") {
		alert('Una o más opciones de los puntos 7 al 12 no han sido debidamente seleccionadas');
	}
	if (command=="error_7") {
		alert('No ha introducido la cantidad de leche que desea producir.');
	}
}
// PARA HACER LOS INCLUDES
function cargar(titulo,incluir){
	document.pasador.elements.incluir_arch.value=incluir;
    document.pasador.elements.titulo.value=titulo;
    document.pasador.target="_self";
	document.pasador.action="humana.asp";
	document.pasador.method="POST";
	document.pasador.submit();	
}
// CAMBIA LOS ESTILOS EN LOS ROLLOVER
function estilos(encendido,frase,id,estilo,extra){
	window.status=frase;
	//if(encendido){
		document.getElementById(id).className=estilo;
		if(extra){
			document.getElementById(id+"_1").className=estilo;
		}
	/*}else{
		document.getElementById(id).className=estilo;
		if(extra){
			document.getElementById(id+"_1").className=estilo;
		}
	}*/
}
// CHEQUEA LA DIR DE EMAIL DE LA RECOMENDACION
function checkMailRecom(cadena) {
if (document.recomendacion.elements["nombre"].value == "" || document.recomendacion.elements["nombre"].value == "Su nombre" || document.recomendacion.elements["email"].value == "" || document.recomendacion.elements["email"].value == "Enviar a... (eMail)"){
	alert('Olvidó completar alguna de las casillas. Complete y reintente el envío.');
} else {
	var cadena = document.recomendacion.elements["email"].value;
	var hayPunto = cadena.indexOf(".")
	if (hayPunto!=-1){
		var extension = (cadena.length-1) - cadena.lastIndexOf(".")
	}
	var arroba = cadena.lastIndexOf("@")
	if(extension<2 || extension==undefined || arroba==-1) {
		alert("Dirección incorrecta. Si su teclado no le permite introducir \"@\", pulse Alt+64");
	} else {
		document.recomendacion.target="_self";
		document.recomendacion.action = "index.asp";
		document.recomendacion.method="POST";
		document.recomendacion.submit();
	}
	}
}
// CHEQUEA QUE TODOS LOS CAMPOS OBLIGATORIOS ESTEN LLENOS
function revisar(){
   errores = 0;
   msg_error = "Campos obligatorios incompletos:\n"
   // Nombre
   if ((document.formularioContacto.elements['nombre'].value).length == 0) {
		errores++;
		msg_error = msg_error + "    - Nombre\n";
   }
   // País
   if ((document.formularioContacto.elements['pais'].value).length == 0) {
		errores++;
		msg_error = msg_error + "    - País\n";
   }	
   // Teléfono
   if ((document.formularioContacto.elements['telefono'].value).length == 0) {
		errores++;
		msg_error = msg_error + "    - Teléfono\n";
   }
   // eMail
   if ((document.formularioContacto.elements['email'].value).length == 0) {
		errores++;
		msg_error = msg_error + "    - Correo electrónico\n";
   }
   // ALERTA LOS CAMPOS INCOMPLETOS...
   if (errores!=0){
     	alert(msg_error);
   } else {
		var cadena = formularioContacto.email.value;
		var hayPunto = cadena.indexOf(".")
		if (hayPunto!=-1){
			var extension = (cadena.length-1) - cadena.lastIndexOf(".")
		}
		var arroba = cadena.lastIndexOf("@")
		if(extension<2 || extension==undefined || arroba==-1) {
			alert("Dirección incorrecta. Si su teclado no le permite introducir \"@\", pulse Alt+64");
		} else {
			document.formularioContacto.target="_self";
			document.formularioContacto.action = "index.asp";
			document.formularioContacto.method="POST";
			document.formularioContacto.submit();
		}
	}
}
function TrabaEmail(){
	if(event.keyCode == 45 || event.keyCode == 46 || event.keyCode == 64 || event.keyCode == 95 || (event.keyCode >= 97 && event.keyCode <= 122) || (event.keyCode >=65 && event.keyCode <=90) || (event.keyCode >=48 && event.keyCode <=57)){
	} else {
		event.keyCode=0;
	}
}
function CheckKeys(){
// Bloquea el teclado para que ingresen sólo números en Teléfono
	if((event.keyCode >= 97 && event.keyCode <= 122) || (event.keyCode >=65 && event.keyCode <=90)){
		event.keyCode=0;
	}
}
// GETURL PARA LOS DOCUMENTOS PDF DE LA DERECHA O PARA OTROS DOCUMENTOS
function abrir_doc(documento){
	window.open(documento,'','');
}
function abrir_video(video, ancho, alto){
	window.open(video,"","width="+ancho+",height="+alto);
}