

var HFULL 	= 150
var HMEDIUM 	= 90;





function MenuManager() {


	// variables
	this.hilited 	= 'branch0';
	this.selected_0 = "";
	this.selected_1 = "";
	this.selected_2 = "";
	this.itemselected_2 = "";
	this.homepath	= top.location.href.substr(0, top.location.href.lastIndexOf('/')+1 );

	this.helptarget = 'contenido';

	this.menus = __GetMenus();

	this.vartemp;



	// funciones
	this.HiliteItem 		=   __HiliteItem;
	this.UnhiliteItem 		=   __UnhiliteItem;
	this.HiliteItem_1 		=   __HiliteItem_1;
	this.UnhiliteItem_1		=   __UnhiliteItem_1;
	this.HiliteItem_2 		=   __HiliteItem_2;
	this.UnhiliteItem_2		=   __UnhiliteItem_2;
	this.SelectItem_0 		=   __SelectItem_0;
	this.SelectItem_1 		=   __SelectItem_1;
	this.SelectItem_2 		=   __SelectItem_2;
	this.ShowMenu_1			=   __ShowMenu_1;
	this.HideMenu_1			=   __HideMenu_1;
	this.ShowMenu_2			=   __ShowMenu_2;
	this.HideMenu_2			=   __HideMenu_2;
	this.GenerateMenus		=   __GenerateMenus;
	this.GenerateMenus_1		=   __GenerateMenus_1;
	this.GenerateMenus_2		=   __GenerateMenus_2;

	this.SetLabel			=   __SetLabel;
	this.ShowLabel			=   __ShowLabel;
	this.HideLabel			=   __HideLabel;
	this.JumpTo			=   __JumpTo;
	this.NavToMenu			=   __NavToMenu;



}



function __GetMenus()
{

	var mm = new Array();

	// ("item del menu",
	//  "link",
	//  "texto del menu, titular y status",		si es "" toma el item
	//  "frame target   				si es "" va a 'contenido'"
	//  altura del frame   				si es "" o undefines  es HFULL"
	//  )

/*
	mm['branch0'] = new Array();
	mm['branch0']['autoload'] = 0;
	mm['branch0'][0] = new Array("Cat&aacute;logo Anaya", "/formacion/index_autom.html" ," ","",200);
		mm['branch00'] = new Array();
		mm['branch00']['autoload'] = 0;
	 	mm['branch00'][0] 	= new Array ("Cat&aacute;logo de cursos", "/formacion/index_autom.html", " ","" );
	 	mm['branch00'][1] 	= new Array ("Becas", "/formacion/cursos_anaya/becas.html", " " );
	 	mm['branch00'][2] 	= new Array ("Convocatorias", "/formacion/cursos_anaya/calendario_convocatorias.html", " " );
	 	mm['branch00'][3] 	= new Array ("Certificación Anaya", "", " " );
	mm['branch0'][1] = new Array("Becas", "/formacion/becas.html", " ", "", HMEDIUM);
	mm['branch0'][2] = new Array("Mis cursos ", "/matricula/matricula_recuerdo.html", " ", "", HMEDIUM );
	mm['branch0'][3] = new Array("Requisitos técnicos", "/formacion/requerimientos_cursos.html", " " , "",  HMEDIUM);
	mm['branch0'][4] = new Array("Certificación oficial", "/formacion/EATCO/creditos.html", " ");
		mm['branch04'] = new Array();
		mm['branch04']['autoload'] = 0;
	 	mm['branch04'][0] 	= new Array ("Información", "/formacion/EATCO/informacion.html", " " );
	 	mm['branch04'][1] 	= new Array ("Créditos oficiales", "/formacion/EATCO/creditos.html", " " );

	mm['branch0'][5] = new Array("Metodología", "/formacion/metodologia.html", " " , "", HMEDIUM);
	mm['branch0'][6] = new Array("Convocatorias", "/formacion/calendario_convocatorias.html", " " , "", HMEDIUM);
*/



//----------

	mm['branch0'] = new Array();
	mm['branch0']['autoload'] = 0;
	//mm['branch0'][0] =  new Array("2010","../proyecto/NTcrear_frame_cat.html?a=2010", " ","",HFULL );
	mm['branch0'][0] =  new Array("2009","../proyecto/NTcrear_frame_cat.html?a=2009", " ","",HFULL );
	mm['branch0'][1] =  new Array("2008","../proyecto/NTcrear_frame_cat.html?a=2008", " ", "", HFULL );
	mm['branch0'][2] =  new Array("2007","../proyecto/NTcrear_frame_cat.html?a=2007", " ", "", HFULL );
		//mm['branch00'] = new Array();
		//mm['branch00']['autoload'] = 0;
	 	//mm['branch00'][0] 	= new Array ("Cat&aacute;logo de cursos", "/formacion/cursos_anaya/index_autom_anaya.html", " ","",HFULL );
	 	//mm['branch00'][1] 	= new Array ("Becas", "/formacion/cursos_anaya/becas.html", " ", "", HMEDIUM );
	 	//mm['branch00'][2] 	= new Array ("Metodología", "/formacion/cursos_anaya/metodologia.html", " ", "", HMEDIUM );
	 	//mm['branch00'][3] 	= new Array ("Convocatorias", "/formacion/cursos_anaya/calendario_convocatorias.html", " ", "", HMEDIUM );
	 	//mm['branch00'][4] 	= new Array ("Certificación", "/formacion/cursos_anaya/certificacion.html", " ", "", HMEDIUM );


/*************************************************************************/
//ATENCION: MIS CURSOS DEBE IR EN ESTA POSICION (POSICION 1 DEL ARRAY)
// PORQUE OTRAS PARTES DE LA WEB LLAMAN AQUI Y SI NO
// EMPIEZAN A DAR ERRORES
	//mm['branch0'][1] = new Array("Mis cursos ", "/matricula/matricula_recuerdo.html", " ", "", HMEDIUM );
//
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/

	//mm['branch0'][2] = new Array("Requisitos técnicos", "/formacion/requerimientos_cursos.html", " " , "",  HMEDIUM);






	mm['branch1'] = new Array();
	mm['branch1']['autoload'] = 0;
	mm['branch1'][0] = new Array("B&uacute;squeda guiada", "../proyecto/NTcrear_frame.html", " ");
	mm['branch1'][1] = new Array("B&uacute;squeda directa", "../n_bdirecta/formulario.html", " ", "", HMEDIUM);
 	//mm['branch1'][2] = new Array("Otros catálogos", "http://www.cga.es/cgi-bin/descargas.pl"," ","_new");


//----------




	mm['branch2'] = new Array();
	mm['branch2']['autoload'] = 0;
	mm['branch2'][0] = new Array("PROGRAMACIONES", "../proyecto/NTcrear_frame_rd.html", " ");
	mm['branch2'][1] = new Array("PROYECTOS EDUCATIVOS DE CENTRO", "../proyecto/NTcrear_frame_pec.html", " " );
	//mm['branch2'][1] = new Array("", ".", " " );
	mm['branch2'][2] = new Array("PROYECTOS CURRICULARES", "../proyecto/NTcrear_frame_pc.html", " " );
	//mm['branch2'][2] = new Array("Recursos para el aula", "javascript:top.frames.logo.openRCS();top.frames.contenido.location='/recursos/contenido.html'"," ");
	mm['branch2'][3] = new Array("Recursos para el aula", "/recursos/crear_frame.html"," ","",115);
	mm['branch2'][4] = new Array("SOLUCIONARIOS (Socios)","../proyecto/NTcrear_frame_sol.html"," ");
	//mm['branch2'][4] = new Array("DEJA HUELLA", "../minisites/5_primaria.html"," ", "", HMEDIUM);





	mm['branch3'] = new Array();
	mm['branch3']['autoload'] = 0;
	mm['branch3'][0] = new Array("¿Qué es?", "/foro/foro.html", " ", "", HMEDIUM);
	mm['branch3'][1] = new Array("Suscribirse a Foro", "/altaforo/entrada_foro.html", " ", "", HMEDIUM);
	mm['branch3'][2] = new Array("Modificar datos ", "/altaforo/entrada_modificar.html"," ", "", HMEDIUM);
	mm['branch3'][3] = new Array("Darse de baja ", "/altaforo/entrada_baja.html", " ", "", HMEDIUM);
	mm['branch3'][4] = new Array("Cambiar contraseña",  "/altaforo/entrada_password.html"," ", "", HMEDIUM);
	mm['branch3'][5] = new Array("Recordar identificativo",  "/altaforo/searchclave.html"," ", "", HMEDIUM);
	mm['branch3'][6] = new Array("Oferta de libros", "/comunidad_virtual/pedidos/libros.html"," ", "", HMEDIUM);
 	mm['branch3'][7] = new Array("Libros hijos profesores", "/foropedidos/entrada_pedidos.html"," ", "", HMEDIUM);




//	mm['branch3'][2] = new Array("Gesti&oacute;n de bibliotecas",  "../servicios/gestion_biblio/curso_biblio/descripcion.html", " " );
	//	mm['branch32'] = new Array();
	//	mm['branch32']['autoload'] = 0;
	//	mm['branch32'][0] 	= new Array ("Curso de gestión de bibliotecas escolares", "../servicios/gestion_biblio/curso_biblio/descripcion.html", " " );
	//	mm['branch32'][1] 	= new Array ("¿Problemas?", "../servicios/gestion_biblio/preguntas.html", " " );
	// 	mm['branch32'][2] 	= new Array ("Consultas  <img src=../iconos/correo.gif align=middle border=0 >", "mailto:administrador@anayamascerca.com", " " );


//	mm['branch4'] = new Array();
//	mm['branch4']['autoload'] = 0;
//	mm['branch4'][0] = new Array("","../novedades05.html"," ", "", HMEDIUM);
//	mm['branch4'][1] = new Array("Catálogo 2008-2009","../novedades05.html"," ", "", HMEDIUM);
//	mm['branch4'][2] = new Array("Catálogo 2007-2008","../novedades03.html"," ", "", HMEDIUM);

	mm['branch4'] = new Array();
	mm['branch4']['autoload'] = 0;
 	mm['branch4'][0] = new Array("Formación", "/formacion/cursos_anaya/anayaformacion.html" ," ","",HMEDIUM);
 	mm['branch4'][1] = new Array("Servicios", "" ," ","",HMEDIUM);
 		mm['branch41'] = new Array();
		mm['branch41']['autoload'] = 0;
		mm['branch41'][0] = new Array("LOE",  "../legislacion/loe/loe.html", " " );;
		mm['branch41'][1] = new Array("Plan de Lectura", "../n_rdidacticos/plan_clos.html", " " );
		mm['branch41'][2] = new Array("Gestión Bibliotecas", "../gestion_bibliotecas/info.html", " " );
		mm['branch41'][3] = new Array("Atención al cliente",  "/at_cliente/at_cliente_amc.html", " " );
//		mm['branch41'][4] = new Array("Mapa de la web",  "../servicios/mapaweb.html", " ", "", HMEDIUM );






	//mm['branch5'] = new Array();
	//mm['branch5']['autoload'] = 0;
	//mm['branch5'][0] = new Array("","/servicios/webseduca/webeduca.html"," ", "", HMEDIUM);

	return mm;


	return mm;

}




/********************************************************************/
//** Funciones de control de los menus de nivel 1
/********************************************************************/

function __GenerateMenus ()
{

	var strmenu = "";

	for ( var i in this.menus )
	{
		if ( i.length-'branch'.length<=1 )
			strmenu += this.GenerateMenus_1 ( i );
		else
			strmenu += this.GenerateMenus_2 ( i );

		strmenu += '\n\n\n';


	}

		//genera el layer de mensajes
		strmenu += '<div id=label_2 class=label></div>\n';
		strmenu += '<div id=label_3 class=label></div>\n'

return strmenu;



}



function __GenerateMenus_1 (parent_branch)
{

	var strmenu = "";

	var strtitular = "\n<!-- TITULARES -->\n";
	var menulength= this.menus[parent_branch].length;
	var cols = menulength>5 ? 5 : menulength;

	strmenu +=  '<div id="' + parent_branch + '" class="menu1">\n';
	strmenu +=  '<table width=' + cols*140 + ' border="0" height="23" >\n';
    strmenu += '<tr> \n';


    //comprueba si hay algun item en las columnas y si hay alguno coloca la barrav
    var barrav = new Array(0,0,0,0,0);
    for ( x=0; x<5; x++)
	    for ( y=0; y<3; y++)
    		barrav[x] += typeof this.menus[parent_branch][y*5+x]!='undefined' && this.menus[parent_branch][y*5+x][0]!='' ? 1 : 0;



    var item;
    for ( x=0; x<5; x++)
	{
		if ( x>menulength-1 ) continue;
		strmenu += '<td width=3  valign="middle">' +  ( barrav[x]>0 ? '<img src="../iconos/barrav.gif" width="3" height="18"valign="middle" >':'')   + '</td>\n';
		strmenu += '<td width=127  valign="top"> \n';
		strmenu += ' <p> \n';
			for (y=0; y<3; y++)
			{
				if ( y*5+x <= menulength-1 )
				{
					item = y*5+x;
					strmenu += '<font face="Verdana, Helvetica, sans-serif" ><a class="link1" href="javascript:mman.SelectItem_1(\'' + parent_branch +'\', \'' + item + '\'); " onmouseover=\"window.status=\'' + this.menus[parent_branch][item][2] + '\'; return true;"    onmouseout="window.status=\'\'; return true;">\n';
					strmenu += this.menus[parent_branch][item][0]!='' ? '  <img src="../iconos/square_1off.gif" align=bottom border=0 width="8" height="8"  name="selector_' + parent_branch + item + '" >' : '';
					strmenu += '  ' + this.menus[parent_branch][item][0] + '</a></font><br>\n';

					var titular = this.menus[parent_branch][item][2]=="" ? this.menus[parent_branch][item][0] : this.menus[parent_branch][item][2];
					strtitular +=  '<div id="titular_' + parent_branch + item + '" class="MenuTitular"><font class="Titular">' + titular + '</font></div>\n';

				}
			}
		strmenu += ' </p> \n';
		strmenu += '</td>\n';
	}

  	strmenu += '</tr>\n';
	strmenu += '</table>\n';
	strmenu += '</div>\n';


	strmenu += strtitular;



	return strmenu;
}



function __GenerateMenus_2 (parent_branch)
{

	var item = 0;
	var strmenu = "\n<!-- Submenus NIVEL 2 -->\n";


	var menulength= this.menus[parent_branch].length;
	var cols = menulength>5 ? 5 : menulength;
	var rows = parseInt('0' + menulength/5, 10);


	strmenu +=  '<div id="' + parent_branch + '" class="menu2p' + rows + '">\n';
	strmenu +=  '<table width=' + cols*130 + ' border="0" height="23" >\n';
	strmenu += '<tr> \n';

	for ( x=0; x<5; x++)
	{
		if ( x>menulength-1 ) continue;
		strmenu += '<td width=130 height="23" valign="top"> \n';
		strmenu += '  <p>\n';
			for (y=0; y<3; y++)
			{
				if ( y*5+x <= menulength-1 )
				{
					item = y*5+x;
					strmenu += '  <a class="link2" href="javascript: mman.SelectItem_2(\'' + parent_branch +'\', \'' + item + '\');" onmouseover="window.status=\'' + this.menus[parent_branch][item][2] + '\'; return true;"    onmouseout="window.status=\'\';  return true;">';
					strmenu += '  <img src="../iconos/square_2off.gif"  border=0 width="8" height="8" align="bottom" name="selector_' + parent_branch + item + '"> \n';
					strmenu += '  <font  face="Verdana, Helvetica, sans-serif"  color=#A47B00 size=1>' + this.menus[parent_branch][item][0] + '</a></font><br>\n';
				}
			}
		strmenu += '  </p>\n';
		strmenu += '</td>\n';
	}

	strmenu += '</tr>\n';
	strmenu += '</table>\n';
	strmenu += '</div>\n\n';

	return strmenu;
}


/********************************************************************/
//** Funciones de control de los menus de nivel 0
/********************************************************************/

function __HiliteItem( menu ){

	if (  menu == "") return true;

	var idmenu = 'corch' + menu.substr(menu.length-1);


	this.UnhiliteItem (this.hilited);

	var objDiv = CBM_getDocumentElement(idmenu);


 	switch  (CBM_typeofNavigator())
 	{

		case 'NN4':

			objDiv.visibility="show";
		break;


		default:
			objDiv.style.visibility="visible";
	}


	this.hilited=idmenu;
	return true;

}


function __UnhiliteItem( menu ) {


	if ( menu == "" ) return true;

	var idmenu = 'corch' + menu.substr(menu.length-1);

	if ( this.selected_0 == 'branch' + menu.substr(menu.length-1) ) return true;



	var objDiv = CBM_getDocumentElement(idmenu);


 	switch  (CBM_typeofNavigator())
 	{

		case 'NN4':

			objDiv.visibility="hide";
		break;


		default:
			objDiv.style.visibility="hidden";
	}



	return true;

}




function __HiliteItem_1( iditem ){

	if (  iditem == "") return true;

	this.selected_1 = iditem;

	if (typeof document.images['selector_' + iditem]!='undefined')
		document.images['selector_' + iditem].src = "../iconos/anim_square_1on.gif";




	return true;
}


function __UnhiliteItem_1( iditem ) {

	if ( iditem == "") return true;

	this.selected_1 = "";


	if (typeof document.images['selector_' + iditem]!='undefined')
		document.images['selector_' + iditem].src = "../iconos/square_1off.gif";





	return true;
}




function __HiliteItem_2( iditem ){

	if (  iditem == "") return true;

	this.itemselected_2 = iditem;



 	switch (CBM_typeofNavigator())
 	{

		case 'NN4':
			var idparent = iditem.substr(0, iditem.length-1);
			var idparent = iditem.slice (0,8);
			document[idparent].document.images['selector_' + iditem].src = this.homepath + "iconos/anim_square_2on.gif";
		break;


		default:
			document.images['selector_' + iditem].src = this.homepath + "iconos/anim_square_2on.gif";

	}








	return true;

}


function __UnhiliteItem_2( iditem ) {

	if ( iditem == "") return true;

	this.itemselected_2 = "";



 	switch (CBM_typeofNavigator())
 	{

		case 'NN4':
			var idparent = iditem.substr(0, iditem.length-1);
			var idparent = iditem.slice (0,8);
			document[idparent].document.images['selector_' + iditem].src = this.homepath + "iconos/square_2off.gif";
		break;


		default:
			document.images['selector_' + iditem].src = this.homepath + "iconos/square_2off.gif";

	}


	return true;
}













function __ShowHelp( idmenu ){

	if (  idmenu == "") return true;


	var ord = idmenu.substr(idmenu.length-1);

	// si 'contenido' está; en blanco se presenta ahí, si no a la izquierda


 	switch (CBM_typeofNavigator())
 	{

		case 'NN4':
			if ( top.frames[this.helptarget].document['info' + ord ] != null )
				top.frames[this.helptarget].document['info' + ord ].visibility="show";
			return false;
		break;


		case 'MSIE4':
		case 'MSIE5':
			if ( top.frames[this.helptarget].document.all['info' + ord]!= null )
				top.frames[this.helptarget].document.all['info' + ord].style.visibility="visible";
			return true;
		break;


		default:
			if ( top.frames[this.helptarget].document.getElementById('info' + ord)!= null )
				top.frames[this.helptarget].document.getElementById('info' + ord).style.visibility="visible";
			return true;

		break;
	}




	return true;
}




function __HideHelp( idmenu ){

	if (  idmenu == "") return true;


	// si contenido est&aacute; en blanco se presenta ah&iacute;, si no a la izquierda

	var ord = idmenu.substr(idmenu.length-1);


 	switch (CBM_typeofNavigator())
 	{

		case 'NN4':
			if ( top.frames[this.helptarget].document['info' + ord ] != null )
				top.frames[this.helptarget].document['info' + ord ].visibility="hide";
			return false;
		break;


		case 'MSIE4':
		case 'MSIE5':
			if ( top.frames[this.helptarget].document.all['info' + ord]!= null )
				top.frames[this.helptarget].document.all['info' + ord].style.visibility="hidden";
			return true;
		break;


		default:
			if ( top.frames[this.helptarget].document.getElementById('info' + ord)!= null )
				top.frames[this.helptarget].document.getElementById('info' + ord).style.visibility="hidden";
			return true;

	}


	return true;

}


function __ShowMenu_1( idmenu ){

	if (  idmenu == "") return true;

	var idicon = 'icono' + idmenu.substr(idmenu.length-1);


 	switch (CBM_typeofNavigator())
 	{

		case 'NN4':
			document[idmenu].visibility="show";
			//top.logo.document[idicon].visibility="show";
			return false;
		break;


		case 'MSIE4':
		case 'MSIE5':
			document.all[idmenu].style.visibility="visible";
			//top.logo.document.all[idicon].style.visibility="visible";
			return true;
		break;


	default:
			document.getElementById(idmenu).style.visibility="visible";
			//top.logo.document.getElementById(idicon).style.visibility="visible";
			return true;

	}





	return true;
}



function __HideMenu_1( idmenu ){

	if (  idmenu == "") return true;

	var idicon = 'icono' + idmenu.substr(idmenu.length-1);


 	switch (CBM_typeofNavigator())
 	{

		case 'NN4':
			document[idmenu].visibility="hide";
			//top.logo.document[idicon].visibility="hide";
			return false;
		break;


		case 'MSIE4':
		case 'MSIE5':
			document.all[idmenu].style.visibility="hidden";
			//top.logo.document.all[idicon].style.visibility="hidden";
			return true;
		break;


		default:
			document.getElementById(idmenu).style.visibility="hidden";
			//top.logo.document.getElementById(idicon).style.visibility="hidden";
			return true;

	}





	return true;
}



function __ShowMenu_2( idmenu )
{

	if (  idmenu == "") return true;
	this.HideMenu_2( this.selected_2 );

	this.selected_2 = idmenu;


 	switch (CBM_typeofNavigator())
 	{

		case 'NN4':
			CBM_getDocumentElement('titular_' + idmenu ).visibility="show";
			if ( typeof this.menus[idmenu]!='undefined' )
				CBM_getDocumentElement( idmenu ).visibility="show";
			return false;
		break;


		default:
			CBM_getDocumentElement('titular_' + idmenu ).style.visibility="visible";
			if ( typeof this.menus[idmenu]!='undefined' )
				CBM_getDocumentElement( idmenu ).style.visibility="visible";
	}




	return true;



}

function __HideMenu_2( idmenu )
{

	if (  idmenu == "") return true;

	// esconde el layer de los mensajes de la zona gris
	this.HideLabel();


 	switch (CBM_typeofNavigator())
 	{

		case 'NN4':
			CBM_getDocumentElement('titular_' + idmenu ).visibility="hide";
			// la informacion de ayuda sale en contenido
			top.frames.contenido.location = "../blank.html";
			this.helptarget = 'contenido';
			//
			if ( typeof this.menus[idmenu]!='undefined' )
				CBM_getDocumentElement(idmenu ).visibility="hide";
			return false;
		break;


		default:

			CBM_getDocumentElement('titular_' + idmenu ).style.visibility="hidden";
			// la informacion de ayuda sale en contenido
			top.frames.contenido.location.href = "../blank.html";
			this.helptarget = 'logo';
			//
			if ( typeof this.menus[idmenu]!='undefined' )
				CBM_getDocumentElement(idmenu ).style.visibility="hidden";
			return true;

		break;
	}





	return true;



}















function __SelectItem_0 (idmenu, ord)
{

	// ilumina el item de nivel 0
	this.HiliteItem( idmenu );
	tmp = this.selected_0;
	this.selected_0 = idmenu;
	this.UnhiliteItem ( tmp );

	// esconde el de nivel 2, si hay
	this.HideMenu_2( this.selected_2 );

	// muestra el menu de nivel 1
	this.UnhiliteItem_1 (this.selected_1 );
	this.HideMenu_1 ( tmp  );
	this.ShowMenu_1 ( idmenu );

	// si existe autoload activa el menu correspondiente
	switch ( typeof this.menus[idmenu]['autoload'] )
	{

		case 'number' : this.SelectItem_1 (idmenu, this.menus[idmenu]['autoload'] ); break;
		case 'string' : top.frames['contenido'].location = this.menus[idmenu]['autoload']; break;
		default : top.frames['contenido'].location = "/blanco.html"; break;

	}

/*
	// si existe loadlogo carga la pantalla indicada en el frame logo
	if ( typeof this.menus[idmenu]['loadlogo'] != 'undefined')
		top.frames['logo'].location = this.menus[idmenu]['loadlogo'];
	else
		top.frames['logo'].location = "/logo.html";
*/


}








function __SelectItem_1 (idparent, ord)
{

	// ilumina el item de nivel 1

	this.UnhiliteItem_1 ( this.selected_1 );
	this.HiliteItem_1 ( idparent + ord );
	this.selected_1 = idparent + ord;

	// muestra el menu de nivel 2
	this.UnhiliteItem_2 ( this.itemselected_2 );
	this.ShowMenu_2(idparent + ord);

	// si hay url la carga en 'contenido'
	if ( typeof this.menus[idparent][ord][1]!= 'undefined' && this.menus[idparent][ord][1]!="" )
	{
		// se discrimina el frame donde se abre la url
		var frm = this.menus[idparent][ord][3];
		if ( typeof frm=='undefined' || frm=="" ) frm='contenido';

		switch ( frm.substr(0,4) ) {
			  case '_new':  open( this.menus[idparent][ord][1] ); break;
			  case 'open':  open( this.menus[idparent][ord][1], '', frm.slice(5).replace(/[ ]+/g,',') ); break;
			  default   :  top.frames[frm].location = this.menus[idparent][ord][1]; break;
		}
		this.helptarget = 'logo';
	}

	// si existe autoload activa el menu correspondiente
	if ( this.menus[idparent + ord] != null && typeof this.menus[idparent + ord]['autoload'] != 'undefined' )
		this.SelectItem_2 (idparent + ord, this.menus[idparent + ord]['autoload'] );
	else
	{
		// si no hay autoload, ajusta la ventana
		// ya que de haberlo quien ajusta la ventana es SelectedItem_2

		if (typeof this.menus[idparent][ord][4]=='' || typeof  this.menus[idparent][ord][4]=='undefined')
			hw = HFULL;
		else
			hw = this.menus[idparent][ord][4];


		MF_toHeight('FSmenu', hw);
	}


}




function __SelectItem_2 (idparent, ord)
{

	// ilumina el item de nivel 1
	this.UnhiliteItem_2 ( this.itemselected_2 );
	this.HiliteItem_2( idparent + ord );

	// esconde el layer de los mensajes de la zona gris
	this.HideLabel();


	// muestra el menu de nivel 2
	if ( typeof this.menus[idparent][ord][1]!= 'undefined' && this.menus[idparent][ord][1]!="" )
	{

		// se discrimina el frame donde se abre la url
		var frm = this.menus[idparent][ord][3];
		if ( typeof frm=='undefined' || frm=="" ) frm='contenido';

		switch ( frm.substr(0,4) ) {
			  case '_new':  open( this.menus[idparent][ord][1]); break;
			  case 'open':  open( this.menus[idparent][ord][1], '', frm.slice(5).replace(/[ ]+/g,',') ); break;
			  default   :  top.frames[frm].location = this.menus[idparent][ord][1]; break;
		}


		this.helptarget = 'logo';
	}


	if (typeof this.menus[idparent][ord][4]=='' || typeof  this.menus[idparent][ord][4]=='undefined')
		hw = HFULL;
	else
		hw = this.menus[idparent][ord][4];


	MF_toHeight('FSmenu', hw)

}







/********************************************************************/
//**
//* Lanza un HTML en la el filete gris del menu superior
//* @param msghtml -> cadena que contiene el codigo html

//* @return <retorno>
/********************************************************************/


function __SetLabel ( msghtml, x0, y0 , id )
{

	id = typeof id=='undefined' ? 'label_2' : id;

	if ( typeof x0 != 'undefined' && typeof y0 != 'undefined')
	{
		xpos = x0;
		ypos = y0;
	}
	else
	{
		xpos = 10;
		ypos = 90;
	}


	var objDiv = CBM_getDocumentElement(id);


 	switch (CBM_typeofNavigator())
 	{

		case 'NN4':
			objDiv.top = ypos;
			objDiv.left = xpos;

			objDiv.document.open();
			objDiv.document.write ( msghtml );
			objDiv.document.close();
		break;


		default:
			objDiv.style.top = ypos;
			objDiv.style.left = xpos;

			objDiv.innerHTML = msghtml;
	}



}




function __ShowLabel ( id )
{

	id = typeof id=='undefined' ? 'label_2' : id;

	var objDiv = CBM_getDocumentElement(id);


 	switch (CBM_typeofNavigator())
 	{

		case 'NN4':
			objDiv.visibility="show";
			return false;
		break;


		default:
			objDiv.style.visibility="visible";


	}

	return true;




}



function __HideLabel ( id )
{

	id = typeof id=='undefined' ? 'label_2' : id;

	var objDiv = CBM_getDocumentElement(id);


 	switch (CBM_typeofNavigator())
 	{

		case 'NN4':
			objDiv.visibility="hide";
			return false;
		break;


		default:
			objDiv.style.visibility="hidden";


	}

	return true;


}




function __JumpTo ( url, frame)
{
	if ( typeof frame == 'undefined' ) frame = 'contenido';

	top.frames[frame].location = url;


}


/********************************************************************/
//**
//* Selecciona un item determinado seg&uacute;n el vector (b0,b1,b2)
//* @param b0 -> item de nivel 0
//* @param b1 -> item de nivel 1
//* @param b2 -> item de nivel 2
//* @return <retorno>
/********************************************************************/

function __NavToMenu ( b0, b1, b2 )
{

	if ( typeof b0 != 'undefined' ) this.SelectItem_0 ('branch' + b0, b0);
	if ( typeof b1 != 'undefined' ) this.SelectItem_1 ('branch' + b0, b1);
	if ( typeof b2 != 'undefined' ) this.SelectItem_2 ('branch' + b0 + b1, b2);



}


/********************************************************************/
//**
//* Selecciona un item determinado seg&uacute;n el vector (b0,b1,b2)
/********************************************************************/

fENDHEIGHT = new Object();

function MF_toHeight(frmid,endheight)
{
	frmobj = top.document.getElementById(frmid);

	if (typeof endheight=='undefined')
		endheight = fENDHEIGHT[frmid];
	else
		fENDHEIGHT[frmid] = endheight;


	endheight= 1*endheight;
	curheight = 1*frmobj.rows.split(',')[0];

	if ( endheight==curheight )
		return;

	inc = Math.round(Math.abs(endheight-curheight)*0.1);

	x= Math.abs(endheight-curheight)

	inc = 70 / (1+0.2*Math.pow(Math.E,5-0.03*x) )


	step = inc * (endheight-curheight)/Math.abs(endheight-curheight);
		//logWin.document.write('->   x:' + x + '   inc:' + step + '<br>')


	resheight = curheight+step;
	if ( (step>0 && resheight>=endheight) || (step<=0 && resheight<=endheight)  )
	{
		resheight= endheight;
		//window.status = window.status.slice(0,4) + '->end   step:' + step + '   res:' + resheight + '  end:' + endheight + '';
		//logWin.document.write('->end   step:' + step + '   res:' + resheight + '  end:' + endheight + '<br>')

	}

	frmobj.rows = resheight + ',*';

//window.status = "" + frmid + "->" + (resheight) + ", " + endheight + "  inc=" + inc + ""

	if (resheight-endheight!=0)
		setTimeout("MF_toHeight('" + frmid + "')",5)
		//setTimeout("toWidth('" + frmid + "'," + endheight + ")",50)

}





