if (document.getElementById){
document.write('<style type="text/css">')
document.write('.switchcontent{display:none;}')
document.write('.switchcontent1{display:none;}')
document.write('<\/style>')
}



function Menu(){
this.enablepersist="on" //cookies? (on/off)
this.collapseprevious="yes" //Colapsar (yes/no)
this.contractsymbol='<img src="/PRESENTnueva/HTML/images/bullet_cerrado.gif" align="right" class="posIMG" alt="">'//HTML for contract symbol. For image, use: <img src="whatever.gif">
this.expandsymbol='<img src="/PRESENTnueva/HTML/images/bullet_abierto.gif" align="right" class="posIMG" alt="">'//HTML for expand symbol.
//Variables 
this.ccollect;
this.statecollect;
//Metodos de la clase menu
this.getElementbyClass = getElementbyClass;
this.sweeptoggle = sweeptoggle;
this.contractcontent = contractcontent;
this.expandcontent = expandcontent;
this.revivecontent = revivecontent;
this.revivestatus = revivestatus;
this.get_cookie = get_cookie;
this.getselectedItem = getselectedItem;
this.saveswitchstate = saveswitchstate;
}

function getElementbyClass(rootobj, classname){
var temparray=new Array()
var inc=0
for (i=0; i<rootobj.length; i++){
if (rootobj[i].className==classname)
temparray[inc++]=rootobj[i]
}
return temparray
}

function sweeptoggle(ec){
var thestate=(ec=="expand")? "block" : "none"
var inc=0
while (this.ccollect[inc]){
this.ccollect[inc].style.display=thestate
inc++
}
this.revivestatus()
}

function contractcontent(omit){
var inc=0
while (this.ccollect[inc]){
if (this.ccollect[inc].id!=omit)
this.ccollect[inc].style.display="none"
inc++
}
}

function expandcontent(curobj, cid){
var spantags=curobj.getElementsByTagName("SPAN")
var showstateobj=this.getElementbyClass(spantags, "showstate")
if (this.ccollect.length>0){
if (this.collapseprevious=="yes")
this.contractcontent(cid)
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
if (showstateobj.length>0){ //if "showstate" span exists in header
if (this.collapseprevious=="no")
showstateobj[0].innerHTML=(document.getElementById(cid).style.display=="block")? this.contractsymbol : this.expandsymbol
else
this.revivestatus()
}
}

//if(this.enablepersist=="on" && document.getElementById){
//this.saveswitchstate();
//}
}

function revivecontent(){
this.contractcontent("omitnothing")
selectedItem=this.getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents[i]).style.display="block"
}

function revivestatus(){
var inc=0
while (this.statecollect[inc]){
if (this.ccollect[inc].style.display=="block")
this.statecollect[inc].innerHTML=this.contractsymbol
else
this.statecollect[inc].innerHTML=this.expandsymbol
inc++
}
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}

function saveswitchstate(){
var inc=0, selectedItem=""
while (this.ccollect[inc]){
if (this.ccollect[inc].style.display=="block")
selectedItem+= this.ccollect[inc].id+"|"
inc++
}

document.cookie=window.location.pathname+"="+selectedItem
}

function do_onload(){
  uniqueidn=window.location.pathname+"firsttimeload"
  var alltags=document.all? document.all : document.getElementsByTagName("*")

  glosario = new Menu();
  glosario.ccollect=getElementbyClass(alltags, "switchcontent1")
  glosario.statecollect=getElementbyClass(alltags, "showstate1")

/****  para el glosario   ***/
  if (glosario.enablepersist=="on" && glosario.ccollect.length>0){
    document.cookie=(glosario.get_cookie(uniqueidn)=="")? uniqueidn+"=1" : uniqueidn+"=0" 
    firsttimeload=(glosario.get_cookie(uniqueidn)==1)? 1 : 0 //check if this is 1st page load
    if (!firsttimeload) glosario.revivecontent()
  }
  if (glosario.ccollect.length>0 && glosario.statecollect.length>0) glosario.revivestatus()

}

if (window.addEventListener) window.addEventListener("load", do_onload, false)
else if (window.attachEvent) window.attachEvent("onload", do_onload)
else if (document.getElementById) window.onload=do_onload

//if (menu_izq.enablepersist=="on" && document.getElementById){
//window.onunload=menu_izq.saveswitchstate
//}

