var lnav_html;

var lnav_stress;

function lnav_menu(id, title, url) {
  this.id = id;
  this.title = title;
  this.items = new Array();
  this.url = url || '';
  this.expanded = (this.id == lnav_default_expand);
  this.writeMenu = lnav_writeMenu;
  if (isIE4)
    this.update = lnav_update_IE
  else
    this.update = lnav_update_NS;
}

function lnav_item(title, url) {
  this.title = title;
  this.url = url;
}

function lnav_init(target) {

  if ((target=='IE' && isIE4) || (target=='NS' && isNav4)) {

  lnav_stress = new lnav_menu('STRESS','<IMG SRC="/images/tyc_interesa.gif" border="0" alt="Le interesa saber más acerca del Stress?">');
  lnav_stress.items[0] = new lnav_item('&iquest;Qu&eacute; es el estr&eacute;s?','nota_qstress.asp');
  lnav_stress.items[1] = new lnav_item('Estudiantes<br>C&oacute;mo manejar el estr&eacute;s de los ex&aacute;menes','nota_estudiantes.asp');


  lnav_render();

  }  // end target check
}

function lnav_render() {
  lnav_html = '';
  
  lnav_stress.writeMenu();

  if (isIE4)
    document.all.lnavLayer.innerHTML = lnav_html;
  else {
    document.lnavLayer.document.clear();
    document.lnavLayer.document.open();
    document.lnavLayer.document.write(lnav_html);
    document.lnavLayer.document.close();
  }

}

function lnav_update_IE() {
  var layer = getObj('lnav'+this.id);
  this.expanded = !(this.expanded);
  document.images['lnav_icon_'+this.id].src = ((this.expanded) ? 'images/transparent.gif' : 'images/transparent.gif');
  if (layer.display == 'none')
    layer.display = ''
  else
    layer.display = 'none';
}

function lnav_update_NS() {

  this.expanded = !(this.expanded);
  lnav_render();
}

function lnav_writeMenu() {
  var display;
  var sq = "'";
  var icon;
  var url;

  if (this.items.length == 0) {
    icon = 'none_icon.gif'
    url = this.url;
  } else {
    icon = ((this.expanded) ? 'images/transparent.gif' : 'images/transparent.gif');
    url = 'javascript:lnav_'+this.id.toLowerCase()+'.update()';
  }

  if (this.expanded || isNav4)
    display = ''
  else
    display = 'none';

  lnav_html += '<TABLE CELLPADDING="0" CELLSPACING="0" WIDTH="300" BORDER="0">';
  lnav_html += '<TR><TD VALIGN="TOP" WIDTH="10"><A HREF="'+url+'" onMouseOver="window.status='+sq+sq+'; return true"><IMG NAME="lnav_icon_'+this.id+'" SRC="'+icon+'" WIDTH="9" HEIGHT="9" VSPACE="4" BORDER="0"></A></TD>';
  lnav_html += '<TD VALIGN="TOP" ALIGN="LEFT" WIDTH="145"><A HREF="'+url+'" onMouseOver="window.status='+sq+sq+'; return true" CLASS="tests">'+this.title+'</B></A></TD></TR>';
  lnav_html += '</TABLE>';

  if (this.items.length != 0 && (isIE4 || this.expanded)) {
    lnav_html += '<DIV ID="lnav'+this.id+'" STYLE="display:'+display+'">';
    lnav_html += '<TABLE CELLPADDING="2" CELLSPACING="0" WIDTH="300" BORDER="0">';

    for(var i = 0; i < this.items.length; i++) {
      lnav_html += '<TR VALIGN="TOP"><TD WIDTH="30" ALIGN="RIGHT"><img src="images/h_globito.gif" width="21" height="16" vspace="2"></TD>';
      lnav_html += '<TD WIDTH="270"><font size="-1"><b><A HREF="'+this.items[i].url+'" CLASS="stress" onMouseOver="window.status='+sq+sq+'; return true">'+this.items[i].title+'</A></font></b></TD></TR>';
    } //
    lnav_html += '</TABLE></DIV>';
  }

    lnav_html += '<TABLE CELLPADDING="2" CELLSPACING="0" WIDTH="155" BORDER="0">';
    lnav_html += '<TR><TD><IMG SRC="dot_rule.gif" WIDTH="155" HEIGHT="1"></TD></TR>';
    lnav_html += '</TABLE>';


}


