function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function muestraInfo(d){
	frames['info'].location.href="info"+d+".htm";
}
var whitespace = " \t\n\r";

function isEmpty(s){
   return ((s == null) || (s.length == 0))
}

function isWhitespace (s){   var i;

    if (isEmpty(s)) return true;

    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);

        if (whitespace.indexOf(c) == -1) return false;
    }

    return true;
}

function abreVentana(theURL,winName,features) { //v2.0
	var winl = (screen.width - 720) / 2;
	var wint = (screen.height - 480) / 2;
	win = window.open(theURL,winName,features+',left='+winl+',top='+wint);
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }  
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function chequeaNo(form){ 
  if (form.cursos.value!=0){
	abreVentana('redirecting.asp?proc=1&idp='+form.idp.value+'&idc='+form.cursos.value,'registro','resizable=yes,scrollbars=yes,width=720,height=480');
    return true;
  } else {
	alert( "Por favor, seleccione un curso." );
	form.cursos.focus();
	return false;	  
  }
}

function chequeaSi(form,rut) {
	if ((form.numero.value == "") || isWhitespace(form.numero.value)) {
  	    alert( "Por favor, indique su Código de Registro." );
		form.numero.focus();
		return false;
    }	
	abreVentana(rut+'redirecting.asp?proc=2&numero='+form.numero.value,'registro','resizable=yes,scrollbars=yes,width=720,height=480');
	return true;
}

function interesadoOnLine() {
	abreVentana('solicitaInfo.asp','solicitud','resizable=yes,scrollbars=yes,width=720,height=480');
	return true;
}

function emailBienFormado(x)
{	
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) return true ;
	else {
        return false ;
    }
}

function logInUsuarioOnline(form,rut) {
	self.name="principal";
	if (isWhitespace(form.email.value) || !emailBienFormado(form.email.value)) {
  	    alert( "Por favor, escriba su email correctamente." );
		form.email.focus();
		return false;
    }
	abreVentana(rut+'solicitarClave.php?email='+form.email.value,'login','resizable=no,scrollbars=no,width=400,height=250');
	return true;
}


function cierraLogin() {
	var child = open('','login');
	if (child && !child.closed) child.close();
}

function sacaflus(o) {
	if (!document.layers) {
		for (i=1;i<=6;i++){
			if (o==i) {  
			document.getElementById("mod"+i).style.display = "inline";
			} else {  
			document.getElementById("mod"+i).style.display = "none";
			} 
		}
	}
}
function esamen1()
{
		
	var respuesta1 = false ;
	
	for (counter = 0; counter < form.p1.length; counter++)
	{
		if  (form.p1[counter].checked) {
			respuesta1 = true ;
	    }
	}

	if (respuesta1 == false) {
  	    alert( "Por favor, seleccione una respuesta a la pregunta número 1." );
		form.p1[0].focus();
       	return false ;
    }	
		
	var respuesta2 = false ;
	
	for (counter = 0; counter < form.p2.length; counter++)
	{
		if  (form.p2[counter].checked) {
			respuesta2 = true ;
	    }
	}

	if (respuesta2 == false) {
  	    alert( "Por favor, seleccione una respuesta a la pregunta número 2." );
		form.p2[0].focus();
       	return false ;
    }	
	
	var respuesta3 = false ;
	
	for (counter = 0; counter < form.p3.length; counter++)
	{
		if  (form.p3[counter].checked) {
			respuesta3 = true ;
	    }
	}

	if (respuesta3 == false) {
  	    alert( "Por favor, seleccione una respuesta a la pregunta número 3." );
		form.p3[0].focus();
       	return false ;
    }		
	
	var respuesta4 = false ;
	
	for (counter = 0; counter < form.p4.length; counter++)
	{
		if  (form.p4[counter].checked) {
			respuesta4 = true ;
	    }
	}

	if (respuesta4 == false) {
  	    alert( "Por favor, seleccione una respuesta a la pregunta número 4." );
		form.p4[0].focus();
       	return false ;
    }	
	
	var respuesta5 = false ;
	
	for (counter = 0; counter < form.p5.length; counter++)
	{
		if  (form.p5[counter].checked) {
			respuesta5 = true ;
	    }
	}

	if (respuesta5 == false) {
  	    alert( "Por favor, seleccione una respuesta a la pregunta número 5." );
		form.p5[0].focus();
       	return false ;
    }
	return true ;
}


function comprobarInscripcionaCurso(form){


	if (!form.autorizo.checked) {
	alert( "Por favor, marque la casilla solicitada para dar su aceptación y consentimiento." );
	form.autorizo.focus();
	return false ;
	}
	return true ;
}

