// Ilumninan u Opacan una imagen.
     function high(which2)
      {theobject=which2;
       highlighting=setInterval("highlightit(theobject)",50);
      }
     function low(which2)
      {clearInterval(highlighting);
       which2.filters.alpha.opacity=50;
      }
     function highlightit(cur2)
      {if(cur2.filters.alpha.opacity<100)
        cur2.filters.alpha.opacity+=5
       else if(window.highlighting)
        clearInterval(highlighting)
      }
//
// Apertura de Ventana
     function AbreCalculadora()
      {var nuevaventana=window.open("http://srvsun:7777/inter/calculadora.html","Calculadora","width=205,height=310")}
//
// Texto que se ilumina como un faro
     mesk=new Array();
     mesk[10]="A"; mesk[11]="B"; mesk[12]="C"; mesk[13]="D"; mesk[14]="E"; mesk[15]="F";
     A=10; B=11; C=12; D=13; E=14; F=15;
     let="ABCDEF";
     
     function mes(num) {
        if (let.indexOf(num) != -1) {
           return eval(num)
        }
        else {
           if (num < 10) {
              return eval(num)
           } 
           else {
              return mesk[num]
           }
        }
     }
     
     function color(begin,einde,stappen,stap)
      {
       hh1=(mes(begin.charAt(0))*16)+mes(begin.charAt(1));
       hh2=(mes(begin.charAt(2))*16)+mes(begin.charAt(3));
       hh3=(mes(begin.charAt(4))*16)+mes(begin.charAt(5));
       pp1=(mes(einde.charAt(0))*16)+mes(einde.charAt(1));
       pp2=(mes(einde.charAt(2))*16)+mes(einde.charAt(3));
       pp3=(mes(einde.charAt(4))*16)+mes(einde.charAt(5));
       if(hh1 < pp1)
        {ff1=hh1+Math.floor((pp1-hh1)/stappen*stap);
         ff1=eval("\'"+mes(Math.floor(ff1/16))+"\'")+eval("\'"+mes(ff1-(Math.floor(ff1/16)*16))+"\'");
        }
       else
        {ff1=hh1-Math.floor((hh1-pp1)/stappen*stap);
         ff1=eval("\'"+mes(Math.floor(ff1/16))+"\'")+eval("\'"+mes(ff1-(Math.floor(ff1/16)*16))+"\'");
        }
       if(hh2 < pp2)
        {ff2=hh2+Math.floor((pp2-hh2)/stappen*stap);
         ff2=eval("\'"+mes(Math.floor(ff2/16))+"\'")+eval("\'"+mes(ff2-(Math.floor(ff2/16)*16))+"\'");
        }
       else
        {ff2=hh2-Math.floor((hh2-pp2)/stappen*stap);
         ff2=eval("\'"+mes(Math.floor(ff2/16))+"\'")+eval("\'"+mes(ff2-(Math.floor(ff2/16)*16))+"\'");
        }
       if(hh3 < pp3)
        {ff3=hh3+Math.floor((pp3-hh3)/stappen*stap);
         ff3=eval("\'"+mes(Math.floor(ff3/16))+"\'")+eval("\'"+mes(ff3-(Math.floor(ff3/16)*16))+"\'");
        }
        else
        {ff3=hh3-Math.floor((hh3-pp3)/stappen*stap);
         ff3=eval("\'"+mes(Math.floor(ff3/16))+"\'")+eval("\'"+mes(ff3-(Math.floor(ff3/16)*16))+"\'");
        }
        return ff1+ff2+ff3
      }
     bum=0;bum2=0;txt=new Array();txt[0]="";
     function lightf()
      {
       for(i=0;i != Math.floor(message.length/2);i++)
        {txt[i]=color(lightcolor1,lightcolor2,Math.floor(message.length/2),i)};
       for(i=Math.floor(message.length/2);i != message.length;i++)
        {txt[i]=color(lightcolor2,lightcolor1,Math.floor(message.length/2),(i-Math.floor(message.length/2)))};
       lightf1()
      }
     function lightf1()
      {txt[message.length+1]="";bum2=message.length-bum;
       for(i=0;i != message.length;i++)
        {if(i+bum < message.length){txt[message.length+1]=txt[message.length+1]+"<font color='#"+txt[(i+bum)]+"'>"+message.charAt(i)+"</font>"}else{txt[message.length+1]=txt[message.length+1]+"<font color='#"+txt[i-bum2]+"'>"+message.charAt(i)+"</font>"}}
       if(bum != message.length){bum++;}else{bum=0};light.innerHTML=txt[message.length+1];setTimeout("lightf1()",50)
      }
//
// Menú con botón derecho
  var menuskin = "skin1"; // skin0, or skin1
  var display_url = 0; // Show URLs in status bar?
  function showmenuie5() {
  var rightedge = document.body.clientWidth-event.clientX;
  var bottomedge = document.body.clientHeight-event.clientY;
  if (rightedge < ie5menu.offsetWidth)
  ie5menu.style.left = document.body.scrollLeft + event.clientX - ie5menu.offsetWidth;
  else
  ie5menu.style.left = document.body.scrollLeft + event.clientX;
  if (bottomedge < ie5menu.offsetHeight)
  ie5menu.style.top = document.body.scrollTop + event.clientY - ie5menu.offsetHeight;
  else
  ie5menu.style.top = document.body.scrollTop + event.clientY;
  ie5menu.style.visibility = "visible";
  return false;
  }
  function hidemenuie5() {
  ie5menu.style.visibility = "hidden";
  }
  function highlightie5() {
  if (event.srcElement.className == "menuitems") {
  event.srcElement.style.backgroundColor = "highlight";
  event.srcElement.style.color = "white";
  if (display_url)
  window.status = event.srcElement.url;
  }
  }
  function lowlightie5() {
  if (event.srcElement.className == "menuitems") {
  event.srcElement.style.backgroundColor = "";
  event.srcElement.style.color = "black";
  window.status = "";
    }
  }
  function jumptoie5() {
  if (event.srcElement.className == "menuitems") {
  if (event.srcElement.getAttribute("target") != null)
  window.open(event.srcElement.url, event.srcElement.getAttribute("target"));
  else
  window.location = event.srcElement.url;
    }
  }
//
//Llama a una función pasandole un parametro (ver reporte de provincias)
  function encender(pprov,pmes,panio) 
   {
    DatosDer.location.href = "http://intranet:3333/pls/prod/wmai.mapa_info?pProv="+pprov+"&pMes="+pmes+"&pAnio="+panio;
   }
//
// Verifica si el campo tiene solo números
function dmd_HaySoloNros(cValor, sPermiteNulo)
{
 var digitos = '-.0123456789'; 
 var sMensaje = '';
 if (cValor=='' && sPermiteNulo=='N') {sMensaje='Debe ingresar un valor numérico';}
 if (sMensaje=='')
  {
   for (var i=0; i<cValor.length; i++)
    {
     temp = cValor.substring(i, i+1)
     if (digitos.indexOf(temp) == -1)  {sMensaje='Debe ingresar un valor numérico';}
    }
  }
 return sMensaje;
}
//
// Manda un msg si no hay solo nros.
function dmd_SoloNros(cValor, sPermiteNulo)
{
 var sMensaje = '';
 sMensaje =  dmd_HaySoloNros(cValor, sPermiteNulo);
 if (sMensaje != '')      {alert(sMensaje); return false;}
 return true;
}
//
//
function dmd_NoNulo(cValor)
{
 if (cValor.value=='') 
    {alert('Debe ingresar un valor!!!');
//     cValor.focus();
     return false;
    }
 return true;
}
//
// Redondeo
function round (n) {
    n = Math.round(n * 100) / 100;
    n = (n + 0.001) + '';
    return n.substring(0, n.indexOf('.') + 3);
}
//
// Formatea un numero.....
function formatNumber(n, d) 
{
  n = round (n, d);
  for (var i = n.indexOf('.') - 3; i > 0; i -= 3)
    n = n.substring(0, i) + ',' + n.substring(i);
  return n;
}

function fshowHide(elementid)
{
 if (document.getElementById(elementid).style.display == 'none'){
  document.getElementById(elementid).style.display = '';
 } 
 else {
 document.getElementById(elementid).style.display = 'none';
 }
}

