///Autor: ASR
var sSpacerImg="/images/sp.gif";
var sOldClass;
var pulsado=false;
function menu_hover(poElement,psClass){	
	if (!document.layers){
		if (!psClass) psClass=sOldClass;
		sOldClass=poElement.className;
		poElement.className=psClass;
	}
}
function js_menu(pb_is_home){
	this.arr_nodes = new Array();
	this.add_node = add_node;
	this.render_menu_left=render_menu_left;
	this.b_is_home=pb_is_home;
}
function node(ps_name,ps_description, ps_url, pb_selected, pn_level, pn_childs, pn_especial){
	this.n_level = pn_level;
	this.b_selected = pb_selected;
	this.s_name = ps_name;
	this.s_description=ps_description||ps_name;
	this.s_url = ps_url;
	this.n_childs = pn_childs;
	this.n_especial = pn_especial;
}

function add_node(ps_name, ps_description, ps_url, pb_selected, pn_level, pn_childs, pn_especial){
	this.arr_nodes[this.arr_nodes.length] = new node(ps_name, ps_description, ps_url, pb_selected, pn_level, pn_childs,pn_especial);
}
function irA(poElement,ruta)
{
	if (!pulsado)
	{
		pulsado=true;
		poElement.style.cursor='wait';
		location.href=ruta;
	}
	
}


function render_menu_left(pn_width,pnHeight)
{
	menuTXT = '<table border="0" cellspacing="1" cellpadding="0" width="' + pn_width + '">';
	for(var i=0; i<this.arr_nodes.length; i++)
	{
		with (this.arr_nodes[i])
		{
			var nivel=n_level+1;
			if(nivel>1)
			{
				s_class="bgML"+nivel+((b_selected)?"Sel":"");
				switch (n_especial)
				{
					case 0:
						menuTXT+='<tr><td height="'+pnHeight+'" class="'+s_class+'" onclick="irA(this,\''+s_url+'\')" STYLE="cursor: pointer;cursor:hand;" onmouseover="menu_hover(this,\''+"bgML"+nivel+"Sel"+'\')" onmouseout="menu_hover(this)"><img src="' + sSpacerImg + '" width="'+(1+(nivel-2)*6)+'" height="5"><img src="/images/bullets/m_bullet.gif" width="16" height="5">&nbsp;<span class="txtML'+nivel+'">'+s_name+'</span></td></tr>';
						break;
					case 1:
						menuTXT+='<tr><td height="'+pnHeight+'" class="'+s_class+'" title="Sigue conectado al Acceso Privado" STYLE="cursor:default" onselectstart="return false;"><img src="' + sSpacerImg + '" width="'+(1+(nivel-2)*6)+'" height="5"><img src="/images/bullets/m_bullet.gif" width="16" height="5">&nbsp;<span class="txtML'+nivel+'">'+s_name+'</span></td></tr>';
						break;
					case 2:
						menuTXT+='<tr><td height="'+pnHeight+'" class="'+s_class+'" title="Conectarse al Acceso Privado" onclick="irA(this,\''+s_url+'\')" STYLE="cursor: pointer;cursor:hand;" onmouseover="menu_hover(this,\''+"bgML"+nivel+"Sel"+'\')" onmouseout="menu_hover(this)"><img src="' + sSpacerImg + '" width="'+(1+(nivel-2)*6)+'" height="5"><img src="/images/bullets/m_bullet.gif" width="16" height="5">&nbsp;<span class="txtML'+nivel+'">'+s_name+'</span></td></tr>';
						break;
					case 3:
						menuTXT+='<tr><td height="'+pnHeight+'" class="'+s_class+'" title="Sigue conectado al Acceso Privado" STYLE="cursor:default" onselectstart="return false;"><img src="' + sSpacerImg + '" width="'+(1+(nivel-2)*6)+'" height="5"><img src="/images/bullets/m_bullet.gif" width="16" height="5">&nbsp;<span class="txtML'+nivel+'">'+s_name+'</span></td></tr>';
						break;
					case 4:
						menuTXT+='<tr><td height="'+pnHeight+'" class="'+s_class+'" title="Conectarse al Acceso Privado" onclick="irA(this,\''+s_url+'\')" STYLE="cursor: pointer;cursor:hand;" onmouseover="menu_hover(this,\''+"bgML"+nivel+"Sel"+'\')" onmouseout="menu_hover(this)"><img src="' + sSpacerImg + '" width="'+(1+(nivel-2)*6)+'" height="5"><img src="/images/bullets/m_bullet.gif" width="16" height="5">&nbsp;<span class="txtML'+nivel+'">'+s_name+'</span></td></tr>';
						break;
				}
			}
			if(n_level==-1)
			{
				s_class="cajonGris";
				menuTXT+='<tr><td id="'+s_name+'" height="'+(pnHeight-5)+'" class="'+s_class+'" STYLE="cursor:default"><img src="' + sSpacerImg + '" width="1" height="5">&nbsp;'+s_name+'</td></tr>';
			}

		}	
	}
	menuTXT+='</table>';
	document.write(menuTXT);
}
