//////////////////////////////////////////////////////////////////////////////////////////////
window.onload = function() {
//////////////////////////////////////////////////////////////////////
cargarimagenes();
try{
Windowsfunct('winajaxsistem','idwinsoftsistem','Inicio de Sesi&oacute;n - S. I. A. F.','pages/inicio.php',380,175,false,'','',false);
}catch(exception){return false;}
//////////////////////////////////////////////////////////////////////
try{
Windowsfunct('WinAjaxAdminPanel','idAdminPanel','Inicio de Sesi&oacute;n - G . I . S - COOPAIN','Sesion/index.php',318,128,false,'','150',false);
}catch(exception){return false;}
//////////////////////////////////////////////////////////////////////
if(window.ActiveXObject){
document.getElementById('IdBodyPage').className='BodyColor';return false;
}else{
document.getElementById('IdBodyPage').className='BodyColorMz';return false;}}
/////////////////////////////////////////////////////////////////////////////////////////////////
function Windowsfunct(idwinddiv,idwindow,tituwindow,rutapage,ancho,alto,esmodal,esx,esy,resiz){
if ($(idwinddiv)){
		$(idwinddiv).addEvent('click', function(e){	
			new Event(e).stop();
			document.mochaUI.newWindow({
				id: idwindow,
				title: tituwindow,
				loadMethod: 'xhr',
				contentURL: rutapage,
				width: ancho,
				height: alto,
				resizable: resiz,
				maximizable: true,	
				modal: esmodal,
				x: esx,
				y: esy
			});
		});
	}
}
////////////////////////////////////////////////////////////////////////////////////////////////
function WindowShow(idwindow,tituwindow,rutapage,ancho,alto,esmodal,esx,esy,resiz)
{
	document.mochaUI.newWindow({
				id: idwindow,
				title: tituwindow,
				loadMethod: 'xhr',
				contentURL: rutapage,
				width: ancho,
				height: alto,
				resizable: resiz,
				maximizable: true,	
				modal: esmodal,
				x: esx,
				y: esy
			});
}
/////////////////////////////////////////////////////////////////////////////////////////////////
function ShowPanelDiv(iddivcont){
OpcCmb=document.getElementById(iddivcont).value;
if(OpcCmb==1){
 ShowTableParameters('DivPanelRegPer','pages/Alumno/RegAlu.php','','','','','','');
}
if(OpcCmb==2){
 ShowTableParameters('DivPanelRegPer','pages/Docente/RegDoc.php','','','','','','');
}
if(OpcCmb==3){
 ShowTableParameters('DivPanelRegPer','pages/Egresado/RegEgr.php','','','','','','');
}
if(OpcCmb==4){
 ShowTableParameters('DivPanelRegPer','pages/Admin/RegSist.php','','','','','','');
}}
//////////////////////////////////////////////////////////////////////////////////////
function KeySalta(elEvento,siguiente)
{
	
var evento = elEvento || window.event;
var codigo = evento.charCode || evento.keyCode;

		if(codigo==13){
		 SiguienteControl(siguiente);
         return;
		}	
}
///////////////////////////////////////////////////////////////
function SiguienteControl(sig){
	
document.getElementById(sig).focus();
return false;
}
//////////////////////////////////////////////////////////////
function trim(cadena,elemento)
{
	for(i=0; i<cadena.length; )
	{
		if(cadena.charAt(i)==" ")
			cadena=cadena.substring(i+1, cadena.length);
		else
			break;
	}

	for(i=cadena.length-1; i>=0; i=cadena.length-1)
	{
		if(cadena.charAt(i)==" ")
			cadena=cadena.substring(0,i);
		else
			break;
	}
	
	document.getElementById(elemento).value=cadena;
}
///////////////////////////////////////////////////////////////////////////////////////////////
function cargarimagenes(){
var i; 
var imagenes = new Array("Images/Fondo/img1.JPG","imagen2.gif","imagen3.gif"); 
var lista_imagenes = new Array();
for(i in imagenes){ 
lista_imagenes[i] = new Image(); 
lista_imagenes[i].src = imagenes[i]; 
} 
}
//////////////////////////////////////////////////////////////////////////////////////////////
function ValidaUsuarioCoop(){
	if(document.getElementById('usuario').value.length==0){
		alert("..dato de Usuario requerido...debe ingresarlo");
		document.getElementById('usuario').focus();
		return false;
	}
	if(document.getElementById('contrasena').value.length==0){
		alert("..Password requerida...debe ingresarlo");
		document.getElementById('contrasena').focus();
		return false;
	}
	if(document.getElementById('llaves').value.length==0){
			alert("..Key requerida...debe ingresarlo");
		document.getElementById('llaves').focus();
		return false;
	}
	if(confirm("Esta seguro que desea acceder al sistema COOPAIN...")){
	document.getElementById('formcoop').submit();
	}
	
}
