
	var nts = window.event ? true : false;
	function NxCampo(evt,CampoN){
		var tcl = nts ? evt.which : evt.keyCode;
	   	if(tcl == 13) setFocus(CampoN);
	   	return (tcl != 13);
   	}
	function SgCampo(evt,CampoN){
		var tcl = nts ? evt.which : evt.keyCode;
		if(tcl == 13) setFocus(CampoN);
	}
	function SlNumeros(evt,campo){
		var tcl = nts ? evt.which : evt.keyCode;
		return (tcl <= 12 || tcl >= 48 && tcl <= 57);
	}
	function SlLetras(evt,form){
		var tcl = nts ? evt.which : evt.keyCode;
		return !(((tcl >= 1  && tcl <= 31) || (tcl >= 33 && tcl <= 64)) || (tcl > 90  && tcl <= 96) || ((tcl > 122 && tcl <= 224 ) || (tcl > 226 && tcl <= 232 ) || (tcl > 234 && tcl <= 236 ) || (tcl > 238 && tcl <= 242)  || (tcl > 244 && tcl <= 249 ) || (tcl > 250 && tcl <= 256 )))
	}
	function msgPt(evt){
		var tcl = nts ? evt.which : evt.keyCode;
		if(tcl == 46) muestraMensaje("Este campo solo admite números enteros");
	}
	function getCursor(nBox){
		var cursorPos = 0;
		if (document.selection){
			nBox.focus();
			var tmpRange = document.selection.createRange();
			tmpRange.moveStart('character',-nBox.value.length);
			cursorPos = tmpRange.text.length;
		} else {
			if (nBox.selectionStart || nBox.selectionStart == '0') cursorPos = nBox.selectionStart
		}
		return cursorPos;
	}
	function x_decimal(evt,campo,ent,des){
		var key = (evt.which) ? evt.which : evt.keyCode;
		retorno = true;
		punto = campo.value.indexOf('.');
		if (!(key <= 12 || key == 46 || ( key >= 48 && key <= 57) || (key >= 37 && key <= 39) || key == 116 || (key >= 35 && key <= 36)))
			retorno = false;
			if(key==46){
				if(punto>-1) retorno = false;
			}
			if(punto>-1 && (key >= 48 && key <= 57)){
				if(getCursor(campo) <= punto && punto == (ent)) retorno = false;
				if(getCursor(campo) > punto && (campo.value.length - (punto+1)) == (des)) retorno = false;
			}else if(key >= 48 && key <= 57){
				if(campo.value.length>(ent-1)&&key!=46) retorno = false;
			}
			return retorno;
	}
	function mostrarFRM(form,val){
		iden(form).style.display = (val) ? 'block' : 'none';
	}
	function vacio(q){
		for(i=0;i<q.length;i++){
			if(q.charAt(i)==" "){
				return true;
			}
		}
		return false
	}
   function getValueChk(ctrl){
      for(i=0;i<ctrl.length;i++)
         if(ctrl[i].checked) return ctrl[i].value;
   }   
	function validaForms(nom){
	  var cont=0;
	  for(var i=0;i<iden(''+nom).elements.length;i++){
		if(iden(''+nom).elements[i].checked){
		  cont+=1;
		}
	  }
	  if(cont == 0){
		muestraMensaje("No ha seleccionado ningún registro");
		return false;
	  }
	  return true;
	}
	function openMail(theURL,features, w,h) {
		var izquierda = (screen.availWidth - w) / 2;
		var arriba = (screen.availHeight - h) / 2;
		window.open(theURL,'CorreoForo',features+ ",left= " + izquierda + ",top=" + arriba+" ,screenX="+izquierda+",screenY=" + arriba);// showModalDialog
	}
	function abrirModal(url){
		if (window.showModalDialog){
			var caracteristicas = "dialogTop=100px;dialogLeft=100px;dialogWidth=700px;dialogHeight=265px;center=yes;help=no;font-family:Arial;";
			window.showModalDialog(url, "Mail", caracteristicas);
		} else {
			var caracteristicas = "height=265,width=700,toolbar=0,directories=0,status=0,linemenubar=0,modal=yes,left=100,top=100,dialog=yes,resizable,scrollbars";
			NuevaVentana = window.open(url,'Mail',caracteristicas);
			NuevaVentana.moveTo(100,100);
			NuevaVentana.focus();
		}
	}
	function VistaPrevia(theURL,features){
		window.showModalDialog(theURL,'CorreoForo',features);
	}
	function openMail1(theURL,features) {
		if(window.showModalDialog){
			window.showModalDialog(theURL,'CorreoForo',features);// showModalDialog
		}else{
			var preview = null;
			var izquierda = (screen.availWidth - 950) / 2; 
			var arriba = (screen.availHeight - 750) / 2; 
			var caracteristicas = "height=750,width=950,toolbar=0,directories=0,status=0,linemenubar=0,dialog=yes,modal=yes,left="+izquierda+", top="+arriba+", resizable=no, scrollbars=yes, status=no";
			preview = window.open(theURL,'preview',caracteristicas);
			preview.focus();
		}
	}
	function AbreFicha(theURL,winName,features, w,h) {
		var win = null;
		var izquierda = (screen.availWidth - w) / 2;
		var arriba = (screen.availHeight - h) / 2;
		win = window.open(theURL,winName,features+ ",left= " + izquierda + ",top=" + arriba);
		return win;
	}
	function entrar(objeto){
		objeto.style.cursor = "pointer";
		 objeto.style.backgroundColor = "#E8E8E9";
		 if(objeto.getElementsByTagName('tr')[0]){
			 objeto.getElementsByTagName('tr')[0].style.cursor = "pointer";
			 objeto.getElementsByTagName('tr')[0].style.backgroundColor = "#E8E8E9";
		 }
	}
	function consult(objeto){
		objeto.style.cursor = "none";
		 objeto.style.backgroundColor = "#E8E8E9";
		 if(objeto.getElementsByTagName('tr')[0]){
			 objeto.getElementsByTagName('tr')[0].style.cursor = "none";
			 objeto.getElementsByTagName('tr')[0].style.backgroundColor = "#E8E8E9";
		 }
	}
	function salir(objeto){
		objeto.style.cursor = "";
		objeto.style.backgroundColor = "";
		if(objeto.getElementsByTagName('tr')[0]){
			objeto.getElementsByTagName('tr')[0].style.cursor = "";
			objeto.getElementsByTagName('tr')[0].style.backgroundColor = "";
		}
	}
   function setValue(cmp_frm,valor){
	   eval("window.opener.document.getElementById('"+cmp_frm+"').value = "+valor);
   }
   function esDigito(sChr){
      var sCod = sChr.charCodeAt(0);
      return ((sCod > 47) && (sCod < 58)); 
   } 
   function valSep(oTxt){
      var bOk = false;
      var sep1 = oTxt.charAt(2); 
      var sep2 = oTxt.charAt(5); 
      bOk = bOk || ((sep1 == "-") && (sep2 == "-")); 
      bOk = bOk || ((sep1 == "/") && (sep2 == "/")); 
     return bOk; 
   } 
   function finMes(oTxt){
      var nMes = parseInt(oTxt.substr(3, 2), 10); 
      var nAno = parseInt(oTxt.substr(6), 10); 
      var nRes = 0; 
      switch (nMes){
         case 1: nRes = 31; break; 
         case 2: nRes = 28; break; 
         case 3: nRes = 31; break; 
         case 4: nRes = 30; break; 
         case 5: nRes = 31; break; 
         case 6: nRes = 30; break; 
         case 7: nRes = 31; break; 
         case 8: nRes = 31; break; 
         case 9: nRes = 30; break; 
         case 10: nRes = 31; break; 
         case 11: nRes = 30; break; 
         case 12: nRes = 31; break; 
      } 
      return nRes + (((nMes == 2) && (nAno % 4) == 0)? 1: 0); 
   } 
   function valDia(oTxt){
      var bOk = false; 
      var nDia = parseInt(oTxt.substr(0, 2), 10); 
      bOk = bOk || ((nDia >= 1) && (nDia <= finMes(oTxt))); 
      return bOk; 
   } 
   function valMes(oTxt){
      var bOk = false; 
      var nMes = parseInt(oTxt.substr(3, 2), 10); 
      bOk = bOk || ((nMes >= 1) && (nMes <= 12)); 
      return bOk; 
   } 
   function valAno(oTxt){
      var bOk = true; 
      var nAno = oTxt.substr(6); 
      bOk = bOk && ((nAno.length == 2) || (nAno.length == 4)); 
      if (bOk){
         for (var i = 0; i < nAno.length; i++){
            bOk = bOk && esDigito(nAno.charAt(i)); 
         } 
      } 
      return bOk; 
   } 
   function valFecha(oTxt){
      var bOk = true; 
      if (oTxt != ""){
         bOk = bOk && (valAno(oTxt)); 
         bOk = bOk && (valMes(oTxt)); 
         bOk = bOk && (valDia(oTxt)); 
         bOk = bOk && (valSep(oTxt)); 
         if(!bOk){
            muestraMensaje(""+mns(6)); 
         }
      }
   }
   function esBisiesto(nAno){
    var bRes = true;
    res = bRes && (nAno % 4 == 0);
    res = bRes && (nAno % 100 != 0);
    res = bRes || (nAno % 400 == 0);
    return bRes;
   }
	function fechaMayorOIgualQue(fec0, fec1){
		var bRes = false;
    	var sDia0 = fec0.substr(0, 2);
	    var sMes0 = fec0.substr(3, 2);
	    var sAno0 = fec0.substr(6, 4);
	    var sDia1 = fec1.substr(0, 2);
	    var sMes1 = fec1.substr(3, 2);
	    var sAno1 = fec1.substr(6, 4);
	    if (sAno0 > sAno1) bRes = true;
	    else {
    		if (sAno0 == sAno1){
     			if (sMes0 > sMes1) bRes = true;
				else{
					if(sMes0 == sMes1)
						if (sDia0 >= sDia1) bRes = true;
      			}
     		}
    	}
    	return bRes;
   }
   var lon_cmp_fecha=0;
   function sigCampo(cmp_obj,event,tam,sig_cmp){
      if(event == "down"){
         lon_cmp_fecha=cmp_obj.value.length;
      }else if(event == "up"){
         if(cmp_obj.value.length != lon_cmp_fecha){
            lon_cmp_fecha=cmp_obj.value.length;
            if(lon_cmp_fecha == tam){
               iden(sig_cmp).focus();
            }
         }
      }
   }
   var fecha = new Date();
   function chkDia(dya){
      if(dya.value>31){
         muestraMensaje(''+mns(0));
         dya.value='';
         dya.focus();
      }
   }
   function chkMes(m3s){
      if(m3s.value>12){
         muestraMensaje(''+mns(1));
         m3s.value='';
         m3s.focus();
      }
   }
   function chkYear(llear){
      if(llear.value>fecha.getFullYear()){
         muestraMensaje(''+mns(2));
         llear.value='';
         llear.focus();
      }
	  if(llear.value!=""&&llear.value<1900){
         muestraMensaje("El año es incorrecto, favor de verificar");
         llear.value='';
         llear.focus();
	  }
   }
   function ckYear(llear){
      if(llear.value.length!=4){
         muestraMensaje(''+mns(6));
         llear.value='';
         llear.focus();
      }
	  if(llear.value!=""&&llear.value<1900){
         muestraMensaje("El año es incorrecto, favor de verificar");
         llear.value='';
         llear.focus();
	  }
   }
   function echeck(str){
      var at="@"
      var dot="."
      var lat=str.indexOf(at)
      var lstr=str.length
      var ldot=str.indexOf(dot)
      if ( lat <=0 || lat==lstr ){ return false }
      if ( ldot<=0 || ldot==lstr){ return false }
      if (str.indexOf(at,(lat+1))!=-1){ return false }
      if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ return false }
      if (str.indexOf(dot,(lat+2))==-1){ return false }
      if (str.indexOf(" ")!=-1){ return false }
      return true
   }
   function is_mail(dato){
      return (iden(dato).value.match(/\.com|\.gob|\.edu|\.net|\.gov|\.org|\.mx|\.es/) == null) ? true : false;
   }
   var reEmail = /^\s*([a-z0-9_.\-]+@[a-z0-9.\-]+)\s*$/i;
   function is_empty(cmp_val){
      return (iden(cmp_val).value == "" || iden(cmp_val).value == null || iden(cmp_val).value == 0 ) ? true : false;
   }
   function is_val(cmp_val){
      return (iden(cmp_val).value == "" || iden(cmp_val).value == null) ? true : false;
   }
   function mns(num){
      var mens = new Array();
      mens[0] = "Los días escritos no deben de ser mayor a 31.";
      mens[1] = "Los meses escritos no deben de ser mayor a 12.";
      mens[2] = "El año no debe de ser mayor al actual.";
      mens[3] = "Es necesario llenar este campo.";
      mens[4] = "Escriba una dirección de correo valida.";
      mens[5] = "Necesita escribir una dirección de correo electronica valida";
      mens[6] = "Fecha inválida.";
      mens[7] = "Fecha correcta.";
      return mens[parseInt(num)];
   }
   function formatearNumero(fld, milSep, decSep, e){
      var sep = 0;
	  var key = ''; 
      var i = j = 0; 
      var len = len2 = 0; 
      var strCheck = '0123456789'; 
      var aux = aux2 = ''; 
      var whichCode = (window.Event) ? e.which : e.keyCode; 
      if (whichCode == 13) return false; // Enter 
      key = String.fromCharCode(whichCode); // Get key value from key code 
      if (strCheck.indexOf(key) == -1) return false; // Not a valid key 
      len = fld.value.length; 
      for(i = 0; i < len; i++) 
         if ((fld.value.charAt(i) != '0') && (fld.value.charAt(i) != decSep)) break; 
      aux = ''; 
      for(; i < len; i++) 
         if (strCheck.indexOf(fld.value.charAt(i))!=-1) aux += fld.value.charAt(i); 
      aux += key; 
      len = aux.length; 
      if (len == 0) fld.value = ''; 
      if (len == 1) fld.value = '0'+ decSep + '0' + aux; 
      if (len == 2) fld.value = '0'+ decSep + aux; 
      if (len > 2) { 
      aux2 = ''; 
         for (j = 0, i = len - 3; i >= 0; i--) { 
            if(j == 3){
               aux2 += milSep; 
               j = 0; 
            }
            aux2 += aux.charAt(i); 
            j++; 
         }
         fld.value = ''; 
         len2 = aux2.length; 
         for (i = len2 - 1; i >= 0; i--) 
            fld.value += aux2.charAt(i); 
         fld.value += decSep + aux.substr(len - 2, len); 
     } 
     return false; 
   }
	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];}}
	}
   
// JavaScript Document