
document.contents = new Array ();

document.queue   = new Array ();
document.qpos    = 0;
document.offsetX = 0;
document.offsetY = 0;




function switchContent (id)
  {
  if ((typeof (document.contents [id]) == 'undefined') || (document.contents [id] == false))
    {
    var contentElement = document.getElementById (id);
    if (id.indexOf ('info') != -1)
      {
      var iconId = id.toString ().replace ('info', 'icon');
      var iconElement = document.getElementById (iconId);
      if ((iconElement != null) && (typeof iconElement != 'undefined'))
        iconElement.src = iconElement.src.replace ('expand', 'collapse');
      }  // if
    contentElement.innerHTML = '<small><b>Cargando, espere por favor</b>&nbsp;</small><img src="/img/loading.gif" alt="..." />';

    return true;
    }  // if
  else
    {
    unloadContent (id);
    if (id.indexOf ('info') != -1)
      {
      var iconId = id.toString ().replace ('info', 'icon');
      var iconElement = document.getElementById (iconId);
      if ((iconElement != null) && (typeof iconElement != 'undefined'))
        iconElement.src = iconElement.src.replace ('collapse', 'expand');
      }  // if


    return false;
    }  // else
  return true;
  }






function callbackContent ()
  {
  if (((navigator.family == 'ie4') && (navigator.version < 5.5)) || (navigator.family == 'opera'))
    {
    if (typeof window.parent.loadContent != 'undefined')
      window.parent.loadContent ();
    }  // if

//  alert ('callbackContent: ' + window.name + ' ' + document.title + ' ' + document.queue.length + ' ' + document.qpos);
  if (document.qpos < document.queue.length)
    dequeueContent ();

  return;
  }


function loadContent ()
  {
  //alert ('loadContent: ' + window.name + ' ' + document.title + ' ' + document.queue.length + ' ' + document.qpos);
  var proxy = window.frames ['proxy'];
  if ((typeof proxy == 'undefined') || (typeof proxy.getProxyElementId == 'undefined'))
    return;

  var id = proxy.getProxyElementId ();

  if ((typeof id == 'undefined') || (id == ''))
    return;

  var element = proxy.document.getElementById ('contentId');
  if (typeof element == 'undefined')
    return;

  if ((dotIndex = id.indexOf ('.')) != -1)
    {
    frame = id.substr (0, dotIndex);
    id    = id.substr (dotIndex + 1);

    targetElement = top.frames [frame].document.getElementById (id);
    if ((typeof targetElement == 'undefined') || (targetElement == null))
      return;

    targetElement.innerHTML = element.innerHTML;
    top.frames [frame].document.contents [id] = true;
    return;
    }  // if

  document.getElementById (id).innerHTML = element.innerHTML;

  document.contents [id] = true;
  document.lastElementId = id;

  var anchorName = id.toString ().replace ('Id', 'Name');

  var anchorElement;
  if (navigator.family == 'ie4')
    anchorElement = document.anchors (anchorName);
  else
    anchorElement = document.anchors [anchorName];

  if ((document.queue.length > 0) && (document.qpos == 0))
    document.offsetX = document.offsetY = 0;

  document.offsetX += document.getElementById (id).offsetLeft;
  document.offsetY += document.getElementById (id).offsetTop;
  if ((typeof anchorElement != 'undefined') && (document.qpos < document.queue.length))
    window.scrollTo (document.offsetX, document.offsetY);

  if (document.qpos < document.queue.length)
    dequeueContent ();
  return;
  }  // function






function reloadContent (w, id)
  {
  //alert ('reloadContent: ' + window.name + ' ' + document.title + ' ' + document.queue.length + ' ' + document.qpos);
  if ((typeof id == 'undefined') || (id == ''))
    return;

  var proxy = w.frames ['proxy'];
  if (typeof proxy == 'undefined')
    return;

  var anchorName = id.toString ().replace ('Id', 'Name');
  var anchorElement;
  if (navigator.family == 'ie4')
    anchorElement = w.document.anchors (anchorName);
  else
    anchorElement = w.document.anchors [anchorName];

  if ((typeof anchorElement == 'undefined') || (anchorElement == null))
    return;

  proxy.location.href = anchorElement.href;
  return;
  }  // function





function unloadContent (id)
  {
//  alert ('unloadContent: ' + window.name + ' ' + document.title + ' ' + document.queue.length + ' ' + document.qpos);
  var element = document.getElementById (id);
  document.contents [id] = false;
  element.innerHTML = '';

  return;
  }  // function






function enqueueContent (id)
  {
  //alert ('enqueueContent: ' + window.name + ' ' + document.title + ' ' + document.queue.length + ' ' + document.qpos);
  document.queue [document.queue.length] = id;

  return;
  }  // function



function dequeueContent ()
  {
  var id = document.queue [document.qpos++];
  //alert ('dequeueContent: ' + window.name + ' ' + document.title + ' ' + document.queue.length + ' ' + document.qpos);

  var proxy = window.frames ['proxy'];
  if (typeof proxy == 'undefined')
    return;

  if (id.indexOf ('info') != -1)
    {
    var anchorName = id.toString ().replace ('Id', 'Name');
    var anchorElement = null;
    if (navigator.family == 'ie4')
      anchorElement = document.anchors (anchorName);
    else
      anchorElement = document.anchors [anchorName];

    if ((anchorElement != null) && (typeof anchorElement != 'undefined'))
      {
      if (switchContent (id))
        {
        proxy.location.href = anchorElement.href;
        }  // if
      }  // if
    }  // if

  return;
  }  // function








function showLayer (layerId, doc)
  {
//  alert ('showLayer (' + layerId + ', ' + doc + ')');

  if (typeof doc == 'undefined')
    doc = document;

  var layer = doc.getElementById (layerId);

  if ((layer == null) || (typeof layer == 'undefined'))
    return;

  if (navigator.family == 'ie4')
    layer.style.display    = 'block';
  layer.style.visibility = 'visible';

  return;
  }  // function




function hideLayer (layerId, doc)
  {
//  alert ('hideLayer (' + layerId + ', ' + doc + ')');

  if (typeof doc == 'undefined')
    doc = document;

  var layer = doc.getElementById (layerId);

  if ((layer == null) || (typeof layer == 'undefined'))
    return;

  if (navigator.family == 'ie4')
    layer.style.display    = 'none';

  layer.style.visibility = 'hidden';


  return;
  }  // function

