﻿var _menu = 0;
var c_altodivmenutop = 22;
var c_autorefresh=false; // Autorefresco Automático
var c_sitemap=false; // Montar en el titulo de las ventanas SiteMapPath
var c_navegador="I";
// Para evitar el boton derecho  
try
{
  document.oncontextmenu=new Function("return false");
} 
catch (ex) {}
//
try 
{
  parent.document.getElementById("divtituloprincipal").style.visibility="hidden";
  eltop=parent.document.getElementById("divmenuleft").style.top;
  parent.document.getElementById("divcontenedor").style.top=eltop;
  elframecontenedor=parent.document.getElementById("framecontenedor");
  elframecontenedor.style.height=parent.document.getElementById("divcontenedor").style.height;
}
catch (ex) {}
//
function js_Inicio(_documento)
{
try
{  
  _nav=navigator.userAgent.toUpperCase();
  c_navegador="I";
  if (_nav.indexOf("SAFARI")>=0)  c_navegador="S";
  if (_nav.indexOf("OPERA")>=0)   c_navegador="O";
  if (_nav.indexOf("FIREFOX")>=0) c_navegador="F";
//  
  if (c_navegador=="S")
  {
    _clientWidth = screen.availWidth - 4;              
    _clientHeight = screen.availHeight - 130;             
  } 
  if (c_navegador=="O")
  {
    _clientWidth = screen.availWidth - 6;           
    _clientHeight = screen.availHeight - 135;            
  } 
  if (c_navegador=="F")
  {
    _clientWidth =  screen.availWidth - 4;              
    _clientHeight = screen.availHeight - 150;              
  } 
//
  if (c_navegador=="I")
  {
    _clientWidth = parseInt(_documento.body.clientWidth);             
    _clientHeight = parseInt(_documento.body.clientHeight);             
  } 
}
catch (ex) {}   
} 
//
function js_EditorHTML(titulo,campoeditar)
{
  try
  {
    _titulo=titulo;
    _campoeditar=campoeditar;
    _parametro="width=700,height=500,left=" + (screen.availWidth-700)/2 + ",top=" + (screen.availHeight-500)/2 ;
    vent=js_PaginaAbrir("PaginaEditorHTML.aspx?titulo=" + titulo + "&campo=" + campoeditar ,"PaginaEditorHTML",_parametro);
// Quitar **JMD**
//   setTimeout("js_EditorHTML_Espera()",2000);
  } 
  catch (ex) {}
}
//
function js_EditorHTML_Espera() 
{
  try 
  {
    vent.location.href="PaginaEditorHTML.aspx?titulo=" + _titulo + "&campo=" + _campoeditar;
  } 
  catch (ex) {}
}
//
function js_EditorHTML2()
{
  try
  {
    frmEditor.document.execCommand("EditMode",true,true);
    frmEditor.document.execCommand("LiveResize", false, true);
    frmEditor.document.execCommand("2D-Position", false, true);
    frmEditor.document.execCommand("MultipleSelection", false, true);
    frmEditor.focus();
//   
    campo=document.getElementById("campo").value;
    
    valor=opener.document.getElementById(campo).innerHTML;
    valor=valor.replace(/\[/gi,"<");
    valor=valor.replace(/\]/gi,">");
    valor=valor.replace(/\r\n/gi,"<BR>"); // salto de linea
    valor=valor.replace(/\n\r/gi,"<BR>"); // salto de linea

    setTimeout("frmEditor.document.body.innerHTML='" + valor + "'",500);
  } 
  catch (ex) {}
}
//
function js_EditorHTML3()
{
  try
  {
    campo=document.getElementById("campo").value
    valor=frmEditor.document.body.innerHTML;
//
    valor=valor.replace(/<P>/gi,"");
    valor=valor.replace(/<\/P>/gi,"<BR>");
    valor=valor.replace(/</gi,"[");
    valor=valor.replace(/>/gi,"]");
    valor=valor.replace(/&lt;/gi,"[");
    valor=valor.replace(/&gt;/gi,"]");
//
    opener.document.getElementById(campo).innerHTML=valor;
    window.close();
  } 
  catch (ex) {}
}
//
function js_Ampliar() {
  try {
    vent=js_PaginaAbrir('PaginaFotoReal.aspx','PaginaFotoReal','left=0,top=0,width=' + (screen.availWidth  - 10)+ ',height=' + (screen.availHeight - 30));
// Quitar **JMD**
//    setTimeout("js_Ampliar_Espera()",2000);
  } 
  catch (ex) {}
}
//
function js_Ampliar_Espera() {
  try {vent.location.href="PaginaFotoReal.aspx";} 
  catch (ex) {}
}
//
function js_PaginaCalendario(elcampo)
{
  try
  {  
    _elcampo=elcampo;
    _losparametros = "width=360,height=240,left=" + (screen.availWidth - 360) / 2 + ",top=" + (screen.availHeight - 240) / 2 + "";
//
    _valor=get_value(document.getElementById(_elcampo));
    vent=js_PaginaAbrir("PaginaCalendario.aspx?id=" + _elcampo + "&valor=" + _valor,"PaginaCalendario",_losparametros);
// Quitar **JMD**
//    setTimeout("js_PaginaCalendario_Espera()",2000);
  } 
  catch (ex) {}
}
//
function js_PaginaCalendario_Espera() {
  try {vent.location.href="PaginaCalendario.aspx?id=" + _elcampo + "&valor=" + _valor;} 
  catch (ex) {}
}
//
function js_Recursiva(_evento,_ind)
{
  try
  {
    if (_evento == "click")
    {
      for (i=1;i<=20;i++) 
      { 
        try
        {
          _td = document.getElementById("tdopcion_" + i);
          _td.className = "menurecursiva";
          _tdtx = document.getElementById("tdopciontx_" + i);
          _tdtx.className = "menurecursivatexto";
        }
        catch (ex) {} 
      }
      _td = document.getElementById("tdopcion_" + _ind);
      _td.className = "menurecursivaclick";
      _tdtx = document.getElementById("tdopciontx_" + _ind);
      _tdtx.className = "menurecursivatextoclick";
    
    } 
    if (_evento == "over")
    {
      _td = document.getElementById("tdopcion_" + _ind);
      _tdtx = document.getElementById("tdopciontx_" + _ind);
      if (_td.className != "menurecursivaclick") 
      {
        _td.className="menurecursivasel";
        _tdtx.className="menurecursivatextosel";
      }
    } 
    if (_evento == "out")
    {
      _td = document.getElementById("tdopcion_" + _ind);
      _tdtx = document.getElementById("tdopciontx_" + _ind);
      if (_td.className != "menurecursivaclick")
      {
        _td.className="menurecursiva";
        _tdtx.className="menurecursivatexto";
      } 
    } 
  } 
  catch (ex) {}
}
//
function js_PrincipalResize()
{
  try {parent.location.reload();} catch (ex) {}
}
//
function js_Reload()
{
  try
  {
    elobj=document.getElementById("framecontenedor");
    js_Contenedor(elobj.src);
    js_PaginaPrincipalContenedorResize();
  } 
  catch (ex) {}
}
//
function js_PaginaAdm00() // Pagina Super
{
  try
  {
// Ampliar al maximo el editor de texto HTML  
    elcontenedor=parent.document.getElementById("framecontenedor");
    elobj=document.getElementById("TxMECabeceraHTML");
    elobj.style.height=((parseInt(elcontenedor.style.height) * 30) / 100 ) + "px";
//
    js_PaginaComunBotones(elcontenedor);
   } 
  catch (ex) {}
}
//
function js_PaginaAdm03() // Paginas Recursivas
{
  try
  {
// Ampliar al maximo el editor de texto HTML  
    _obj=parent.document.getElementById("framecontenedor");
    if (_obj == null) _obj=parent.document.getElementById("framecontenedorrecursiva");
//
    _ancho=parseInt(_obj.style.width) + "px";;
//  
    eldivtitulo=document.getElementById("divtitulo");
    eldivtitulo.style.width=_ancho;
    eldivbotones=document.getElementById("divbotones");
    _alto=parseInt(_obj.style.height) - parseInt(eldivtitulo.style.height) - parseInt(eldivbotones.style.height) - 1 + "px";
//  
    elcontenedor=document.getElementById("panelME");
    elcontenedor.style.width=_ancho;
    elcontenedor.style.height=_alto;
    elcontenedor=document.getElementById("panelSU");
    elcontenedor.style.width=_ancho;
    elcontenedor.style.height=_alto;
//
    eldivbotones.style.top=parseInt(elcontenedor.style.top) + parseInt(elcontenedor.style.height) + "px";
//
   
    elobj=document.getElementById("TxSUNivel2");
    elobj.style.height=(parseInt(_obj.style.height) * 10) / 100  + "px";
    elobj=document.getElementById("TxSUNivel3");
    elobj.style.height=(parseInt(_obj.style.height) * 16) / 100  + "px";
//
    js_PaginaComunBotones(_obj);
//
  } 
  catch (ex) {}
}
//
function js_PaginaAdm04() // Pagina Galerias
{
  try
  {
// Ampliar al maximo el editor de texto HTML  
    _obj=parent.document.getElementById("framecontenedor");
    if (_obj == null) _obj=parent.document.getElementById("framecontenedorrecursiva");
//
    _ancho=parseInt(_obj.style.width) + "px";
//    
    eldivtitulo=document.getElementById("divtitulo");
    eldivtitulo.style.width = _ancho;
    eldivbotones=document.getElementById("divbotones");
    _alto=parseInt(_obj.style.height) - parseInt(eldivtitulo.style.height) - parseInt(eldivbotones.style.height) - 1 + "px";
//
    elcontenedor=document.getElementById("panelGA");
    elcontenedor.style.width = _ancho;
    elcontenedor.style.height = _alto;
    elcontenedor=document.getElementById("panelTX");
    elcontenedor.style.width = _ancho;
    elcontenedor.style.height = _alto;
    elcontenedor=document.getElementById("panelIN");
    elcontenedor.style.width = _ancho;
    elcontenedor.style.height = _alto;
//
    eldivbotones.style.top=parseInt(elcontenedor.style.top) + parseInt(elcontenedor.style.height) + "px";

    elobj=document.getElementById("TxTXTexto");
    elobj.style.height=((parseInt(_obj.style.height) * 42) / 100 ) + "px";
//
    js_PaginaComunBotones(_obj);
  } 
  catch (ex) {}
}
//
function js_PaginaAdm05() // Agrupar Galerias
{
  try
  {
    _obj=parent.document.getElementById("framecontenedor");
    if (_obj == null) _obj=parent.document.getElementById("framecontenedorrecursiva");
//
    _ancho=parseInt(_obj.style.width) + "px";;
//  
    eldivtitulo=document.getElementById("divtitulo");
    eldivtitulo.style.width=_ancho;
    eldivbotones=document.getElementById("divbotones");
    _alto=parseInt(_obj.style.height) - parseInt(eldivtitulo.style.height) - parseInt(eldivbotones.style.height) - 1 + "px";
//  
    elcontenedor=document.getElementById("panelGR");
    elcontenedor.style.width=_ancho;
    elcontenedor.style.height=_alto;
    elcontenedor=document.getElementById("panelGA");
    elcontenedor.style.width=_ancho;
    elcontenedor.style.height=_alto;
//
    eldivbotones.style.top=parseInt(elcontenedor.style.top) + parseInt(elcontenedor.style.height) + "px";
//
    js_PaginaComunBotones(_obj);
//
  } 
  catch (ex) {}
}
//
function js_PaginaAdm06() // Gestion Fotos
{
  try
  {
    _obj=parent.document.getElementById("framecontenedor");
    if (_obj == null) _obj=parent.document.getElementById("framecontenedorrecursiva");
//
    _ancho=parseInt(_obj.style.width) + "px";;
//  
    eldivtitulo=document.getElementById("divtitulo");
    eldivtitulo.style.width=_ancho;
    eldivbotones=document.getElementById("divbotones");
    _alto=parseInt(_obj.style.height) - parseInt(eldivtitulo.style.height) - parseInt(eldivbotones.style.height) - 1 + "px";
//  
    elcontenedor=document.getElementById("panelFO");
    elcontenedor.style.width=_ancho;
    elcontenedor.style.height=_alto;
//  
    eldivbotones.style.top=parseInt(elcontenedor.style.top) + parseInt(elcontenedor.style.height) + "px";
//
    js_PaginaComunBotones(_obj);
//
    document.getElementById('cbFOMostrar').focus();
  } 
  catch (ex) {}
}
//
function js_PaginaAdm07() // Pagina Noticias
{
  try
  {
    _obj=parent.document.getElementById("framecontenedor");
    if (_obj == null) _obj=parent.document.getElementById("framecontenedorrecursiva");
//
    _ancho=parseInt(_obj.style.width) + "px";;
//  
    eldivtitulo=document.getElementById("divtitulo");
    eldivtitulo.style.width=_ancho;
    eldivbotones=document.getElementById("divbotones");
    _alto=parseInt(_obj.style.height) - parseInt(eldivtitulo.style.height) - parseInt(eldivbotones.style.height) - 1 + "px";
//  
    elcontenedor=document.getElementById("panel");
    elcontenedor.style.width=_ancho;
    elcontenedor.style.height=_alto;
//  
    eldivbotones.style.top=parseInt(elcontenedor.style.top) + parseInt(elcontenedor.style.height) + "px";
//
    js_PaginaComunBotones(_obj);
//
    elobj=document.getElementById("TxTexto");
    elobj.style.height=((parseInt(_obj.style.height) * 25) / 100 ) + "px";
    try {document.getElementById("TxNombre").focus();} catch (ex) {}
  } 
  catch (ex) {}
}
//
function js_PaginaAdm08() // Paginas Dinamicas
{
  try
  {
    _obj=parent.document.getElementById("framecontenedor");
    if (_obj == null) _obj=parent.document.getElementById("framecontenedorrecursiva");
//
    _ancho=parseInt(_obj.style.width) + "px";;
//  
    eldivtitulo=document.getElementById("divtitulo");
    eldivtitulo.style.width=_ancho;
    eldivbotones=document.getElementById("divbotones");
    _alto=parseInt(_obj.style.height) - parseInt(eldivtitulo.style.height) - parseInt(eldivbotones.style.height) - 1 + "px";
//  
    elcontenedor=document.getElementById("divpanel");
    elcontenedor.style.width=_ancho;
    elcontenedor.style.height=_alto;
//  
    eldivbotones.style.top=parseInt(elcontenedor.style.top) + parseInt(elcontenedor.style.height) + "px";
//
    js_PaginaComunBotones(_obj);
//
    elobj=document.getElementById("TxTexto");
    elobj.style.height=((parseInt(elcontenedor.style.height) * 85) / 100 ) + "px";
    try {document.getElementById("TxNombre").focus();} catch (ex) {}
  }
  catch (ex) {}
}
//
function js_PaginaAdm10() // Administrar Informes
{
  try
  {
// Ampliar al maximo el editor de texto HTML  
    elcontenedor=parent.document.getElementById("framecontenedor");
    if (elcontenedor == null) elcontenedor=parent.document.getElementById("framecontenedorrecursiva");
 
    elobj=document.getElementById("divmenu");
    elobj.style.width=((parseInt(elcontenedor.style.width) * 30) / 100 ) + "px";
    elobj=document.getElementById("panelME");
    elobj.style.width=((parseInt(elcontenedor.style.width) * 66) / 100 ) + "px";
    elobj=document.getElementById("panelSU");
    elobj.style.width=((parseInt(elcontenedor.style.width) * 66) / 100 ) + "px";
 //
    js_PaginaComunBotones(elcontenedor);
  } 
  catch (ex) {}
}
//
function js_PaginaAdm14() // Pagina Diario
{
  try
  {
// Ampliar al maximo el editor de texto HTML  
    elcontenedor=parent.document.getElementById("framecontenedor");
    if (elcontenedor == null) elcontenedor=parent.document.getElementById("framecontenedorrecursiva");

    elobj=document.getElementById("TxAsunto");
    elobj.style.height=((parseInt(elcontenedor.style.height) * 14) / 100 ) + "px";
    elobj=document.getElementById("TxObservaciones");
    elobj.style.height=((parseInt(elcontenedor.style.height) * 12) / 100 ) + "px";
 //
    js_PaginaComunBotones(elcontenedor);
  } 
  catch (ex) {}
}
//
function js_PaginaDinamica(_titulo)
{
   try
   {
     if (_titulo != "")
     {
       eltitulo=document.getElementById("tdtitulo");
       eltitulo.innerHTML=_titulo;
     }
   }
   catch (ex) {}
/////////////////////////////////////////////////
   try
   {
      elcontenedor=parent.document.getElementById("framecontenedor");
   }
   catch (ex) {}
// Ampliar al maximo el texto para HistoriaAsociacion  
   try {
     _obj=document.getElementById("divhistoria");
     _obj.style.height=((parseInt(elcontenedor.style.height) * 78) / 100 )+ "px";
   }
   catch (ex) {} 
// Ampliar al maximo el texto para PaginaCultura  
   try {
     _obj=document.getElementById("eldiv");
     _obj.style.height=((parseInt(elcontenedor.style.height) * 90) / 100 )+ "px";
   }
   catch (ex) {} 
}
//
function js_PaginaPrincipal(elanchomenuLEFT,mostrardivportada)
{
   try
     {
        js_Inicio(document);
//        
        elancho = parseInt((_clientWidth * elanchomenuLEFT) / 100);
        eldivtop=document.getElementById("divtop");
        eldivmenuleft=document.getElementById("divmenuleft");
        eldivmenuright=document.getElementById("divmenuright");
  
        eldivtop.style.width=_clientWidth - 2 + "px";
 
        eldivmenuleft.style.width = elancho + "px";
        eldivmenuright.style.width = elancho + "px";
        if (document.getElementById("menuposicion").value == "T") 
        {
          eldivmenuleft.style.width = "1px";
          eldivmenuright.style.width = "1px";
        }
//
        js_PaginaPrincipalContenedorResize();
     }  
   catch (ex) {}
//   
   try
   {
      eldivportada=document.getElementById("divportada");
      eldivportada.style.visibility="hidden";
      if (mostrardivportada) 
      {    
        eldivportada.style.width=_clientWidth + "px";
        eldivportada.style.height=_clientHeight + "px";
        eldivportada.style.left="0px";
        eldivportada.style.top="0px";
        eldivportada.style.visibility="visible";
      }
   }
   catch (ex) {}
}
//
function js_PaginaPrincipalContenedorResize()
{
  try
  {
        try 
        {
          a=document.getElementById("divtop");
          if (a == null) _doc=parent.document;
          else _doc=document;
        }
        catch (ex)
        {
          _doc=parent.document;
        }        
//        
        try {document.getElementById("divtituloprincipal").style.visibility="hidden";}
        catch (ex) {}
//
        eldivcontenedor=_doc.getElementById("divcontenedor");
        eldivcontenedor.style.visibility="hidden";
//
        eldivtop=_doc.getElementById("divtop");
        eldivmenuleft=_doc.getElementById("divmenuleft");
        eldivmenuright=_doc.getElementById("divmenuright");
        eldivmenutop=_doc.getElementById("divmenutop");
        
        if (eldivmenuleft.style.visibility == "visible") _visibleL = true;  
        else _visibleL = false;
        
        if (eldivmenuright.style.visibility == "visible") _visibleR = true;  
        else _visibleR = false;
      
        eldivcontenedor.style.top=parseInt(eldivtop.style.height) + 4 + "px";
        eldivmenuleft.style.top=parseInt(eldivtop.style.height) + "px";
        if (_doc.getElementById("menuposicion").value.indexOf("L") >= 0)
        {
          eldivmenuleft.style.top=parseInt(eldivtop.style.height) + 4 + "px";
          eldivcontenedor.style.top=parseInt(eldivtop.style.height) + 4 + "px";
        }
        if (_doc.getElementById("menuposicion").value.indexOf("R") >= 0)
        {
          eldivmenuright.style.top=parseInt(eldivtop.style.height) + 4 + "px";
          eldivcontenedor.style.top=parseInt(eldivtop.style.height) + 4 + "px";
        }
//            
         if (_doc.getElementById("menuposicion").value.indexOf("T") >= 0)
        { 
          eldivcontenedor.style.left = "0px";
          eldivcontenedor.style.width = _clientWidth + "px";
          eldivmenutop.style.top = parseInt(eldivtop.style.top) + parseInt(eldivtop.style.height) + "px";

          eldivcontenedor.style.top = parseInt(eldivmenutop.style.top) + c_altodivmenutop + "px";
     
          if (eldivmenutop.style.visibility == "hidden") 
          {
            if (parseInt(eldivtop.style.height) <= 1) eldivcontenedor.style.top="1px";
            else eldivcontenedor.style.top=parseInt(eldivtop.style.height) + "px";
          }
   
          eldivmenuleft.style.top = parseInt(eldivmenutop.style.top) + c_altodivmenutop + "px";
          eldivmenuright.style.top = parseInt(eldivmenutop.style.top) + c_altodivmenutop + "px";
        }
//
        eldivmenuright.style.left = _clientWidth - parseInt(eldivmenuright.style.width) + "px";
        
//
        if (_visibleL || _visibleR) 
        {
          if (_visibleL) eldivcontenedor.style.left = parseInt(eldivmenuleft.style.width) + "px";
          else eldivcontenedor.style.left = "0px";
          _ancho = _clientWidth - 4;
   
          if (_visibleL) _ancho = _ancho - parseInt(eldivmenuleft.style.width);  
          if (_visibleR) _ancho = _ancho - parseInt(eldivmenuright.style.width);
            
          eldivcontenedor.style.width = _ancho + "px";
        }
        else 
        {
          eldivcontenedor.style.left = "0px";
          eldivcontenedor.style.width = _clientWidth - 4 + "px";
        }
//
        eldivcontenedor.style.height = _clientHeight - parseInt(eldivcontenedor.style.top) - 20 + "px";
        eldivmenuleft.style.height = _clientHeight - parseInt(eldivcontenedor.style.top) - 22 + "px";
        eldivmenuright.style.height = _clientHeight - parseInt(eldivcontenedor.style.top) - 22 + "px";
//
        elobj=_doc.getElementById("framecontenedor");
        elobj.style.width=(parseInt(eldivcontenedor.style.width) - 15) + "px";
        elobj.style.height=(parseInt(eldivcontenedor.style.height) - 6) + "px";
//        
        _obj=_doc.getElementById("divnoticias");
//
        if (_obj.style.left == "0px")
        {
          _obj.style.top=parseInt(eldivcontenedor.style.top) + "px";   
          _obj.style.width= ((_clientWidth * 28) / 100) + "px";
          _obj.style.left=parseInt(eldivcontenedor.style.width) + parseInt(eldivcontenedor.style.left) - parseInt(_obj.style.width) - 4 + "px";
        }
// MENU SUPERIOR DE PAGINA
        eldivmenusuperior=_doc.getElementById("divmenusuperior");
        eldivmenusuperior.style.left="0%" // _clientWidth - parseInt(eldivmenusuperior.style.width) + "px";
        eldivmenusuperior.style.width=parseInt(eldivtop.style.width) + "px";
        eldivmenusuperior.style.height="auto";
        eldivmenusuperior.style.top="0px";
// MENU PIE DE PAGINA
        eldivmenupie=_doc.getElementById("divmenupie");
        eldivmenupie.style.left="0%"  // parseInt(eldivcontenedor.style.left) + "px";
        eldivmenupie.style.width=parseInt(eldivtop.style.width) + "px";
        eldivmenupie.style.height="18px";
        eldivmenupie.style.top=parseInt(eldivcontenedor.style.top) + parseInt(eldivcontenedor.style.height) + 2 + "px";
//
        eldivmenutop.style.left=eldivcontenedor.style.left;
        if (_visibleR) eldivmenutop.style.width=parseInt(eldivcontenedor.style.width) + parseInt(eldivmenuright.style.width) - 10 + "px"; 
        else eldivmenutop.style.width=parseInt(eldivcontenedor.style.width) + "px"; 
//
        eldivcontenedor.style.visibility="visible";
//
  } 
  catch (ex) {eldivcontenedor.style.visibility="visible";}
}
//
function js_PaginaComun()
{
  try
  {
//     
     eldivtitulo=document.getElementById("divtitulo");
     elcontenedor=document.getElementById("divcontenedor");
     elobj=document.getElementById("framecontenedor");
     if (elobj == null) elobj=parent.document.getElementById("framecontenedor");
     if (elobj == null) elobj=parent.document.getElementById("framecontenedorrecursiva");
//
     if (eldivtitulo == null) 
     {
       elcontenedor.style.height = parseInt(elobj.style.height) - 2 + "px";
     }
     else 
     {
       elcontenedor.style.height = parseInt(elobj.style.height) - parseInt(eldivtitulo.style.height) - 2 + "px";
     }
     elcontenedor.style.width = parseInt(elobj.style.width) - 2 + "px";
     eldivtitulo.style.width = parseInt(elobj.style.width) - 2 + "px";
//
  }
  catch (ex) {}
}
//
function js_PaginaComunBotones(_elcontedor)
{
  try
  {
    eldivbotones=document.getElementById("divbotones");
    eldivbotones.style.width=parseInt(_elcontedor.style.width) - 20 + "px";
  }
  catch (ex) {}
}
//
function js_PaginaDocumentacion()
{
  try
  {
     eldivtitulo=document.getElementById("divtitulo");
     eldivbotones=document.getElementById("divbotones");
     elcontenedor=document.getElementById("divcontenedor");
     eldivprevio=document.getElementById("divprevio");
     elobj=document.getElementById("framecontenedor");
     if (elobj == null) elobj=parent.document.getElementById("framecontenedor");
     if (elobj == null) elobj=parent.document.getElementById("framecontenedorrecursiva");
//
     _ancho=parseInt(elobj.style.width) - 4 + "px";
     eldivtitulo.style.width=_ancho;
     eldivbotones.style.width=_ancho;
     elcontenedor.style.width=_ancho;
     elcontenedor.style.height=parseInt(elobj.style.height) - parseInt(eldivtitulo.style.height) - parseInt(eldivbotones.style.height) - 8 + "px";
//
     eldivprevio.style.width=(parseInt(elobj.style.width) * 30) / 100 + "px" ;
     eldivprevio.style.height=(parseInt(elobj.style.height) * 30) / 100 + "px" ;
     eldivprevio.style.left = parseInt(elobj.style.width) - parseInt(eldivprevio.style.width) - 10 + "px";
     eldivprevio.style.top = parseInt(elobj.style.height) - parseInt(eldivprevio.style.height) - 10 + "px";
//
     latabla=document.getElementById("TABLAELEMENTOS");
     latabla.style.width=parseInt(elcontenedor.style.width) - 18 + "px";
//
  }
  catch (ex) {}
}
//
function js_PaginaDiario()
{
  try
  {
     eldivtitulo=document.getElementById("divtitulo");
     eldivbotones=document.getElementById("divbotones");
     elcontenedor=document.getElementById("divcontenedor");
     elobj=document.getElementById("framecontenedor");
     if (elobj == null) elobj=parent.document.getElementById("framecontenedor");
     if (elobj == null) elobj=parent.document.getElementById("framecontenedorrecursiva");
//
     _ancho=parseInt(elobj.style.width) - 4 + "px";
     eldivtitulo.style.width=_ancho;
     eldivbotones.style.width=_ancho;
     elcontenedor.style.width=_ancho;
     elcontenedor.style.height=parseInt(elobj.style.height) - parseInt(eldivtitulo.style.height) - parseInt(eldivbotones.style.height) - 8 + "px";
//
     latabla=document.getElementById("TABLAELEMENTOS");
     latabla.style.width=parseInt(elcontenedor.style.width) - 18 + "px";
//
  }
  catch (ex) {}
}
//
function js_PaginaNavegar(_url,_titulo,_haynoticias)
{
  try
  {
     elobj=parent.document.getElementById("divcontenedor");
     if (elobj != null)
     {     
       divmenuleft=parent.document.getElementById("divmenuleft");
       eldivtitulo=parent.document.getElementById("divtituloprincipal");
       if (eldivtitulo != null) 
       {
         eldivtitulo.style.width=parseInt(elobj.style.width) - 10 + "px";
         eldivtitulo.style.top=parseInt(divmenuleft.style.top) + "px";
         eldivtitulo.style.left=parseInt(elobj.style.left) + 2 + "px";
//
         eldivtitulo.style.visibility="visible";
         elobj.style.top = parseInt(divmenuleft.style.top) + parseInt(eldivtitulo.style.height) + "px";
//  
       }
        
       elframecontenedor=parent.document.getElementById("framecontenedor");
       if (elframecontenedor == null) elframecontenedor=parent.document.getElementById("framecontenedorrecursiva");
//       
       if (_haynoticias) elframecontenedor.style.height=(parseInt(elobj.style.height) * 80) / 100 + "px";
       else elframecontenedor.style.height=(parseInt(elobj.style.height) * 92) / 100 + "px";
  
 //      elobj.style.height=elframecontenedor.style.height;

       elframecontenedor.src=_url;
//
       eltdtitulo=parent.document.getElementById("tdtituloprincipal");
       if (!c_sitemap) {if (eltdtitulo != null) set_innerText(eltdtitulo,_titulo)};
     }
     else
     {
       document.write("<h2 align='center'>Esta opción solo se puede abrir dentro del entorno<br/>WEBGESCON</h2>");
     }
//
  }
  catch (ex) {}
}
//
function js_PaginaDirectorioEspere(_esperar)
{
  try
  {
    elcontenedor=document.getElementById("divcontenedor");
    eldivmenu=document.getElementById("divmenu");
    eldivcargando=document.getElementById("divcargando");

    if (_esperar)
    {
      eldivmenu.style.visibility = "hidden";
      elcontenedor.style.visibility = "hidden";
      eldivcargando.style.visibility = "visible";
    }
    else
    {
      eldivmenu.style.visibility = "visible";
      elcontenedor.style.visibility = "visible";
      eldivcargando.style.visibility = "hidden";
    }
  }
  catch (ex) {}
}
//
function js_PaginaDirectorio()
{
  try
  {
     eldivtitulo=document.getElementById("divtitulo");
     eldivcontenedor=document.getElementById("divcontenedor");
     eldivprevio=document.getElementById("divprevio");
//
     elobj=document.getElementById("framecontenedor");
     if (elobj == null) elobj=parent.document.getElementById("framecontenedor");
//
     eldivprevio.style.width=(parseInt(elobj.style.width) * 30) / 100 + "px" ;
     eldivprevio.style.height=(parseInt(elobj.style.height) * 30) / 100 + "px" ;
     eldivprevio.style.left = parseInt(elobj.style.width) - parseInt(eldivprevio.style.width) - 10 + "px";
     eldivprevio.style.top = parseInt(elobj.style.height) - parseInt(eldivprevio.style.height) - 10 + "px";
//
     if (eldivtitulo == null) 
     {
       eldivcontenedor.style.height = parseInt(elobj.style.height) - 2 + "px";
     }
     else 
     {
       eldivcontenedor.style.height = parseInt(elobj.style.height) - parseInt(eldivtitulo.style.height) - 2 + "px";
     }
//
     eldivmenu=document.getElementById("divmenu");
     eldivmenu.style.height = parseInt(eldivcontenedor.style.height) - 20 + "px";//
//
     _ancho=parseInt(elobj.style.width);
     eldivtitulo.style.width=_ancho + "px";
     eldivmenu.style.width=(_ancho * 35) / 100 + "px";
     eldivcontenedor.style.width=(_ancho * 65) / 100 + "px";
     eldivcontenedor.style.left=parseInt(eldivmenu.style.width) + "px";
    //
     js_PaginaDirectorioEspere(false);
  }
  catch (ex) {js_PaginaDirectorioEspere(false);}
}  
//  
function js_PaginaInforme()
{
  try
  {
     elcontenedor=document.getElementById("divcontenedor");
     eldivtabcontenido=document.getElementById("divtabcontenido");
     if (eldivtabcontenido != null) eldivtabcontenido.style.height = parseInt(elcontenedor.style.height) - 26 + "px";
  }
  catch (ex) {}
}
//  
function js_PaginaRecursiva(_altocabecera,_titulovisible)
{
  try
  {
     js_Inicio(parent.document);
//
     _ancho=_clientWidth; 
     _alto=_clientHeight - _altocabecera; 
//
     elobj=parent.document.getElementById("framecontenedor");
     if (!elobj) 
     {
       elobj=parent.document.getElementById("framecontenedorrecursiva");
     }
     if (!elobj) 
     {
       elobj=document.getElementById("divcontenedor");
       elobj.style.height=_alto + "px";
       elobj.style.width=_ancho + "px";
     }  
//
     _ancho=parseInt(elobj.style.width);
     _alto=parseInt(elobj.style.height);
//
     eldivcontenedor=document.getElementById("divcontenedor");
     eldivtitulo=document.getElementById("divtitulo");
//
     eldivcontenedor.style.width = _ancho + "px";
//
     if (_titulovisible) 
     {
       eldivtitulo.style.visibility="visible";
       eldivcontenedor.style.height = _alto - parseInt(eldivtitulo.style.height) - 4 + "px";
     } 
     else
     {
       eldivtitulo.style.visibility="hidden";
       eldivcontenedor.style.height = _alto - 4 + "px";
       eldivcontenedor.style.top = "0%";
     }
//
     eldivtitulo.style.width = eldivcontenedor.style.width;
//    
     elcontenedor=document.getElementById("framecontenedorrecursiva");
     if (elcontenedor != null) 
     {
       elcontenedor.style.height =  parseInt(eldivcontenedor.style.height) - _altocabecera - 12 + "px"; 
       if (eldivcontenedor.style.overflow == "hidden") 
         elcontenedor.style.width = parseInt(eldivcontenedor.style.width) - 14 + "px";
       else 
         elcontenedor.style.width = parseInt(eldivcontenedor.style.width) - 26 + "px";
     }
  } 
  catch (ex) {}
}
//
function js_PaginaFotos(_iframe,_id,_fotitoalto)
{
  try
  {
    js_Inicio(document);
//
    if (_iframe) _obj=parent.document.getElementById(_id);
    else _obj=document.getElementById(_id);
//
   _obj0=document.getElementById("contenedor");
   _obj0.style.width=parseInt(_obj.style.width) - 18 + "px";
   _obj0.style.height=parseInt(_obj.style.height) - 10 + "px";

   _obj1=document.getElementById("divfoto");
   _obj1.style.width=parseInt(_obj0.style.width) - 10 + "px";
   _obj1.style.top=_fotitoalto + 50 + "px";
   _obj1.style.height=parseInt(_obj0.style.height) - _fotitoalto - 52 + "px";
//
   _obj3=document.getElementById("tablatitulo");
   _obj3.style.width=parseInt(_obj0.style.width) - 2 + "px"; 
//
   document.getElementById("tabfoto").style.width=parseInt(_obj0.style.width) - 20 + "px";
 
   _obj2=document.getElementById("divplay");
   _obj2.style.top=parseInt(_obj1.style.top) + "px";
// Referido al panel de info
// Ajustado a derecha
    _obj2.style.left=parseInt(_obj1.style.width) - parseInt(document.getElementById("divplay").style.width) - 4 + "px";
// Ajustado a centro
//    _obj2.style.top=parseInt(_obj1.style.top) + 5 + "px";
//    _obj2.style.width=((parseInt(_obj1.style.width) * 40) / 100) + "px";
//    _obj2.style.left=((parseInt(_obj1.style.width) - parseInt(document.getElementById("divplay").style.width)) / 2) + "px"; 
// Fin referencia 
  }
  catch (ex) {}
  try
  {
     _objinf=document.getElementById("divinformacion");
     _objinf.style.top=_obj0.style.top;  
     _objinf.style.left=_obj0.style.left;  
     _objinf.style.width=parseInt(_obj0.style.width) - 4 + "px";  
     _objinf.style.height=parseInt(_obj0.style.height) - 6 + "px";  
  
     _objinf2=document.getElementById("divinfocontenido");
     _objinf2.style.height=parseInt(_objinf.style.height) - 50 + "px";  
  
     js_DivInformacion(false);
     
  }
  catch (ex) {js_DivInformacion(false);}
 
  js_imagensel(0,false);
  
}
function js_DivInformacion(_valor)
{
  try
  {
    _objdivfoto=document.getElementById("divfoto");
    _objinf=document.getElementById("divinformacion");
    if (_valor)
    {
        _objdivfoto.style.zIndex="100";  
        _objdivfoto.style.visibility="hidden";  
        _objdivfoto.style.display="none";  
       
        _objdivplay=document.getElementById("divplay");
        _objdivplay.style.visibility="hidden";  
        _objdivplay.style.display="none";  
      
        _objinf.style.zIndex="101";  
        _objinf.style.visibility="visible";  
        _objinf.style.display="block";  
    }
    else
    {
        _objinf.style.zIndex="100";  
        _objinf.style.visibility="hidden";  
        _objinf.style.display="none";  

        _objdivplay=document.getElementById("divplay");
        _objdivplay.style.visibility="visible";  
        _objdivplay.style.display="block";  
 
        _objdivfoto.style.zIndex="101";  
        _objdivfoto.style.visibility="visible";  
        _objdivfoto.style.display="block";  
        
    }
  }
  catch (ex) {}
}
//
function js_Contenedor(elnavega)
{
//
  js_Inicio(document); 
// 
  if (c_navegador!="I") js_PaginaPrincipalContenedorResize();
//
  try
  {
        _lafecha = new Date();
        elobj=document.getElementById("framecontenedor");
        if (elobj == null) elobj=parent.document.getElementById("framecontenedor");
        if (elobj == null) elobj=document.getElementById("framecontenedorrecursiva");
        if (elobj == null) elobj=parent.document.getElementById("framecontenedorrecursiva");
        if (elobj == null) 
        {
//          js_PaginaAbrir(elnavega,"_blank");
          js_PaginaAbrir(elnavega,"_self");
          return;        
        }
        if (elnavega.indexOf("?") >= 0)
        {
           if (elnavega.indexOf("now") < 0) elnavega=elnavega + "&now=" + _lafecha.getTime().toString() ;
        }
        try
        {
          document.getElementById('divcontenedor').style.overflow="hidden";
        }
        catch (ex) {}
//
        elobj.src = elnavega;
//    
  }
  catch (ex) {}
}
//
function js_PaginaAbrir(elenlace,elidentificador,losparametros)
{
  try
  {
    elenlace=elenlace.replace("*!*","'");
    if (!losparametros) v=window.open(elenlace,elidentificador);
    else v=window.open(elenlace,elidentificador,losparametros);
    try  
    {
      v.focus();
    }
    catch (ex) {}
    
    return (v);
  } 
  catch (ex) {}
}
//
function js_PaginaGaleria(_totalfotos,_fotosporfila)
{
  try
  {
   _obj=parent.document.getElementById("framecontenedor");
   if (!_obj) 
   {  
     _obj=document.getElementById("contenedor");
     _obj.style.width=screen.availWidth - 50 + "px";
     _obj.style.height=screen.availHeight - 150 + "px";
   }
   _obj1=document.getElementById("contenedor");
   _obj1.style.width = parseInt(_obj.style.width) - 10 + "px";
   _obj1.style.height = parseInt(_obj.style.height) - 40 + "px";
   _width = (parseInt(_obj.style.width) - 60 ) / _fotosporfila;

 //  _width=parseInt(_width) - 5; 
   for (i=1;i<=_totalfotos;i++) { 
     _dfcab=document.getElementById("divfotocabecera" + i);
     _dfoto=document.getElementById("divfotofoto" + i);
 
     _dfcab.style.width=_width + "px";
     _dfoto.style.width=_width + "px";

     if (i % _fotosporfila != 1) 
     {
       _dfcab1=document.getElementById("divfotocabecera" + (i-1));
       _left=parseInt(_dfcab1.style.left) + parseInt(_dfcab.style.width) + 4 ;     
       _dfcab.style.left=_left + "px" ;     
       _dfoto.style.left=_left + "px";
     }   
     document.getElementById("img" + i).style.width=(_width - 10) + "px";

     _clientHeight = screen.availHeight;             

     _dfoto.style.height=(_clientHeight / _fotosporfila) + "px";
 
     _fila=parseInt(i / _fotosporfila);if (i % _fotosporfila > 0) _fila = _fila + 1;

     _top=(parseInt(_dfoto.style.height) + parseInt(_dfcab.style.height)) * (_fila - 1) ;
  
     _dfcab.style.top=_top + "px";
     _top=parseInt(_dfcab.style.top) + parseInt(_dfcab.style.height);
     _dfoto.style.top=_top + "px";
   }
   document.getElementById("divcargando").style.visibility="hidden";
  }
  catch (ex) {document.getElementById("divcargando").style.visibility="hidden";}
}
// Funciones menu Top
function js_MenuOver(_idmenu)
{
  try {clearInterval(_menu);}
  catch (ex) {}
  
  try
  {
    js_MenuOut();
 //
    _visibilidad="visible";
    try 
    {
      if (document.getElementById("framecontenedor").src.indexOf("//") < 0 && 
          document.getElementById("framecontenedor").src.indexOf("?") < 0 && 
          document.getElementById("framecontenedor").src.indexOf(".") < 0)
      { 
        if (document.getElementById("framecontenedor").src.indexOf("\\") >= 0) _visibilidad="hidden";
        if (document.getElementById("framecontenedor").src.indexOf("/") >= 0) _visibilidad="hidden";
        document.getElementById("framecontenedor").style.visibility=_visibilidad;
      }
      else
      {
        _src=document.getElementById("framecontenedor").src;
        _src=_src.toUpperCase();

// ***************************************************************
// Quitar **JMD**
// Quitar si los menus están definidos en la parte superior
//       if (_src.indexOf(".PDF") >= 0) _visibilidad="hidden";
// ***************************************************************
        document.getElementById("framecontenedor").style.visibility=_visibilidad;
      }
    }
    catch (ex) {}
//  
    _obj=document.getElementById('divmenutop');
    _obj.style.height = screen.availHeight - 220 + "px";
   
    _obj=document.getElementById(_idmenu);
    _obj.style.height = "auto" // screen.availHeight - 230 + "px";
  }
  catch (ex) {}
}

function js_MenuOut()
{
//
  try {document.getElementById("framecontenedor").style.visibility="visible";}
  catch (ex) {}
//  
  try
  {
    _obj=document.getElementById('divmenutop');
    _obj.style.height = c_altodivmenutop + "px";
    for (i=1;i<20;i++) 
    {
      _obj=document.getElementById('menud' + i);
      _obj.style.height = c_altodivmenutop + "px";
    }
  }
  catch (ex) {}
}
//
// Funciones para IE - Mozilla FireFox
//
function get_value(obj)
{
  if (document.all) return obj.value;
  else return obj.textContent; 
} 
function set_value(obj,valor)
{
  if (document.all) obj.value=valor;
  else obj.textContent=valor; 
} 
//
function get_innerText(obj)
{
  if (document.all) return obj.innerText;
  else return obj.textContent; 
} 
function set_innerText(obj,valor)
{
  try
  {
    if (document.all) obj.innerText=valor;
    else obj.textContent=valor; 
  }
  catch (ex) {}

} 
//
//Si el navegador del cliente es Mozilla la variable siguiente valdrá true
var moz = document.getElementById && !document.all;
//Flag que indica si estamos o no en proceso de arrastrar el ratón
var estoyArrastrando = false;
//Variable para almacenar un puntero al objeto que estamos moviendo
var dobj;

function soltarBoton(e) 
{	
    estoyArrastrando = false;
}
//
function arrastrarRaton(e)
{
	try
	{
  	    if (estoyArrastrando) 
	    {
	    	newLeft = moz ? e.clientX : event.clientX;
	    	newTop = moz ? e.clientY : event.clientY;

		    dobj.style.left = newLeft - relativax; // - parseInt(dobj.style.width)/2 ;
	    	dobj.style.top = newTop  - relativay; // - parseInt(dobj.style.height)/2 ;

		    return false;
		}
	}
	catch (ex) {}    
}
//		
function presionarBoton(e) 
{
    try
    {
    	//Obtenemos el elemento sobre el que se ha presionado el botón del ratón
        var fobj = moz ? e.target : event.srcElement;
        // Buscamos el primer elemento en la que esté contenido aquel sobre el que se ha pulsado
	    // que pertenezca a la clase objMovible. 
//	    while (fobj.tagName.toLowerCase() != "html" && fobj.className != "objMovible") 
	    while (fobj.tagName.toLowerCase() != "html" && fobj.className.indexOf("objMovible") == -1) 
    	{
    	    fobj = moz ? fobj.parentNode : fobj.parentElement;
    	}
    	// Si hemos obtenido un objeto movible...	
    	if (fobj.className.indexOf("objMovible") >=0) 
    	{
	        // Activamos el flag para indicar que se empieza a arrastrar
	    	estoyArrastrando = true;
	    	// Guardamos un puntero al objeto que se está moviendo en la variable global
    		dobj = fobj;

    	   	newLeft = moz ? e.clientX : event.clientX;
		    newTop = moz ? e.clientY : event.clientY;

    		relativax = newLeft - parseInt(dobj.style.left);
	    	relativay = newTop - parseInt(dobj.style.top);
		    // Devolvemos false para no realizar ninguna acción posterior
    	    return false;
    	}
    }
    catch (ex) {}
}

// Para mover div de la clase objMovible 
   document.onmousedown = presionarBoton;
   document.onmouseup = soltarBoton;
   document.onmousemove = arrastrarRaton;

