//este es el codigo que agregue
var explorador_IE = document.all ? true : false;
var id_ventana_lms = "0";
var id_tipo_cierre = 0;
var arreglo_ventanas = new Array(150);
var indice_ventanas=0;
var lms_pagina_main = "";
var lms_opcion_main = 0;
var lms_subopcion_main = 0;
//var win_agenda_left;
//var win_diarioMural_main;
//var win_correo_main;
//var win_consola_main;

if (!explorador_IE){
      document.captureEvents(Event.CLICK);
      document.captureEvents(Event.FOCUS);
      document.captureEvents(Event.MOUSEDOWN);
      window.captureEvents(Event.ONLOAD);
      window.captureEvents(Event.CLICK);
      window.captureEvents(Event.FOCUS);
      window.captureEvents(Event.MOUSEDOWN);
      window.captureEvents(Event.UNLOAD);

}
function cargar_ventana(objeto_win) {
  existe_win = false;
  if (indice_ventanas == 0) {
//    arreglo_ventanas[indice_ventanas] = objeto_win;
    arreglo_ventanas[indice_ventanas] = new Array(2);
    arreglo_ventanas[indice_ventanas][0] = objeto_win;
    arreglo_ventanas[indice_ventanas][1] = objeto_win.name;
    indice_ventanas++; 
  } else {
     for (i=0; i < arreglo_ventanas.length; i++) {
//        alert(i);
        if (arreglo_ventanas[i] != null) {
           if (arreglo_ventanas[i][1] == objeto_win.name) {
              if (arreglo_ventanas[i][0].closed) {
                  arreglo_ventanas[i][0] = objeto_win;
              }            
              existe_win = true;
              break;
           }  
        } else { break; }
     } 
     if (!existe_win) {
//        arreglo_ventanas[indice_ventanas] = objeto_win;
        arreglo_ventanas[indice_ventanas] = new Array(2);
        arreglo_ventanas[indice_ventanas][0] = objeto_win;
        arreglo_ventanas[indice_ventanas][1] = objeto_win.name;
        indice_ventanas++; 
     } 
  }
}
function cerrar_ventanas_top() {
  if (arreglo_ventanas != null) {
     for(i=0; i < arreglo_ventanas.length; i++) {
        if (arreglo_ventanas[i] != null) {
           if (!arreglo_ventanas[i][0].closed) {
             try { 
                 arreglo_ventanas[i][0].id_tipo_cierre = 1; 
                 arreglo_ventanas[i][0].close();
              } catch (e) { ; }
//              arreglo_ventanas[i][0].close();
           } 
        } else {
          break;
        }     
     }
  }
  poner_a_cero(id_ventana_lms);
}
function cerrar_ventanas_left_main() {
  if (arreglo_ventanas != null) {
     for(i=0; i < arreglo_ventanas.length; i++) {
        if (arreglo_ventanas[i] != null) {
           if (!arreglo_ventanas[i][0].closed) { 
              try {
              arreglo_ventanas[i][0].id_tipo_cierre = 1; 
              arreglo_ventanas[i][0].close();
//                  arreglo_ventanas[i][0].cerrar_ventanas(1);
              } catch (e) { ; }
//              arreglo_ventanas[i][0].close();
           } 
        } else {
          break;
        }     
     }
  }
  poner_a_cero(window.parent.frames("topFrame").id_ventana_lms);
}

function cerrar_ventanas() {
//  alert(id_tipo_cierre);
  if (arreglo_ventanas != null) {
     for(i=0; i < arreglo_ventanas.length; i++) {
        if (arreglo_ventanas[i] != null) {
          try {
           if (!arreglo_ventanas[i][0].closed) {
               arreglo_ventanas[i][0].close();
/*         
              if (id_tipo_cierre == 0) {
                 try {
                   if (window.opener.opener != null) {
                      window.opener.opener.poner_a_cero(arreglo_ventanas[i][1]);
                   } else if (window.opener) {
                      window.opener.poner_a_cero(arreglo_ventanas[i][1]);
                   }
                 } catch(e) {; }  
              }    
              try { 
                arreglo_ventanas[i][0].id_tipo_cierre = id_tipo_cierre;
                arreglo_ventanas[i][0].close();
              } catch (e) { ; }
*/         
           } 
          } catch(e) {; }  
        } else {
          break;
        }     
     }
  }
  try {
//       alert("hizo esto");
       EventHandler1(window.event);  
  } catch(e) { ; } 
  return true;
}

function right(e) {
 if (window.event.button==2 || window.event.button==3) {
//    alert("no permitido");
//    return false;
   return true;
 }
 return true;
}

// hasta aqui

function saca_blancos(cadena, valor) {
        	var a = ""
        	var b = 0;
           	if (cadena != null && cadena != "") {
              		ini = cadena.search(/\S/i)
              		if (ini < 0) { ini = 0 }
              			a = cadena.substr(ini)
              			i = 0
              			for(i=a.length; i>=0; i--) {
                			c=a.substr((i-1),1);
                			if(c != ' ' && c != '') {b = 1; break; }
              			}
              				if (i > 0) { a = a.substr(0, i) }
              				if (valor == 1) {a = a.toUpperCase()}
              				if (b == 0) { a = ""; }
           	}		
           	return a
}
       	