var obj_visible = new Array();    // array of visible menu elements idexed on 'path'
var cur_menu=""                   // path of submenu with the mouse captured
var cur_main=""                   // path of active mainmenu
var xxx=""
var obj_cur_menu=null;
var obj_cur_main=null;
var obj_menuitem = new Object
obj_menuitem["name"]="";
obj_menuitem["class"]="";
obj_menuitem["object"]=null;
obj_menuitem["parent"]=null
function initMenu() {
obj_visible=new Array();
selectMainMenu(cur_main);
}
function onOut() {
cur_menu="";
}
function selectMenu(selectclass,unselectclass) {
if (obj_cur_menu!=null) obj_cur_menu.className=unselectclass;
obj_cur_menu = obj_menuitem["object"]
obj_menuitem["object"].className=selectclass;
obj_menuitem["class"]=selectclass;
var ar_path=obj_menuitem["object"].id.split("/");
window.status=ar_path[1];
selectMainMenu(ar_path[1]);
cur_menu="";
doHideAll();
}
function selectMainImgMenu(newmain) {
if (cur_main!="")  {
if (obj_cur_main==null )obj_cur_main = GetMenuElement(cur_main) ;
}
if (obj_cur_main!=null ){
if (obj_cur_main.src != "")	{
obj_cur_main.src=obj_cur_main.src.replace("_down","");
}
}
if (newmain!="") cur_main=newmain
if (cur_main!="")  {
obj_cur_main = GetMenuElement(cur_main) ;
if (obj_cur_main!=null ){
newsrc=obj_cur_main.src
if (newsrc) {
newsrc=newsrc.replace("_over","");
newsrc=newsrc.replace("_down","");
newsrc=newsrc.replace(cur_main,cur_main+"_down")
obj_cur_main.src=newsrc;
}
obj_cur_main.prevsrc=obj_cur_main.src;
}
}
}
function selectMainMenu(newmain) {
if (cur_main!="")  {
if (obj_cur_main==null )obj_cur_main = GetMenuElement(cur_main) ;
}
if (obj_cur_main!=null ){
if (obj_cur_main.src != "")	{
obj_cur_main.src=obj_cur_main.src.replace("_down","");
}
}
if (newmain!="") cur_main=newmain
if (cur_main!="")  {
obj_cur_main = GetMenuElement(cur_main) ;
if (obj_cur_main!=null ){
newsrc=obj_cur_main.src
if (newsrc) {
newsrc=newsrc.replace("_over","");
newsrc=newsrc.replace("_down","");
newsrc=newsrc.replace(cur_main,cur_main+"_down")
obj_cur_main.src=newsrc;
}
obj_cur_main.prevsrc=obj_cur_main.src;
}
}
}
function doDisplay(submenu,top,left,width,level) {
if (cur_menu==submenu) return;
var cur_levels =submenu.split("/");
cur_menu=submenu;
for  (var id in obj_visible) {
var hide=false;
var prev_levels=id.split("/");
if (prev_levels.length<=cur_levels.length) {
for (var i=0 ; i< prev_levels.length ; i++ ) {
if (prev_levels[i]==cur_levels[i]) continue;
hide=true
break;
}
} else {
var hide=true;
}
obj_visible[id].style.visibility=(hide)?"hidden":"visible";
}
if (isMenuObject(obj_menuitem["object"]) && obj_menuitem["object"]!=null) {
var prev_levels=obj_menuitem["name"].split("/");
if (prev_levels.length<cur_levels.length) {
var obj_temp=new Object;
obj_temp["object"]=obj_menuitem["object"];
obj_temp["class"]=obj_menuitem["class"];
obj_temp["name"]=obj_menuitem["name"];
obj_temp["parent"]=obj_menuitem["parent"]
obj_menuitem["parent"]=obj_temp;
obj_temp=null;
} else {
obj_menuitem["object"].className=obj_menuitem["class"];
}
if (prev_levels.length>cur_levels.length) {
if (isMenuObject(obj_menuitem["parent"]) && obj_menuitem["parent"]!=null) {
obj_menuitem["parent"]["object"].className=obj_menuitem["parent"]["class"];
obj_menuitem["parent"]=(isMenuObject(obj_menuitem["parent"]["parent"]))?obj_menuitem["parent"]["parent"]:null;;
}
}
}
obj_menuitem["name"]="menuitem"+submenu;
obj_menuitem["object"]=GetMenuElement(obj_menuitem["name"]);
if (isMenuObject(obj_menuitem["object"]) && obj_menuitem["object"]!=null) {
obj_menuitem["class"]=obj_menuitem["object"].className;
}
if (isMenuObject(obj_menuitem["object"]) && obj_menuitem["object"]!=null) {
obj_menuitem["object"].className="MENU" + level +"_OVER";
}
if (cur_menu=="") return;
var obj_submenu = GetMenuElement(submenu);
if (obj_submenu==null) return;
obj_submenu.style.top=top + 'px'; ;
obj_submenu.style.left=left + 'px';
obj_visible[cur_menu]=obj_submenu;
obj_submenu.style.visibility="visible";
ShowPath(cur_menu);
}
function doHideAll() {
if (cur_menu=="") {
if (isMenuObject(obj_menuitem["parent"]) && obj_menuitem["parent"]!=null) {
deSelectParent(obj_menuitem["parent"]);
}
for  (var id in obj_visible) { obj_visible[id].style.visibility="hidden"; }
obj_visible= new Array();;
}
}
function deSelectParent(obj_menu) {
if (obj_menu["parent"]  && isMenuObject(obj_menuitem["parent"]) && obj_menuitem["parent"]!=null) {
deSelectParent(obj_menu["parent"])
}
obj_menu["object"].className=obj_menu["class"];
}
function isMenuObject(obj) {	return (typeof obj=="object") }
function ShowPath(currentpath) {
}

