<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

<!-- Comienzo del código del Menu -->
function boton(tipo,id,nombre,url,seleccionado){
		this.tipo = tipo;
		this.id = id;
		this.nombre = nombre;
		this.url = url;
		this.seleccionado = seleccionado;	
	}
	
	function arbol(nombre, n1_ancho, n1_alto, n1_margen, n2_ancho, n2_alto, n2_margen) {
		this.nombre = nombre;
		
		this.n1_ancho = n1_ancho;
		this.n1_alto = n1_alto;
		this.n1_margen = n1_margen;
		this.n2_ancho = n2_ancho;
		this.n2_alto = n2_alto;
		this.n2_margen = n2_margen;

		this.aBotones = [];
	}
	
	arbol.prototype.agregarBoton = function(id, nombre, url, seleccionado) {	
		this.aBotones[this.aBotones.length] = new boton(1,id, nombre, url, seleccionado);
	};
	arbol.prototype.agregarHijo = function(id, nombre, url, seleccionado) {	
		this.aBotones[this.aBotones.length] = new boton(2,id, nombre, url, seleccionado);
	};

	arbol.prototype.mostrar = function() {	
		var tieneHijos = false;
		var hijoSeleccionado = false;

		for (var i = 0; i < this.aBotones.length; i++) {
			if (this.aBotones[i].tipo == 1) {
				if (tieneHijos) { //si el boton anterior tenia hijos, cierra la tabla
					document.writeln('		</table>');
					document.writeln('	</td><td width= "38"></td>');
					document.writeln('</tr>');
				}			
				if (i < (this.aBotones.length-1)) {if (this.aBotones[i+1].tipo==2) {tieneHijos=true}else{tieneHijos=false}} //verifica si tiene hijos
				if (tieneHijos) {					
					hijoSeleccionado=false; //verifica si tiene hijos seleccionados
					for (var n = i+1; ((n<this.aBotones.length)&&(this.aBotones[n].tipo !=1)); n++) {if (this.aBotones[n].seleccionado==1){hijoSeleccionado=1}}
					//Boton con hijos
					document.writeln('<tr>');
					if ((hijoSeleccionado)||(this.aBotones[i].seleccionado==1)) { //esta seleccionado, o tiene un hijo seleccionado
						document.writeln('	<td><table id="' + this.aBotones[i].id + '" class="n1_menuFondoSeleccionado" border="0" cellpadding="0" cellspacing="0"><tr><td width="' + this.n1_margen +'">&nbsp;</td><td width="' + (this.n1_ancho - this.n1_margen) + '" height="' + this.n1_alto + '">');
						document.writeln('			<a class="n1_menuTxtSeleccionado" href="' + this.aBotones[i].url + '" onMouseDown="if (document.getElementById(\'' + this.aBotones[i].id + '_Subitems\').style.display==\'none\'){document.getElementById(\'' + this.aBotones[i].id + '_Subitems\').style.display=\'inline\'}else{document.getElementById(\'' + this.aBotones[i].id + '_Subitems\').style.display=\'none\'}">' + this.aBotones[i].nombre + '</a>');
						document.writeln('	</td><td width "38"></td></tr></table></td>');
						document.writeln('</tr>');
						document.writeln('<tr>');
						document.writeln('	<td>');
						document.writeln('		<table align="left" border="0" cellpadding="0" cellspacing="0" id="' + this.aBotones[i].id + '_Subitems" style="display:inline">');
					} else {
						//no esta seleccionado
						document.writeln('	<td><table id="' + this.aBotones[i].id + '" class="n1_menuFondoOff" border="0" cellpadding="0" cellspacing="0"><tr><td width="' + this.n1_margen +'">&nbsp;</td><td width="' + (this.n1_ancho - this.n1_margen) + '" height="' + this.n1_alto + '">');
						document.writeln('			<a class="n1_menuTxt" href="' + this.aBotones[i].url + '" onMouseDown="if (document.getElementById(\'' + this.aBotones[i].id + '_Subitems\').style.display==\'none\'){document.getElementById(\'' + this.aBotones[i].id + '_Subitems\').style.display=\'inline\';document.getElementById(\'' + this.aBotones[i].id + '_Subitems\').className=\'n1_menuFondoSeleccionado\';this.className=\'n1_menuTxtSeleccionado\'}else{document.getElementById(\'' + this.aBotones[i].id + '_Subitems\').style.display=\'none\';document.getElementById(\'' + this.aBotones[i].id + '_Subitems\').className=\'n1_menuFondoOff\';this.className=\'n1_menuTxt\'}" onmouseover="if (document.getElementById(\'' + this.aBotones[i].id + '_Subitems\').style.display!=\'inline\') {document.getElementById(\'' + this.aBotones[i].id + '\').className=\'n1_menuFondoOver\'};" onmouseout="if (document.getElementById(\'' + this.aBotones[i].id + '_Subitems\').style.display!=\'inline\') {document.getElementById(\'' + this.aBotones[i].id + '\').className=\'n1_menuFondoOff\'};">' + this.aBotones[i].nombre + '</a>');
						document.writeln('	</td><td width= "38"></td></tr></table></td>');
						document.writeln('</tr>');
						document.writeln('<tr>');
						document.writeln('	<td>');
						document.writeln('		<table align="left" border="0" cellpadding="0" cellspacing="0" id="' + this.aBotones[i].id + '_Subitems" style="display:none">');
					}
				} else {
					//Boton sin hijos
					document.writeln('<tr>');
					if (this.aBotones[i].seleccionado==1) {
						document.writeln('<td><table id="' + this.aBotones[i].id + '" class="n1_menuFondoSeleccionado" border="0" cellpadding="0" cellspacing="0"><tr><td width="'+ this.n1_margen + '">&nbsp;</td><td width="' + (this.n1_ancho - this.n1_margen) + '" height="' + this.n1_alto + '">');
						document.writeln('	<a class="n1_menuTxtSeleccionado" href="' + this.aBotones[i].url + '">' + this.aBotones[i].nombre + '</a>');
					} else {
						document.writeln('<td><table id="' + this.aBotones[i].id + '" class="n1_menuFondoOff" border="0" cellpadding="0" cellspacing="0"><tr><td width="'+ this.n1_margen + '">&nbsp;</td><td width="' + (this.n1_ancho - this.n1_margen) + '" height="' + this.n1_alto + '">');
						document.writeln('	<a class="n1_menuTxt" href="' + this.aBotones[i].url + '" onmouseover="document.getElementById(\'' + this.aBotones[i].id + '\').className=\'n1_menuFondoOver\';" onmouseout="document.getElementById(\'' + this.aBotones[i].id + '\').className=\'n1_menuFondoOff\';">' + this.aBotones[i].nombre + '</a>');
					}
					document.writeln('</td><td width= "38"></td></tr></table></td>');
					document.writeln('</tr>');					
				}
			} else {
				//Hijo
				document.writeln('<tr><td>&nbsp;</td>');
				if (this.aBotones[i].seleccionado==1) {
					document.writeln('<td><table id="' + this.aBotones[i].id + '" class="n2_menuFondoSeleccionado" border="0" cellpadding="0" cellspacing="0"><tr><td width="' + this.n2_margen + '">&nbsp;</td><td width="' + (this.n2_ancho - this.n2_margen) + '" height="' + this.n2_alto + '">');
					document.writeln('	<a class="n2_menuTxtSeleccionado" href="' + this.aBotones[i].url + '">' + this.aBotones[i].nombre + '</a>');
				} else {
					document.writeln('<td><table id="' + this.aBotones[i].id + '" class="n2_menuFondoOff" border="0" cellpadding="0" cellspacing="0"><tr><td width="' + this.n2_margen + '">&nbsp;</td><td width="' + (this.n2_ancho - this.n2_margen) + '" height="' + this.n2_alto + '">');
					document.writeln('	<a class="n2_menuTxt" href="' + this.aBotones[i].url + '" onmouseover="document.getElementById(\'' + this.aBotones[i].id + '\').className=\'n2_menuFondoOver\';" onmouseout="document.getElementById(\'' + this.aBotones[i].id + '\').className=\'n2_menuFondoOff\';">' + this.aBotones[i].nombre + '</a>');
				}
				document.writeln('</td><td width= "38"></td></tr></table></td>');
				document.writeln('</tr>');
			}
		}
		if (tieneHijos) {
			document.writeln('		</table>');
			document.writeln('	</td>');
			document.writeln('</tr>');
		}
	}
<!-- Fin del código del Menu -->
