// JavaScript Document
<!--
		 
function fncFormSuscripcionCurso(){
	var form = document.formulario;
	if(form.txt_apellido.value == "")
	{
		alert("Debes Ingresar tu Apellido.");
		form.txt_apellido.focus();
		return 0;
	}
	if(form.txt_nombre.value == "")
	{
		alert("Debes Ingresar tu Nombre.");
		form.txt_nombre.focus();
		return 0;
	}
	
	if(form.txt_edad.value == "")
	{
		alert("Debes Ingresar una edad.");
		form.txt_edad.focus();
		return 0;
	} else if (isNaN(form.txt_edad.value) || (form.txt_edad.value > 0 && form.txt_edad.value >= 130)){
		alert("Debes Ingresar una edad Válida.");
		form.txt_edad.focus();
		return 0;	
	}
	
	if(!emailCheck(form.txt_email.value) )
	{
		alert("Debes Ingresar el Email.");
		form.txt_email.focus();
		return 0;
	}
	
	/*else if (!emailCheck(form.txt_email.value))
		alert("Debes Ingresar un Email válido.");
		form.txt_email.focus();
		return 0;
	}*/
	
	if(form.txt_residencia.value == "")
	{
		alert("Debes Ingresar tu Lugar de Residencia.");
		form.txt_residencia.focus();
		return 0;
	}
	if(form.txt_titulos.value == "")
	{
		alert("Debes Ingresar algun Título.");
		form.txt_titulos.focus();
		return 0;
	}
	if(form.txt_trabajo.value == "")
	{
		alert("Debes Ingresar algun lugar de Trabajo.");
		form.txt_trabajo.focus();
		return 0;
	}
	if(form.txt_actividades.value == "")
	{
		alert("Debes Ingresar algun Actividad.");
		form.txt_actividades.focus();
		return 0;
	}
	if(form.txt_politicas.value == "")
	{
		alert("Debes Ingresar alguna Politica Pública.");
		form.txt_politicas.focus();
		return 0;
	}
	form.submit();
		
}
function redir_admin_index(){
	document.location.href = 'http://www.gerontovida.org.ar/pagg.php?dat=ini_temp';
}
function Abrir_Ventana(url) { 
var especificaciones="top=0, left=0, toolbar=no,location=no, status=no,menubar=no,scrollbars=yes, resizable=yes, width=800,height=600" 
var titulo="Fotos"
window.open(url,titulo,especificaciones); 
}
function Abrir_Ventana_Encuesta(url) { 
var especificaciones="top=0, left=0, toolbar=no,location=no, status=no,menubar=no,scrollbars=yes, resizable=yes, width=850,height=450" 
var titulo="Encuesta"
window.open(url,titulo,especificaciones); 
}

function validar_encuesta()
{

  var form = document.formulario;
  var s = "no";
  for ( var i = 0; i < form.voto.length; i++ ) {
   
	if (form.voto[i].checked ) {
    s= "si";
    break;
    }
  }
  if ( s == "no" ){
    alert( "Debe seleccionar una Opción en la encuesta" ) ;
	//form.voto.focus();
	return 0;
  }
  	
  if(form.txt_edad.value == "" || !(form.txt_edad.value > 0 && form.txt_edad.value <= 120))
  {
	 alert("Debes ingresar una edad valida");
	 form.txt_edad.focus();
	 return 0;
	}

    var s = "no";
  for ( var i = 0; i < form.sexo.length; i++ ) {
   
	if (form.sexo[i].checked ) {
    s= "si";
    break;
    }
  }
  if ( s == "no" ){
    alert( "Debe seleccionar el Sexo" ) ;
	//form.sexo.focus();
	return 0;
  }
  
    var s = "no";
  for ( var i = 0; i < form.pen_jub.length; i++ ) {
   
	if (form.pen_jub[i].checked ) {
         	 
		 if(i == (form.pen_jub.length -1))
		 {
		 	if(form.txt_otros.value == "")
			{
				s= "no";
				alert ("Al seleccionar la Opción Otros, debes especificar tu Ocupacion en el campo de texto.");
				
				
			}else{
				s= "si";
		 		break;
			}
			
		 }else{			 
		 	s= "si";
		 	break;
		} // ELSE DE LA ULTIMA OPCION
		
		
    } // IF DEL CHECKED
  }
  if ( s == "no" ){
   
	
		alert( "Debe seleccionar Pesionado o Jubilado u Otros" ) ;
		//form.pen_jub.focus();
		return 0;
	
   
  }
  
    var s = "no";
  for ( var i = 0; i < form.monto_haber.length; i++ ) {
   
	if (form.monto_haber[i].checked ) {
    s= "si";
    break;
    }
  }
  if ( s == "no" ){
    alert( "Debe seleccionar un Monto." ) ;
	//form.monto_haber.focus();
	return 0;
  }
  
  
	
	 if(form.txt_localidad.value == "")
 	 {
	 alert("Debes ingresar una Localidad");
	 form.txt_localidad.focus();
	 return 0;
	}
	form.submit();
	
}
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function fncValidar() {
		if ( document.formulario.nombres.value == "" ) {
			alert("Debes ingresar tu nombre.");
			document.formulario.nombres.focus();
		} else {
				if ( document.formulario.mensaje.value == "") {
					alert("Debes ingresar tu mensaje.");
					document.formulario.mensaje.focus();
				} else {					
					if (document.formulario.apellidos.value ==""){
						alert("Debes ingresar el Apellido");
						document.formulario.apellidos.focus();
					}
					else{
					if ( emailCheck(document.formulario.email.value) ) {
						document.formulario.submit();
					}	
					
					}
					
				}
				
			}
	}
	function emailCheck (emailStr) {
		var emailPat=/^(.+)@(.+)$/
		var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
		var validChars="\[^\\s" + specialChars + "\]"
		var firstChars=validChars
		var quotedUser="(\"[^\"]*\")"
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
		var atom="(" + firstChars + validChars + "*" + ")"
		var word="(" + atom + "|" + quotedUser + ")"
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
		var matchArray=emailStr.match(emailPat)
		if (matchArray==null) {
			alert("La dirección de mail es incorrecta.")
			return false
		}
		var user=matchArray[1]
		var domain=matchArray[2]
		if (user.match(userPat)==null) {
			alert("La dirección de mail es incorrecta.")
			return false
		}
		var IPArray=domain.match(ipDomainPat)
		if (IPArray!=null) {
			for (var i=1;i<=4;i++) {
				if (IPArray[i]>255) {
					alert("La dirección de mail es incorrecta.")
				return false
				}
			}
			return true
		}
		var domainArray=domain.match(domainPat)
		if (domainArray==null) {
			alert("La dirección de mail es incorrecta.")
			return false
		}
		var atomPat=new RegExp(atom,"g")
		var domArr=domain.match(atomPat)
		var len=domArr.length
		if (domArr[domArr.length-1].length<2 || 
			domArr[domArr.length-1].length>3) {
		alert("La dirección de mail es incorrecta.")
		return false
		}
		if (domArr[domArr.length-1].length==3 && len<2) {
		alert("La dirección de mail es incorrecta.")
		return false
		}
		return true;
	}

	function nueva(vinculo) 
	{ 
		windows.open(vinculo, 'Sizewindow', 'width=300,height=350,scrollbars=no,toolbar=no') 
	} 

	
//-->

