// JavaScript Document

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

autoDetect = true;
timeOutSecs = 10;  
window.onload = init; // esta linea puede borrarse si autoDetect=false

function init(e){
 if (autoDetect){
  for (var a=0;a<document.forms.length;a++){
   document.forms[a].onsubmit = disable; // adjunta la funci—n disable a todos los forms
  }
 }
}
 
function disable(e){ 
 if (document.getElementById) { 
  if (autoDetect){
   if (!e) {e = document.parentWindow.event;}
   var el = e.target || e.srcElement; 
  } else { 
   el = e;
  }
  while (el.tagName != "FORM"){ el = el.parentNode;} 
  for (var b=0;b<el.elements.length;b++){ 
   var formEl = el.elements[b];
   // si el elemento es un bot—n de submit
   if ((formEl.tagName == "INPUT") && (formEl.getAttribute("type") != null) && ((formEl.getAttribute("type").toLowerCase() == "submit") )) {
    formEl.disabled = true;
    document.getElementsByTagName("body")[0].style.cursor = 'wait';
    setTimeout(function(){formEl.disabled = false;document.body.style.cursor = 'default';},timeOutSecs*100000)
   }
  }
 }
 return true;
}
