﻿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
//
try
{
  _nav=navigator.userAgent.toUpperCase();
  var _navegador="I";
  if (_nav.indexOf("SAFARI")>=0)  _navegador="S";
  if (_nav.indexOf("OPERA")>=0)   _navegador="O";
  if (_nav.indexOf("FIREFOX")>=0) _navegador="F";
}
catch (ex) {}
// Para evitar el boton derecho  
try
{
  document.oncontextmenu=new Function("return false");
} 
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,true);
  } 
  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  
    elcontenedor=parent.document.getElementById("framecontenedor");
    if (elcontenedor == null) elcontenedor=parent.document.getElementById("framecontenedorrecursiva");

    elobj=document.getElementById("TxSUNivel2");
    elobj.style.height=((parseInt(elcontenedor.style.height) * 6) / 100 ) + "px";
    elobj=document.getElementById("TxSUNivel3");
    elobj.style.height=((parseInt(elcontenedor.style.height) * 18) / 100 ) + "px";
//
    js_PaginaComunBotones(elcontenedor);
  } 
  catch (ex) {}
}
//
function js_PaginaAdm04() // Pagina Galerias
{
  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("TxTXTexto");
    elobj.style.height=((parseInt(elcontenedor.style.height) * 45) / 100 ) + "px";
//
    js_PaginaComunBotones(elcontenedor);
  } 
  catch (ex) {}
}
//
function js_PaginaAdm07() // Pagina Noticias
{
  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("TxTexto");
    elobj.style.height=((parseInt(elcontenedor.style.height) * 25) / 100 ) + "px";
    try {document.getElementById("TxNombre").focus();} catch (ex) {}
 //
    js_PaginaComunBotones(elcontenedor);
  } 
  catch (ex) {}
}
//
function js_PaginaAdm08() // Paginas Dinamicas
{
  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("TxTexto");
    elobj.style.height=((parseInt(elcontenedor.style.height) * 60) / 100 ) + "px";
    try {document.getElementById("TxNombre").focus();} catch (ex) {}
//
    js_PaginaComunBotones(elcontenedor);
  } 
  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
     {
        if (document.all)
        {
          _clientWidth = parseInt(document.body.clientWidth);             
          _clientHeight = parseInt(document.body.clientHeight);             
        } 
        else
        {
          _clientWidth = screen.availWidth - 10;   
          if (_navegador == "F") _clientWidth+=110;
          _clientHeight = screen.availHeight - 70;             
        }
        elancho = parseInt((_clientWidth * elanchomenuLEFT) / 100);
        eldivtop=document.getElementById("divtop");
        eldivmenuleft=document.getElementById("divmenuleft");
        eldivmenuright=document.getElementById("divmenuright");
  
        eldivtop.style.width=_clientWidth + "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_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 (elobj == null)
     {
       if (document.all)
       {
         _clientWidth = parseInt(document.body.clientWidth);             
         _clientHeight = parseInt(document.body.clientHeight);             
       }  
       else
       {
         _clientWidth = parseInt(elobj.style.width);
         _clientHeight = parseInt(elobj.style.height);
       }
     }
     else
     {
       _clientWidth = parseInt(elobj.style.width) - 10;             
       _clientHeight = parseInt(elobj.style.height);             
     }
//
     if (eldivtitulo == null) 
     {
       elcontenedor.style.height = _clientHeight - 2 + "px";
     }
     else 
     {
       eldivtitulo.style.width = _clientWidth - 6 + "px";
       elcontenedor.style.height = _clientHeight - parseInt(eldivtitulo.style.height) - 2 + "px";
     }
     elcontenedor.style.width = _clientWidth - 6 + "px";
//
  }
  catch (ex) {}
}
//
function js_PaginaComunBotones(_elcontedor)
{
  try
  {
    eldivbotones=document.getElementById("divbotones");
    eldivbotones.style.width=parseInt(_elcontedor.style.width) - 40 + "px";
  }
  catch (ex) {}
}
//
function js_PaginaDocumentacion()
{
  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)
     {
       if (document.all)
       {
         _clientWidth = parseInt(document.body.clientWidth);             
         _clientHeight = parseInt(document.body.clientHeight);             
       }  
       else
       {
        _clientWidth = screen.availWidth - 10;             
        _clientHeight = screen.availHeight - 120; 
       }
     }
     else
     {
       _clientWidth = parseInt(elobj.style.width);             
       _clientHeight = parseInt(elobj.style.height);             
     }
//
     elcontenedor.style.height = _clientHeight - parseInt(eldivtitulo.style.height) - parseInt(eldivbotones.style.height) - 10 + "px";
   
     eldivtitulo.style.width = _clientWidth  - 20 + "px";
     eldivbotones.style.width = _clientWidth  - 20 + "px";
     elcontenedor.style.width = _clientWidth  - 20 + "px";
     
     eldivprevio=document.getElementById("divprevio");
     eldivprevio.style.width=(parseInt(elcontenedor.style.width) * 30) / 100 + "px" ;
     eldivprevio.style.height=(parseInt(elcontenedor.style.height) * 30) / 100 + "px" ;
     eldivprevio.style.left = parseInt(elcontenedor.style.width) - parseInt(eldivprevio.style.width) + "px";
     eldivprevio.style.top = parseInt(elcontenedor.style.top); // + parseInt(elcontenedor.style.height) - parseInt(eldivprevio.style.height) + "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)
     {
       if (document.all)
       {
         _clientWidth = parseInt(document.body.clientWidth);             
         _clientHeight = parseInt(document.body.clientHeight);             
       }  
       else
       {
        _clientWidth = screen.availWidth - 10;             
        _clientHeight = screen.availHeight - 120; 
       }
     }
     else
     {
       _clientWidth = parseInt(elobj.style.width);             
       _clientHeight = parseInt(elobj.style.height);             
     }
//
     elcontenedor.style.height = _clientHeight - parseInt(eldivtitulo.style.height) - parseInt(eldivbotones.style.height) - 10 + "px";
   
     eldivtitulo.style.width = _clientWidth  - 20 + "px";
     eldivbotones.style.width = _clientWidth  - 20 + "px";
     elcontenedor.style.width = _clientWidth  - 20 + "px";
    //
  }
  catch (ex) {}
}
//
function js_PaginaNavegar(_url,_titulo,_haynoticias)
{
  try
  {
     if (document.all)
     {
       _clientWidth = parseInt(document.body.clientWidth);  
     } 
     else
     {
       _clientWidth = screen.availWidth - 10;             
     }
//
     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";

       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");
     elcontenedor=document.getElementById("divcontenedor");
     elobj=document.getElementById("framecontenedor");
     if (elobj == null) elobj=parent.document.getElementById("framecontenedor");
 
     if (elobj == null)
     {
       if (document.all)
       {
         _clientWidth = parseInt(document.body.clientWidth);  
         _clientHeight = parseInt(document.body.clientHeight);             
       }  
       else
       {
         _clientWidth = parseInt(elobj.style.width) - 10;              
         _clientHeight = parsetInt(elobj.style.height) - 10; 
       }
     }
     else
     {
       _clientWidth = parseInt(elobj.style.width) - 10;  
       _clientHeight = parseInt(elobj.style.height) - 10;             
     }
//
     if (eldivtitulo == null) 
     {
       elcontenedor.style.height = _clientHeight - 2 + "px";
     }
     else 
     {
       elcontenedor.style.height = _clientHeight - parseInt(eldivtitulo.style.height) - 2 + "px";
     }
//
     eldivmenu=document.getElementById("divmenu");
     eldivmenu.style.height = parseInt(elcontenedor.style.height) - 20 + "px";

//    eldivprevio=document.getElementById("divprevio");
//     eldivprevio.style.height="120px";
//     eldivprevio.style.top = parseInt(elcontenedor.style.top) + parseInt(elcontenedor.style.height) - parseInt(eldivprevio.style.height) + "px";

     eldivprevio=document.getElementById("divprevio");
     eldivprevio.style.width=(parseInt(_clientWidth) * 30) / 100 + "px" ;
     eldivprevio.style.height=(parseInt(elcontenedor.style.height) * 30) / 100 + "px" ;
     eldivprevio.style.left = parseInt(_clientWidth) - parseInt(eldivprevio.style.width) + "px";
     eldivprevio.style.top = parseInt(elcontenedor.style.top) + parseInt(elcontenedor.style.height) - parseInt(eldivprevio.style.height) + "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
  {
     if (document.all) 
     { 
       _ancho=parseInt(document.body.clientWidth);
       _alto=parseInt(document.body.clientHeight);
     }
     else 
     {
       _ancho=screen.availWidth - 20;
       _alto=screen.availHeight - _altocabecera - 100;
     } 
//
     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) - 20;
     _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 + "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
  {
 // alert(parent.document.getElementById(_id).style.width);
    if (_iframe) _obj=parent.document.getElementById(_id);
    else _obj=document.getElementById(_id);
// Nuevo
   if (!_obj)
   {
     if (document.all)
     {
      _clientWidth = parseInt(document.body.clientWidth);             
      _clientHeight = parseInt(document.body.clientHeight);             
     } 
     else
     {
       _clientWidth = screen.availWidth - 10;             
       _clientHeight = screen.availHeight - 120; 
     }
   }
   else
   {
      _clientWidth = parseInt(_obj.style.width);             
      _clientHeight = parseInt(_obj.style.height);             
   }
   
   _obj0=document.getElementById("contenedor");
   _obj0.style.width=parseInt(_clientWidth) - 15 + "px";
   _obj0.style.height=parseInt(_clientHeight) - 10 + "px";

   _obj1=document.getElementById("divfoto");
   _obj1.style.width=parseInt(_obj0.style.width) - 10 + "px";
  
 //  _obj1.style.height=parseInt(_obj0.style.height) - 120 + "px";

   _obj1.style.top=_fotitoalto + 50 + "px";
   _obj1.style.height=parseInt(_obj0.style.height) - _fotitoalto - 50 + "px";

 
   document.getElementById("tabfoto").style.width="100%" //parseInt(_obj1.style.width) - 20 + "px";
 
   _obj2=document.getElementById("divplay");
   _obj2.style.top=parseInt(_obj1.style.top) + 5 + "px";
// Referido al panel de info
// Ajustado a derecha
    _obj2.style.left=parseInt(_obj1.style.width) - parseInt(document.getElementById("divplay").style.width) - 5 + "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=_obj0.style.width;  
     _objinf.style.height=_obj0.style.height;  
  
     _objinf2=document.getElementById("divinfocontenido");
     _objinf2.style.height=parseInt(_objinf.style.height) - 50 + "px";  
  
     js_DivInformacion(false);
     
  }
  catch (ex) {}
 
  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,_resize)
{
  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;
//    
        if (_resize) js_PaginaPrincipalContenedorResize();
//
  }
  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_PaginaPrincipalContenedorResize()
{
  try
  {
        document.getElementById("divtituloprincipal").style.visibility="hidden";
//
        eldivcontenedor=document.getElementById("divcontenedor");
        eldivcontenedor.style.visibility="hidden";
//
        if (document.all)
        {
          _clientWidth = parseInt(document.body.clientWidth);             
          _clientHeight = parseInt(document.body.clientHeight);             
        } 
        else
        {
          _clientWidth = screen.availWidth;
          if (_navegador == "F") _clientWidth+=100;
          _clientHeight = screen.availHeight - 110; 
          _visible = false;            
        }
 //
        eldivtop=document.getElementById("divtop");
        eldivmenuleft=document.getElementById("divmenuleft");
        eldivmenuright=document.getElementById("divmenuright");
        eldivmenutop=document.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 (document.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 (document.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 (document.getElementById("menuposicion").value.indexOf("T") >= 0)
        { 
          eldivcontenedor.style.left = "2px";
          eldivcontenedor.style.width = _clientWidth - 2 + "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 = "2px";
          _ancho = _clientWidth;
          
          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 = "2px";
          eldivcontenedor.style.width = _clientWidth - 2 + "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=document.getElementById("framecontenedor");
        elobj.style.width=(parseInt(eldivcontenedor.style.width) - 15) + "px";
        elobj.style.height=(parseInt(eldivcontenedor.style.height) - 6) + "px";
//        
        _obj=document.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=document.getElementById("divmenusuperior");
        eldivmenusuperior.style.left="0%" // _clientWidth - parseInt(eldivmenusuperior.style.width) + "px";
        eldivmenusuperior.style.width="100%" // parseInt(eldivcontenedor.style.width) + "px";
        eldivmenusuperior.style.height="auto";
        eldivmenusuperior.style.top="0px";
// MENU PIE DE PAGINA
        eldivmenupie=document.getElementById("divmenupie");
        eldivmenupie.style.left="0%"  // parseInt(eldivcontenedor.style.left) + "px";
        eldivmenupie.style.width="100%" // parseInt(eldivcontenedor.style.width) + "px";
        eldivmenupie.style.height="18px";
        eldivmenupie.style.top=parseInt(eldivcontenedor.style.top) + parseInt(eldivcontenedor.style.height) + 2 + "px";
//
        eldivcontenedor.style.visibility="visible";
//
  } 
  catch (ex) {eldivcontenedor.style.visibility="visible";}
}
//
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;
