/* ******************************************************************** */
/* ************************ OBJETOS *********************************** */
/* ******************************************************************** */

function SUBMENU(sDiv) //para subMenu de Carreras y Cursos
{
	this.bNavNetscape = navigator.userAgent.indexOf('Netscape') != -1;

	this.setDiv = function()
	{
		if (this.bNavNetscape) 
		{
				return parent.document.getElementById('sDiv');
			} else {
				return eval('parent.document.all.' + sDiv);
		}
	}
	
	this.divX = this.setDiv();
	
	this.mantener = function() 
	{
		this.divX.style.visibility = 'visible';
	}

	this.ocultar = function()
	{
		if (! this.bNavNetscape)
			event.cancelBubble = true;
		if (event.x == -1 || event.y == -1)
		{
			this.divX.style.visibility = 'hidden';
		}
	}
	
	this.ir = function(sURL)
	{
		parent.document.cuerpo.window.navigate(sURL);
		this.divX.style.visibility = 'hidden';
	}
}

/* *************************** APP IESEVE ***************************** */

function FORM_IESEVE_CALIFICAR_EXAMEN() // para el procedure FORM_IESEVE_CALIFICAR_EXAMEN
{
	this.oFolio = document.Formulario.pFolio;
	this.oLibro = document.Formulario.pLibro;
	//this.oEquiv	= document.Formulario.pEquiv; //
	
	this.copiarLibroFolio = function()
	{
		var folio = this.oFolio[0].value;
		var libro = this.oLibro[0].value;
		
		for (n = 1; n < this.oFolio.length; n++)
	    	this.oFolio[n].value = folio;
		
		for (n = 1; n < this.oLibro.length; n++)
	    	this.oLibro[n].value = libro;
	}
	
 /*	this.Submit = function()
	{
		if(confirm('¿Confirma que desea grabar los datos?')) {
			document.Formulario.submit();
			}
	}  */
	
	this.Submit = function()
	{
		if (confirm('¿Confirma que desea grabar los datos?'))
		{
		 if (this.oEquiv.length)
		 
		 	
		 	{
				for (n = 0; n < this.oEquiv.length; n++) 
				{
	    			var oObj = this.oEquiv[n];
		  			if (oObj.checked == false) 
					{
		    			oObj.value = 0;
  		  				oObj.checked = true;
	   					} else {
		    			oObj.value = 1;
  					}
	  			}
			} else {
				if (this.oEquiv.checked == false) 
				{
		    		this.oEquiv.value = 0;
  		  			this.oEquiv.checked = true;
	  				} else {
		   			this.oEquiv.value = 1;
  				}  
			document.Formulario.submit();
			
		}
	}  		

		// Quitar comentario para comprobar los valores de los checks y comentar el submit
		/*if (this.oEquiv.length)
		{
			for (n = 0; n < this.oEquiv.length; n++) {
   				alert(this.oEquiv[n].value);
			}
		} else {
			alert(this.oEquiv.value);
		}*/
	} // fin this.Submit()
}

/* ******************************************************************** */
/* ****************************** FUNCIONES *************************** */
/* ******************************************************************** */

function ieseve_info()
{
	var wnd = window.open('ieseve_info.htm','IeSeVe','width=400, height=315');
	wnd.moveTo(200,100);
}

function ieseve_pop_distancia()
{
	var wnd = window.open('ieseve_pop_distancia.htm','IeSeVe','width=400, height=210');
	wnd.moveTo(200,100);
}


function biblioteca()
{
	var wnd = window.open('../../ieseve/biblionline/index.htm','IeSeVe','width=790, height=422 scrollbars=yes');
	wnd.moveTo(0,100);
}

function biblioteca1()
{
	var wnd = window.open('biblionline/index.htm','IeSeVe','width=790, height=422 scrollbars=yes');
	wnd.moveTo(0,100);
}

function ieseve_virtual_pop()
{
	var wnd = window.open('ieseve_virtual_pop.htm','IeSeVe','width=400, height=345');
	wnd.moveTo(200,100);
}

function IESEVE_CARGAR_LIBRO_Submit() {
  var oLibro = document.Frm.pLibro;
	var oFolio = document.Frm.pFolio;
		
  if (Val_Int(oLibro, 'Libro Matriz', 1, 1, 999)       &&
	    Req(oFolio, 'Folio', oFolio)                     &&
			confirm('¿Confirma que desea grabar los datos?') ){
		document.Frm.submit();
	}
}

function LlenarCampos() {
  var oLibro = document.Frm.pLibro;
	var oFolio = document.Frm.pFolio;
	var oCarrera = document.Frm.pCarrera;
	
	if (aCarrera.length >= 1) {
	  for (n = 0; n < aCarrera.length; n++) {
//alert(oCarrera.options[oCarrera.selectedIndex].value);
//alert(aCarrera[n]);
		  if (oCarrera.options[oCarrera.selectedIndex].value = aCarrera[n]) {
			  oLibro.value = aLibro[n];
				oFolio.value = aFolio[n];
			}
		}
	}
}

function ieseve_a_menu_carreras(iCarrera)
{
	// 	1 : TÉCNICO SUPERIOR EN COMERCIALIZACIÓN
	// 	2 : TÉCNICO SUPERIOR EN ADMINISTRACIÓN DE VENTAS
	//	3 : ANALISTA SUPERIOR EN COMERCIO INTERNACIONAL
	//	4 : POSTÍTULO - ESPECIALISTA EN COMERCIO ELECTRONICO

	var oIfBotonera = parent.document.all.ifBotonera;

	switch (iCarrera)
	{
		case 1 :
			var a = 'ieseve_titulo_1.htm';
			break;
		case 2 :
			var a = 'ieseve_titulo_2.htm';
			break;
		case 3 :
			var a = 'ieseve_titulo_3.htm';
			break;
		case 4 :
			var a = 'ieseve_titulo_4.htm';
			break;
	}

	oIfBotonera.src = 'ieseve_botonera_carreras.htm?a=' + a;
}

function IESEVE_ALUMNOS() // para el procedure DATOS ADICIONALES

{
	this.oMatricula = document.formulario.iMatricula;
	this.oNacimiento = document.formulario.pNacimiento;
	this.oCert_ingreso = document.formulario.pCertificado;
	this.oCert_expedido = document.formulario.pExpedido;
	this.oCondicion = document.formulario.pCondicion;
	this.oDistancia = document.formulario.pDistancia;
	
this.cargar_Alumno_xMatricula = function() 
	{
		document.location = 'redsocial.RPT_DATOS_ADICIONALES.show?p_arg_names=pMatricula&p_arg_values=' + this.oMatricula.value;
	}

	this.teclaEnter = function() 
	{
		if (event.keyCode == 13) 
			this.cargar_Alumno_xMatricula();
	}
	
	
	this.grabarDatos = function()
	{
		if (confirm('¿Confirma que desea grabar los datos?')) {
			window.navigate('redsocial.ieseve_grabar_mas_datos?pMatricula=' + this.oMatricula.value + '&x_lugar_nacimiento=' + this.oNacimiento.value + '&x_certificado_ingreso=' + this.oCert_ingreso.value + '&x_certificado_expedido=' + this.oCert_expedido.value + '&pCondicion=' + this.oCondicion.value + '&pDistancia=' + this.oDistancia.value);
		}else{
		return false;
		} 
	}
	
}
