// Menu G4.1.8 (non-frame/loader)
// Last Modified: 29-Oct-2003
// Web Site: yxScripts.com
// Email: m_yangxin@hotmail.com

// Copyright 2003  Xin Yang   All Rights Reserved.

// default settings, can be overwritten by a path script
var _webPath="";
var _scriptPath="components/com_myjsmenu/";
var _imagePath="components/com_myjsmenu/images/";
var _contentScript="";
var _styleScript="";
var _instanceScript="";
var _nonMenuPage="";
var _menuTimer=500;
var _menuTimerBar=0;
var _floatTimer=100;
var _floatOffset=1;
var _zBase=2;
// ------

var yx_nav=navigator.userAgent.toLowerCase();

var yx_isMac=(yx_nav.indexOf("mac")!=-1);
var yx_isOpera=(yx_nav.indexOf("opera")!=-1);
var yx_isKon=(yx_nav.indexOf("konqueror")!=-1);
var yx_isIE=(!yx_isOpera && yx_nav.indexOf("msie")!=-1);
var yx_isIE4=(yx_isIE && yx_nav.indexOf("msie 4")!=-1);
var yx_isIE5=(yx_isIE && !yx_isIE4);
var yx_isN4=(yx_nav.indexOf('mozilla')!=-1 && yx_nav.search(/msie|gecko|opera|spoofer|compatible|webtv|hotjava/)==-1);
var yx_isN6=(yx_nav.indexOf("gecko")!=-1);
var yx_isO7=(yx_nav.indexOf("opera 7")!=-1);
var yx_isK3=(yx_isKon && navigator.appVersion.indexOf('Konqueror/3')!=-1);

var yx_menuSafe=(yx_isN6 || yx_isN4 || yx_isIE5 || yx_isIE4 && !yx_isMac || yx_isK3 || yx_isO7);

if (typeof(webPath)=="undefined") { webPath=_webPath; }
if (typeof(scriptPath)=="undefined") { scriptPath=_scriptPath; }
if (typeof(imagePath)=="undefined") { imagePath=_imagePath; }
if (typeof(contentScript)=="undefined") { contentScript=_contentScript; }
if (typeof(styleScript)=="undefined") { styleScript=_styleScript; }
if (typeof(instanceScript)=="undefined") { instanceScript=_instanceScript; }
if (typeof(nonMenuPage)=="undefined") { nonMenuPage=_nonMenuPage; }
if (typeof(menuTimer)=="undefined") { menuTimer=_menuTimer; }
if (typeof(menuTimerBar)=="undefined") { menuTimerBar=_menuTimerBar; }
if (typeof(floatTimer)=="undefined") { floatTimer=_floatTimer; }
if (typeof(floatOffset)=="undefined") { floatOffset=_floatOffset; }
if (typeof(zBase)=="undefined") { zBase=_zBase; }

var yx_Top="T", yx_M="M", yx_L="L", yx_C="C", yx_I="I", yx_S="S";
var yx_goodM=true, yx_goodI=true, yx_winEvent="";
var yx_cCount=0, yx_cBack=new Array(), yxIns=new Array();;
var yx_iTimer=0, yx_oTimer=0, yx_sTimer=0, yx_BM=0, yx_sX=0, yx_sY=0, yx_wW=0, yx_wH=0;
var yx_onePixel=imagePath+"onePixel.gif", yx_pImage=new Image(1,1); yx_pImage.src=yx_onePixel;
var yx_sPixel='<img src="'+yx_pImage.src+'" width="1" height="1" border="0" hspace="0" vspace="0">';
var yx_pathRE=/(^\w+:)|(^\/)|(^\.)/;

function yx_setIt() { yx_oTimer=setTimeout("yx_closeIns(null)",menuTimer*2); }
function yx_stopIt(t) { if (t>0) clearTimeout(t); }
function yx_stopAll() { yx_stopIt(yx_iTimer); yx_iTimer=0; yx_stopIt(yx_oTimer); yx_oTimer=0; yx_stopIt(yx_sTimer); yx_sTimer=0; }
function yx_getWebPath(path) { return yx_pathRE.test(path)?path:(webPath+path); }
function yx_getImgPath(path) { return yx_pathRE.test(path)?path:(imagePath+path); }
function yx_showMsg(msg) { window.status=msg; }
function yx_callBack(obj,func,para,t) {
  var x=yx_cCount++; yx_cBack[x]=obj;
  var tm=setTimeout(("yx_cBack["+x+"]."+func+para),t);
  if (yx_cCount>200) { yx_cCount=0; }
  return tm;
}
function yx_goLink(link,target) {
  if (link.substring(0,11).toLowerCase()=="javascript:") {
    eval(link.substring(11));
  }
  else {
    if (target!="") {
      window.open(yx_getWebPath(link),target);
    }
    else {
      window.location.href=yx_getWebPath(link);
    }
  }
}

function yx_fgOBJ(obj,name,mode) {
  for (var i=0; i<obj.length; i++) { if (obj[i].name==name) { return obj[i]; } }
  return mode?obj[0]:null;
}
function yx_findOBJ(obj,name) { return yx_fgOBJ(obj,name,false); }
function yx_getOBJ(obj,name) { return yx_fgOBJ(obj,name,true); }

function yx_colorIt(style,color) {
  if (style=="outset") {
    return [yx_getColor(color,1),yx_getColor(color,-1)];
  }
  else if (style=="inset") {
    return [yx_getColor(color,-1),yx_getColor(color,1)];
  }
  else {
    return [color,color];
  }
}

function yx_sPadOBJ(sp_name,para) {
  this.name=sp_name;

  this.vis=(para.search(/visibility\s*:\s*hidden/)==-1);

  this.sColor=(para.search(/background-color\s*:\s*(#[\-a-f\d]{6})/i)!=-1 && RegExp.$1!="#------")?(RegExp.$1):"";

  this.bSize=para.search(/border-size\s*:\s*(\d+)/)!=-1?(RegExp.$1-0):0;

  if (this.bSize>0) {
    this.bStyle=para.search(/border-style\s*:\s*(outset|inset|solid)/)!=-1?(RegExp.$1):"solid";
    this.bColor=para.search(/border-color\s*:\s*(#[a-f\d]{6})/i)!=-1?(RegExp.$1):"#000000";

    var pbc=yx_colorIt(this.bStyle,this.bColor);
    this.bColorT=pbc[0]; this.bColorR=pbc[1]; this.bColorB=pbc[1]; this.bColorL=pbc[0];

    if (this.sColor!="" && para.search(/border-sides\s*:\s*(1|0)\s+(1|0)\s+(1|0)\s+(1|0)/)!=-1) {
      if (RegExp.$1=="0") { this.bColorT=this.sColor; }
      if (RegExp.$2=="0") { this.bColorR=this.sColor; }
      if (RegExp.$3=="0") { this.bColorB=this.sColor; }
      if (RegExp.$4=="0") { this.bColorL=this.sColor; }
    }
  }

  var ra=para.match(/padding\s*:\s*(\d+)(\s+(\d+))?/);
  this.sHeight=(ra && ra[1])?(ra[1]-0):0;
  this.sWidth=(ra && ra[3])?(ra[3]-0):this.sHeight;

  this.bar=(para.search(/menu-form\s*:\s*bar/)!=-1);
  this.dir=para.search(/direction\s*:\s*(right-down|right-up|left-down|left-up|center-down|center-up|abs-right-down|abs-right-up|abs-left-down|abs-left-up|right-top|left-top|right-middle|left-middle|right-bottom|left-bottom)/)!=-1?(RegExp.$1):"";

  this.scroll=(para.search(/scroll\s*:\s*yes/)!=-1);

  this.dx=para.search(/offset-left\s*:\s*(\-?\d+)/)!=-1?(RegExp.$1-0):0;
  this.dy=para.search(/offset-top\s*:\s*(\-?\d+)/)!=-1?(RegExp.$1-0):0;

  this.iOff=para.search(/item-offset\s*:\s*(\-?\d+)/)!=-1?(RegExp.$1-0):0;

  this.opacity=para.search(/opacity:(\d+)/)!=-1?(RegExp.$1):"";
}; var yx_sPads=new Array(); yx_sPads[0]=new yx_sPadOBJ("","border-size:2;border-style:outset;border-color:#c0c0c0;padding:3;background-color:#c0c0c0;");

function yx_sItemOBJ(si_name,para) {
  this.name=si_name;

  this.iWidth=para.search(/width\s*:\s*(\d+)/)!=-1?(RegExp.$1-0):0;
  this.iHeight=para.search(/height\s*:\s*(\d+)/)!=-1?(RegExp.$1-0):0;

  var ra=para.match(/padding\s*:\s*(\d+)(\s+(\d+))?/);
  this.pHeight=(ra && ra[1])?(ra[1]-0):0;
  this.pWidth=(ra && ra[3])?(ra[3]-0):this.pHeight;

  ra=para.match(/background-color\s*:\s*(#[\-a-f\d]{6})(\s+(#[\-a-f\d]{6}))?(\s+(#[\-a-f\d]{6}))?/i);
  this.iColorN=(ra && ra[1] && ra[1]!="#------")?ra[1]:"";
  this.iColorH=(ra && ra[3])?(ra[3]!="#------"?ra[3]:""):this.iColorN;
  this.iColorC=(ra && ra[5])?(ra[5]!="#------"?ra[5]:""):"none";

  this.bSize=para.search(/border-size\s*:\s*(\d+)/)!=-1?(RegExp.$1-0):0;

  if (this.bSize>0) {
    ra=para.match(/border-style\s*:\s*(outset|inset|solid)(\s+(outset|inset|solid))?(\s+(outset|inset|solid))?/);
    this.bStyleN=(ra && ra[1])?ra[1]:"solid";
    this.bStyleH=(ra && ra[3])?ra[3]:this.bStyleN;
    this.bStyleC=(ra && ra[5])?ra[5]:"";

    ra=para.match(/border-color\s*:\s*(#[a-f\d]{6})(\s+(#[a-f\d]{6}))?(\s+(#[a-f\d]{6}))?/i);
    this.bColorN=(ra && ra[1])?ra[1]:"#000000";
    this.bColorH=(ra && ra[3])?ra[3]:this.bColorN;
    this.bColorC=(ra && ra[5])?ra[5]:"";

    var ibc=yx_colorIt(this.bStyleN,this.bColorN);
    this.bColorNT=ibc[0]; this.bColorNR=ibc[1]; this.bColorNB=ibc[1]; this.bColorNL=ibc[0];

    ibc=yx_colorIt(this.bStyleH,this.bColorH);
    this.bColorHT=ibc[0]; this.bColorHR=ibc[1]; this.bColorHB=ibc[1]; this.bColorHL=ibc[0];

    if (this.bStyleC!="" && this.bColorC!="") {
      ibc=yx_colorIt(this.bStyleC,this.bColorC);
      this.bColorCT=ibc[0]; this.bColorCR=ibc[1]; this.bColorCB=ibc[1]; this.bColorCL=ibc[0];
    }
    else {
      this.bColorCT=""; this.bColorCR=""; this.bColorCB=""; this.bColorCL="";
    }

    if (para.search(/border-sides\s*:\s*([^;]+)(;|$)/)!=-1) {
      var ba=RegExp.$1.split(",");
      if (ba[0].search(/(1|0)\s+(1|0)\s+(1|0)\s+(1|0)/)!=-1 && this.iColorN!="") {
        if (RegExp.$1=="0") { this.bColorNT=this.iColorN; }
        if (RegExp.$2=="0") { this.bColorNR=this.iColorN; }
        if (RegExp.$3=="0") { this.bColorNB=this.iColorN; }
        if (RegExp.$4=="0") { this.bColorNL=this.iColorN; }
      }
      if (ba[1] && ba[1].search(/(1|0)\s+(1|0)\s+(1|0)\s+(1|0)/)!=-1 && this.iColorH!="") {
        if (RegExp.$1=="0") { this.bColorHT=this.iColorH; }
        if (RegExp.$2=="0") { this.bColorHR=this.iColorH; }
        if (RegExp.$3=="0") { this.bColorHB=this.iColorH; }
        if (RegExp.$4=="0") { this.bColorHL=this.iColorH; }
      }
      if (this.bStyleC!="" && this.bColorC!="" && ba[2] && ba[2].search(/(1|0)\s+(1|0)\s+(1|0)\s+(1|0)/)!=-1 && this.iColorC!="none") {
        if (RegExp.$1=="0") { this.bColorCT=this.iColorC; }
        if (RegExp.$2=="0") { this.bColorCR=this.iColorC; }
        if (RegExp.$3=="0") { this.bColorCB=this.iColorC; }
        if (RegExp.$4=="0") { this.bColorCL=this.iColorC; }
      }
    }
  }

  this.onOver=(para.search(/sub-menu\s*:\s*mouse-click/)==-1);

  this.opacity=para.search(/opacity:(\d+)/)!=-1?(RegExp.$1):"";
}; var yx_sItems=new Array(); yx_sItems[0]=new yx_sItemOBJ("","width:120;padding:1 6;border-size:0;background-color:#c0c0c0 #000080;");

function yx_sFontOBJ(sf_name,para) {
  this.name=sf_name;

  this.fFamily=para.search(/font-family\s*:\s*([\w\s,\-]+)(;|$)/)!=-1?(RegExp.$1):"Arial";
  this.fSize=para.search(/font-size\s*:\s*(\d+)/)!=-1?(RegExp.$1-0):14;

  var ra=para.match(/font-weight\s*:\s*(normal|bold)(\s+(normal|bold))?/);
  this.fWeightN=(ra && ra[1])?ra[1]:"normal"; this.fWeightH=(ra && ra[3])?ra[3]:this.fWeightN;

  ra=para.match(/font-style\s*:\s*(normal|italic)(\s+(normal|italic))?/);
  this.fStyleN=(ra && ra[1])?ra[1]:"normal"; this.fStyleH=(ra && ra[3])?ra[3]:this.fStyleN;

  ra=para.match(/text-decoration\s*:\s*(none|underline)(\s+(none|underline))?/);
  this.textN=(ra && ra[1])?ra[1]:"none"; this.textH=(ra && ra[3])?ra[3]:this.textN;

  ra=para.match(/color\s*:\s*(#[a-f\d]{6})(\s+(#[a-f\d]{6}))?(\s+(#[a-f\d]{6}))?/i);
  this.fColorN=(ra && ra[1])?ra[1]:"#000000"; this.fColorH=(ra && ra[3])?ra[3]:this.fColorN; this.fColorC=(ra && ra[5])?ra[5]:"";

  this.fAlign=para.search(/text-align\s*:\s*(left|center|right)/)!=-1?(RegExp.$1):"left";
  this.vAlign=para.search(/(valign|vertical-align)\s*:\s*(top|middle)/)!=-1?(RegExp.$2):"top";
}; var yx_sFonts=new Array(); yx_sFonts[0]=new yx_sFontOBJ("","color:#000000 #ffffff;");

function yx_sTagOBJ(st_name,para) {
  this.name=st_name;

  this.vis=(para.search(/visibility\s*:\s*hidden/)==-1);

  if (this.vis) {
    this.tPath=yx_getImgPath(para.search(/path\s*:\s*([^;]+)(;|$)/)!=-1?(RegExp.$1):"");

    this.tN=para.search(/tag-normal\s*:\s*([^;]+)(;|$)/)!=-1?(RegExp.$1):"";
    this.tH=para.search(/tag-highlight\s*:\s*([^;]+)(;|$)/)!=-1?(RegExp.$1):this.tN;

    this.tWidth=para.search(/width\s*:\s*(\d+)/)!=-1?(RegExp.$1-0):0;
    this.tHeight=para.search(/height\s*:\s*(\d+)/)!=-1?(RegExp.$1-0):0;

    this.tAlign=para.search(/align\s*:\s*(left|right)/)!=-1?(RegExp.$1):"right";
    this.vAlign=para.search(/valign\s*:\s*(top|middle)/)!=-1?(RegExp.$1):"top";

    this.t0=new Image(this.tWidth,this.tHeight); this.t0.src=this.tPath+this.tN;
    this.t1=new Image(this.tWidth,this.tHeight); this.t1.src=this.tPath+this.tH;
  }
}; var yx_sTags=new Array(); yx_sTags[0]=new yx_sTagOBJ("","tag-normal:tagRN.gif;tag-highlight:tagRH.gif;width:8;height:7;");

function yx_sSeparatorOBJ(ss_name,para) {
  this.name=ss_name;

  this.sStyle=para.search(/style\s*:\s*(outset|inset|solid)/)!=-1?(RegExp.$1):"solid";
  this.sColor=para.search(/color\s*:\s*(#[a-f\d]{6})/i)!=-1?(RegExp.$1):"#000000";

  var sbc=yx_colorIt(this.sStyle,this.sColor);
  this.color1=sbc[0]; this.color2=sbc[1];
  this.sSize=(para.search(/size\s*:\s*(1|2)/)!=-1 && this.sStyle=="solid")?(RegExp.$1-0):2;
}; var yx_sSeparators=new Array(); yx_sSeparators[0]=new yx_sSeparatorOBJ("","style:inset;color:#c0c0c0;size:2");

function yx_sMenuOBJ(sm_name,sp_name,si_name,sf_name,st_name,ss_name) {
  this.name=sm_name;
  this.sPad=(yx_sMenus.length>0 && sp_name=="")?yx_sMenus[0].sPad:yx_getPad(sp_name);
  this.sItem=(yx_sMenus.length>0 && si_name=="")?yx_sMenus[0].sItem:yx_getItem(si_name);
  this.sFont=(yx_sMenus.length>0 && sf_name=="")?yx_sMenus[0].sFont:yx_getFont(sf_name);
  this.sTag=(yx_sMenus.length>0 && st_name=="")?yx_sMenus[0].sTag:yx_getTag(st_name);
  this.sSeparator=(yx_sMenus.length>0 && ss_name=="")?yx_sMenus[0].sSeparator:yx_getSeparator(ss_name);
}; var yx_sMenus=new Array(); yx_sMenus[0]=new yx_sMenuOBJ("","","","","","");

function addStylePad(sp_name,para) { yx_sPads[yx_sPads.length]=new yx_sPadOBJ(sp_name,para); }
function addStyleItem(si_name,para) { yx_sItems[yx_sItems.length]=new yx_sItemOBJ(si_name,para); }
function addStyleFont(sf_name,para) { yx_sFonts[yx_sFonts.length]=new yx_sFontOBJ(sf_name,para); }
function addStyleTag(st_name,para) { yx_sTags[yx_sTags.length]=new yx_sTagOBJ(st_name,para); }
function addStyleSeparator(ss_name,para) { yx_sSeparators[yx_sSeparators.length]=new yx_sSeparatorOBJ(ss_name,para); }
function addStyleMenu(sm_name,sp_name,si_name,sf_name,st_name,ss_name) { yx_sMenus[yx_sMenus.length]=new yx_sMenuOBJ(sm_name,sp_name,si_name,sf_name,st_name,ss_name); }

function yx_memOBJ(menu,style) { this.menu=menu; this.style=style; }
function yx_sGroupOBJ(sg_name) { this.name=sg_name; this.member=new Array(); }; var yx_sGroups=new Array();
function addStyleGroup(sg_name,sm_name) {
  var xGroup=yx_findGroup(sg_name);

  if (xGroup==null) {
    var x=yx_sGroups.length; yx_sGroups[x]=new yx_sGroupOBJ(sg_name); xGroup=yx_sGroups[x];
  }

  var xLen=xGroup.member.length;
  for (var i=2; i<addStyleGroup.arguments.length; i++) {
    xGroup.member[xLen+i-2]=new yx_memOBJ(addStyleGroup.arguments[i],sm_name);
  }
}
function setDefaultStyle(sp_name,si_name,sf_name,st_name,ss_name) {
  if (sp_name!="") { yx_sMenus[0].sPad=yx_getPad(sp_name); }
  if (si_name!="") { yx_sMenus[0].sItem=yx_getItem(si_name); }
  if (sf_name!="") { yx_sMenus[0].sFont=yx_getFont(sf_name); }
  if (st_name!="") { yx_sMenus[0].sTag=yx_getTag(st_name); }
  if (ss_name!="") { yx_sMenus[0].sSeparator=yx_getSeparator(ss_name); }
}

function yx_getPad(sp_name) { return yx_getOBJ(yx_sPads,sp_name); }
function yx_getItem(si_name) { return yx_getOBJ(yx_sItems,si_name); }
function yx_getFont(sf_name) { return yx_getOBJ(yx_sFonts,sf_name); }
function yx_getTag(st_name) { return yx_getOBJ(yx_sTags,st_name); }
function yx_getSeparator(ss_name) { return yx_getOBJ(yx_sSeparators,ss_name); }
function yx_getMenu(sm_name) { return yx_getOBJ(yx_sMenus,sm_name); }
function yx_findGroup(sg_name) { return yx_findOBJ(yx_sGroups,sg_name); }
function yx_findContent(c_name) { return yx_findOBJ(yxContent,c_name); }
function yx_findImage(i_name) { return yx_findOBJ(yxImages,i_name); }
function yx_findIcon(i_group) { return yx_findOBJ(yxIcons,i_group); }
function yx_findBGImage(i_name) { return yx_findOBJ(yxBGImages,i_name); }
function yx_findItemEvent(e_name) { return yx_findOBJ(yxICodes,e_name); }
function yx_findMenuEvent(e_name) { return yx_findOBJ(yxMCodes,e_name); }

function yx_mlOBJ(i_type,i_dis,i_msg,i_link,i_group) { this.type=i_type; this.dis=i_dis; this.msg=i_msg; this.link=i_link; this.group=i_group; }
function yx_mcOBJ(i_type,i_dis,i_msg,i_code,i_group) { this.type=i_type; this.dis=i_dis; this.msg=i_msg; this.code=i_code; this.group=i_group; }
function yx_miOBJ(i_type,i_dis,i_group) { this.type=i_type; this.dis=i_dis; this.group=i_group; }
function yx_msOBJ(i_type) { this.type=i_type; }

function yx_mmOBJ(i_type,i_dis,i_msg,i_link,sm_name,i_group) {
  var xMenu=yx_findMenu(sm_name);

  this.type=i_type;
  this.dis=i_dis; this.msg=i_msg; this.link=i_link;
  this.name=sm_name;
  this.group=i_group;

  this.items=xMenu==null?new Array():xMenu.menu.items;
  this.addM=yx_addM; this.addL=yx_addL; this.addC=yx_addC; this.addI=yx_addI; this.addS=yx_addS;
}

function yx_mOBJ(i_type,m_name) {
  this.type=i_type; this.dis="";
  this.name=m_name;

  this.items=new Array();
  this.addM=yx_addM; this.addL=yx_addL; this.addC=yx_addC; this.addI=yx_addI; this.addS=yx_addS;
}; var yxMenu=new Array();

function yx_mnOBJ(m_name,m_obj){ this.name=m_name; this.menu=m_obj; }; var yxName=new Array(), yxNx=null, yxContent=new Array();

function yx_addM(m_type,i_dis,i_msg,i_link,sm_name,i_group) {
  var items=this.items, x=items.length;
  items[x]=new yx_mmOBJ(m_type,i_dis,i_msg,i_link,sm_name,i_group);

  if (yx_findMenu(sm_name)==null) {
    yxName[yxName.length]=new yx_mnOBJ(sm_name,items[x]);
  }
}
function yx_addL(l_type,i_dis,i_msg,i_link,i_group) { this.items[this.items.length]=new yx_mlOBJ(l_type,i_dis,i_msg,i_link,i_group); }
function yx_addC(c_type,i_dis,i_msg,i_code,i_group) { this.items[this.items.length]=new yx_mcOBJ(c_type,i_dis,i_msg,i_code,i_group); }
function yx_addI(i_type,i_dis,i_group) { this.items[this.items.length]=new yx_miOBJ(i_type,i_dis,i_group); }
function yx_addS(s_type) { this.items[this.items.length]=new yx_msOBJ(s_type); }

function yx_findMenu(m_name) { return (yxNx!=null && yxNx.name==m_name)?yxNx:yx_findOBJ(yxName,m_name); }

function addMenu(c_name,m_name) {
  if (yx_goodM) {
    yx_showMsg("Parsing ["+m_name+"]");

    var x=yxMenu.length;
    yxMenu[x]=new yx_mOBJ(yx_Top,m_name);

    yxNx=new yx_mnOBJ(m_name,yxMenu[x]);
    yxName[yxName.length]=yxNx;

    yxContent[yxContent.length]=new yx_mnOBJ(c_name,yxMenu[x]);
  }
}

function _yx_addSubMenu_(m_type,m_name,i_dis,i_msg,i_link,sm_name,i_group) {
  if (yx_goodM) {
    yxNx=yx_findMenu(m_name);

    if (yxNx!=null) {
      yxNx.menu.addM(m_type,i_dis,i_msg,i_link,sm_name,i_group);
    }
    else {
      yx_goodM=false;
      yx_showMsg("Missing declaration of menu ["+m_name+"]");
    }
  }
}
function addSubMenu(m_name,i_dis,i_msg,i_link,sm_name,i_group) { _yx_addSubMenu_(yx_M,m_name,i_dis,i_msg,i_link,sm_name,i_group); }

function _yx_addLink_(l_type,m_name,i_dis,i_msg,i_link,i_group) {
  if (yx_goodM) {
    yxNx=yx_findMenu(m_name);

    if (yxNx!=null) {
      yxNx.menu.addL(l_type,i_dis,i_msg,i_link,i_group);
    }
    else {
      yx_goodM=false;
      yx_showMsg("Missing declaration of menu ["+m_name+"]");
    }
  }
}
function addLink(m_name,i_dis,i_msg,i_link,i_group) { _yx_addLink_(yx_L,m_name,i_dis,i_msg,i_link,i_group); }

function _yx_addCommand_(c_type,m_name,i_dis,i_msg,i_code,i_group) {
  if (yx_goodM) {
    yxNx=yx_findMenu(m_name);

    if (yxNx!=null) {
      yxNx.menu.addC(c_type,i_dis,i_msg,i_code,i_group);
    }
    else {
      yx_goodM=false;
      yx_showMsg("Missing declaration of menu ["+m_name+"]");
    }
  }
}
function addCommand(m_name,i_dis,i_msg,i_code,i_group) { _yx_addCommand_(yx_C,m_name,i_dis,i_msg,i_code,i_group); }

function addInfo(m_name,i_dis,i_group) {
  if (yx_goodM) {
    yxNx=yx_findMenu(m_name);

    if (yxNx!=null) {
      yxNx.menu.addI(yx_I,i_dis,i_group);
    }
    else {
      yx_goodM=false;
      yx_showMsg("Missing declaration of menu ["+m_name+"]");
    }
  }
}

function addSeparator(m_name) {
  if (yx_goodM) {
    yxNx=yx_findMenu(m_name);

    if (yxNx!=null) {
      yxNx.menu.addS(yx_S);
    }
    else {
      yx_goodM=false;
      yx_showMsg("Missing declaration of menu ["+m_name+"]");
    }
  }
}

function endMenu() { if (yx_goodM) { yx_showMsg(""); } }

function yx_imgOBJ(i_group,i_path,i_initial,i_swap,i_width,i_height,i_align,i_valign) {
  this.name=i_group;
  this.path=yx_getImgPath(i_path);
  this.initial=i_initial; this.swap=i_swap;
  this.width=i_width; this.height=i_height; this.align=i_align; this.vAlign=i_valign;
}; var yxImages=new Array(), yxIcons=new Array(), yxBGImages=new Array();

function setImage(i_group,i_path,i_initial,i_swap,i_width,i_height) {
  yxImages[yxImages.length]=new yx_imgOBJ(i_group,i_path,i_initial,i_swap,i_width,i_height,"","");
}; var addImage=setImage;

function setIcon(i_group,i_path,i_initial,i_swap,i_width,i_height,i_align,i_valign) {
  yxIcons[yxIcons.length]=new yx_imgOBJ(i_group,i_path,i_initial,i_swap,i_width,i_height,i_align,i_valign);
}; var appendImage=setIcon;

function setBGImage(i_group,i_path,i_initial,i_swap) {
  yxBGImages[yxBGImages.length]=new yx_imgOBJ(i_group,i_path,i_initial,i_swap,1,1,"","");
}

function yx_toHex(num) {
  var hexStr="0123456789ABCDEF", num2=num%16, num1=(num-num2)/16;
  return hexStr.charAt(num1)+hexStr.charAt(num2);
}

function yx_toTen(num) {
  var hexStr="0123456789ABCDEF";
  return hexStr.indexOf(num.toUpperCase());
}

function yx_fromHex(num) {
  var char1=num.charAt(0), char2=num.charAt(1);
  return yx_toTen(char1)*16+yx_toTen(char2);
}

function yx_getColor(color,m) {
  var red=color.substring(1,3), green=color.substring(3,5), blue=color.substring(5,7);
  var num1=yx_fromHex(red)+m*51, num2=yx_fromHex(green)+m*51, num3=yx_fromHex(blue)+m*51;
  if (num1<0) { num1=0; }
  if (num1>255) { num1=255; }
  if (num2<0) { num2=0; }
  if (num2>255) { num2=255; }
  if (num3<0) { num3=0; }
  if (num3>255) { num3=255; }
  return "#"+yx_toHex(num1)+yx_toHex(num2)+yx_toHex(num3);
}

function yx_getStyle() {
  if (this.head.style!=null) {
    var styles=this.head.style.member;
    for (var i=0; i<styles.length; i++) {
      if (styles[i].menu==this.content.name) {
        this.style=yx_getMenu(styles[i].style);
        return;
      }
    }
  }
  this.style=yx_sMenus[0];
}

function yx_getItemStyle(lead) {
  if (this.content.group!="" && lead.head.style!=null) {
    var styles=lead.head.style.member;
    for (var i=0; i<styles.length; i++) {
      if (styles[i].menu==this.content.group) {
        return yx_getMenu(styles[i].style);
      }
    }
  }
  return lead.style;
}

function yx_xyObj(x,y) { this.x=x; this.y=y; }
function yx_getSlot(n) {
  yx_getDim();
  var x=(n==0 || n==6 || n==7)?0:((n==1 || n==5 || n== 8)?Math.round(yx_wW/2):(yx_wW-1));
  var y=(n==0 || n==1 || n==2)?0:((n==3 || n==7 || n== 8)?Math.round(yx_wH/2):(yx_wH-1));
  return (new yx_xyObj(x,y));
}

function yx_findIns(name,mode) {
  var ins=yx_findOBJ(yxIns, name);
  return mode?((ins!=null && ins.menu!=null && ins.menu.ready)?ins:null):ins;
}

function yx_closeIns(ins) {
  for (var i=0; i<yxIns.length; i++) {
    if (yxIns[i].menu.shown && yxIns[i]!=ins) yxIns[i].hideIns();
  }
}

function yx_setIdx(ins,idx) { ins.z=idx; yx_setZIndex(ins.menu.holder,idx); }

function addInstance(i_name,i_menu,para) {
  if (yx_goodI) {
    var content=yx_findContent(i_menu);
    if (content!=null) {
      //yx_showMsg("Adding menu ["+i_name+"]");

      var newIns=yx_findIns(i_name,false);
      if (newIns==null) {
        newIns=new yx_insOBJ(i_name,content.menu,para);
        yxIns[yxIns.length]=newIns;
      }

     // yx_showMsg("Menu Instance ["+i_name+"] enabled");
    }
    else {
      yx_goodI=false;
     // yx_showMsg("Menu content not found: ["+i_menu+"]");
    }
  }
}

function yx_eventOBJ(e_name,e_handler1,e_handler2) {
  this.name=e_name;
  this.code1=e_handler1; this.code2=e_handler2;
}; var yxICodes=new Array(), yxMCodes=new Array();

function yx_dimOBJ(x,y,width,height,scrollx,scrolly) {
  this.x=x; this.y=y; this.width=width; this.height=height; this.scrollx=scrollx; this.scrolly=scrolly;
}

function yx_getDim() { yx_sX=yx_getScrollX(); yx_sY=yx_getScrollY(); yx_wW=yx_getWinWidth(); yx_wH=yx_getWinHeight(); }

function yx_getPos(mode) {
  var head=this.head, pItem=this.lead, pMenu=pItem.lead, sPad=this.style.sPad, sW=sPad.bSize+sPad.sWidth, sH=sPad.bSize+sPad.sHeight;
  var x_align=head.xAlign, y_align=head.yAlign, dir=pMenu==null?"":(pMenu.lead==head || pMenu.style.sPad.dir=="")?(head.dir):(pMenu.style.sPad.dir);

  yx_getDim();

  var padX=0, padY=0;
  if (pItem==head) {
    if (x_align=="left") {
      padX=0;
    }
    else if (x_align=="center") {
      padX=-Math.round(this.width/2);
    }
    else {
      padX=-this.width+1;
    }

    if (y_align=="top") {
      padY=0;
    }
    else if (y_align=="middle") {
      padY=-Math.round(this.height/2);
    }
    else {
      padY=-this.height+1;
    }

    padX+=head.holder.x; padY+=head.holder.y;
    if (head.pos=="slot") { padX+=yx_sX; padY+=yx_sY; }
  }
  else if (pMenu.bar) {
    var iX=pMenu.x+pItem.x, iY=pMenu.y+pItem.y, iW=pItem.width, iH=pItem.height;

    if (dir.indexOf("down")!=-1) {
      padY=iY+iH;
    }
    else if (dir.indexOf("up")!=-1) {
      padY=iY-this.height;
    }
    else {
      padY=iY+iH;
    }

    if (dir.indexOf("center")!=-1) {
      padX=pMenu.x+Math.round((pMenu.width-this.width)/2);
    }
    else if (dir.indexOf("abs-left")!=-1) {
      padX=pMenu.x;
    }
    else if (dir.indexOf("abs-right")!=-1) {
      padX=pMenu.x+pMenu.width-this.width;
    }
    else if (dir.indexOf("right")!=-1) {
      padX=iX-sW;
    }
    else if (dir.indexOf("left")!=-1) {
      padX=iX+iW-this.width+sW;
    }
    else {
      padX=iX-sW;
    }
  }
  else {
    var iX=pMenu.x+pItem.x, iY=pMenu.y+pItem.y, iW=pItem.width, iH=pItem.height;

    if (dir.indexOf("right")!=-1) {
      padX=iX+iW;
    }
    else if (dir.indexOf("left")!=-1) {
      padX=iX-this.width
    }
    else {
      padX=iX+iW;
    }

    if (dir.indexOf("down")!=-1) {
      padY=iY-sH;
    }
    else if (dir.indexOf("up")!=-1) {
      padY=iY+iH-this.height+sH;
    }
    else if (dir.indexOf("top")!=-1) {
      padY=pMenu.y;
    }
    else if (dir.indexOf("bottom")!=-1) {
      padY=pMenu.y+pMenu.height-this.height;
    }
    else if (dir.indexOf("middle")!=-1) {
      padY=pMenu.y+Math.round((pMenu.height-this.height)/2);
    }
    else {
      padY=iY-sH;
    }
  }

  if (pItem!=head) {
    padX+=sPad.dx; padY+=sPad.dy;

    var padTop=padY, padBottom=padTop+this.height-1, padLeft=padX, padRight=padLeft+this.width-1;
    var dx=0, dy=0;

    if (padBottom-yx_sY>=yx_wH) { dy=yx_wH+yx_sY-padBottom-1-yx_BM; }
    if (padTop+dy<yx_sY) { dy=yx_sY-padTop+yx_BM; }
  
    if (padRight-yx_sX>=yx_wW && !pMenu.bar) {
      dx=-this.width-pItem.width;
      padRight+=dx;
    }
    if (padRight-yx_sX>=yx_wW) { dx=yx_wW+yx_sX-padRight-1-yx_BM; }
    if (padLeft+dx<yx_sX) { dx=yx_sX-padLeft+yx_BM; }
  
    padX+=dx; padY+=dy;
  }

  this.movMenuTo(padX,padY);

  if (mode && !this.shown && (pMenu==null || pMenu.active==pItem)) {
    if (pMenu!=null) {
      yx_setZIndex(this.holder, yx_getZIndex(pMenu.holder)+1);
    }
    else {
      yx_setZIndex(this.holder, ++zBase);
    }

    yx_showLayer(this.holder); this.shown=true;

    if (this.code1!="") { eval(this.code1); }
  }

  if (pItem==head && head.floating && head.timer<0) { head.timeIt(); }
}

function yx_showM() {
  this.go=true;

  if (this.ready) {
    this.getPos(true);
    if (!this.head.highlight) { this.blurM(); }
  }
  else {
    if (!this.flying) {
      this.flying=true;
      yx_callBack(this,"makeM","()",0);
    }
  }
}

function yx_blurM() {
  this.open=false;
  if (this.active!=null) { this.active.offIt(); this.active=null; }

  for (var i=0; i<this.itemL; i++) {
    if (this.items[i].menu!=null) { this.items[i].menu.hideM(true); }
  }
}

function yx_hideM(mode) {
  this.go=false;

  if (this.shown) {
    this.blurM();

    if (this.lead!=this.head || (mode && !this.head.vis)) {
      yx_hideLayer(this.holder); this.shown=false;
      if (this.code2!="") { eval(this.code2); }
    }

    if (this.lead!=this.head) { this.lead.offIt(); }
  }
}

function yx_getDX(mx,ix,dis,mw,iw) {
  var dx=0;
  if (mx+ix<yx_sX || mx+ix-dis-iw<yx_sX && mx<yx_sX) {
    dx=iw;
  }
  else if (mx+ix+iw-yx_sX>yx_wW || mx+ix+iw+dis+iw-yx_sX>yx_wW && mx+mw-yx_sX>yx_wW) {
    dx=-iw;
  }
  return dx;
}
function yx_getDY(my,iy,dis,mh,ih) {
  var dy=0;
  if (my+iy<yx_sY || my+iy-dis-ih<yx_sY && my<yx_sY) {
    dy=ih;
  }
  else if (my+iy+ih-yx_sY>yx_wH || my+iy+ih+dis+ih-yx_sY>yx_wH && my+mh-yx_sY>yx_wH) {
    dy=-ih;
  }
  return dy;
}

function yx_movMenuTo(x,y) { yx_moveLayerTo(this.holder,x,y); this.x=x; this.y=y; }
function yx_movMenuBy(x,y) { yx_moveLayerBy(this.holder,x,y); this.x+=x; this.y+=y; }
function yx_scrollIt(dx,dy) {
  var done=true;

  if (dx>0 && this.x+dx>=yx_sX) {
    dx=yx_sX-this.x;
  }
  else if (dx<0 && this.x+this.width-yx_sX+dx<=yx_wW) {
    dx=yx_wW+yx_sX-this.x-this.width;
  }
  else if (dy>0 && this.y+dy>=yx_sY) {
    dy=yx_sY-this.y;
  }
  else if (dy<0 && this.y+this.height-yx_sY+dy<=yx_wH) {
    dy=yx_wH+yx_sY-this.y-this.height;
  }
  else {
    done=false;
  }

  this.movMenuBy(dx,dy);

  if (!done) {
    yx_sTimer=yx_callBack(this,"scrollIt","("+dx+","+dy+")",floatTimer);
  }
}

function yx_itemOBJ(lead,content) {
  this.lead=lead; this.content=content;

  this.item=null; this.cover=null;
  this.img=null; this.tag=null; this.icon=null;

  this.menu=null; 

  this.x=0; this.y=0; this.width=0; this.height=0;
  this.code1=""; this.code2="";

  this.makeI=yx_makeI; this.makeS=yx_makeS; this.makeC=yx_makeC; this.onIt=yx_onIt; this.offIt=yx_offIt;
  this.getItemStyle=yx_getItemStyle;
}

function yx_menuOBJ(head,lead,content) {
  this.head=head; this.lead=lead; this.content=content;

  this.holder=null; this.pad=null; this.active=null;
  this.padB=null; this.padC=null; this.me=-1;

  this.itemL=content.items.length; this.items=new Array();

  this.ready=false; this.flying=false; this.go=false; this.shown=false; this.open=false;

  this.x=0; this.y=0; this.width=0; this.height=0; this.getPos=yx_getPos;
  this.code1=""; this.code2="";

  this.style=null; this.getStyle=yx_getStyle;

  this.makeP=yx_makeP; this.makeM=yx_makeM; this.showM=yx_showM; this.hideM=yx_hideM; this.blurM=yx_blurM; this.movMenuTo=yx_movMenuTo; this.movMenuBy=yx_movMenuBy;
  this.scrollIt=yx_scrollIt; this.bar=false;
}

function yx_insOBJ(i_name,i_content,para) {
  this.name=i_name; this.content=i_content;

  this.floating=(para.search(/floating\s*:\s*yes/)!=-1);

  var ra=para.match(/position\s*:\s*(absolute|relative|slot)(\s+([\w\-]+))?(\s+([\w\-]+))?/);
  this.pos=(ra && ra[1])?ra[1]:"absolute";
  this.ref=(ra && ra[3])?ra[3]:"";
  this.ref2=(ra && ra[5])?ra[5]:"";

  this.xAlign=para.search(/align\s*:\s*(left|center|right)/)!=-1?(RegExp.$1):"left";
  this.yAlign=para.search(/valign\s*:\s*(top|middle|bottom)/)!=-1?(RegExp.$1):"top";

  this.dx=para.search(/offset-left\s*:\s*(\-?\d+)/)!=-1?(RegExp.$1-0):0;
  this.dy=para.search(/offset-top\s*:\s*(\-?\d+)/)!=-1?(RegExp.$1-0):0;

  this.bar=(para.search(/menu-form\s*:\s*bar/)!=-1);
  this.dir=para.search(/direction\s*:\s*(right-down|right-up|left-down|left-up|center-down|center-up|abs-right-down|abs-right-up|abs-left-down|abs-left-up|right-top|left-top|right-middle|left-middle|right-bottom|left-bottom)/)!=-1?(RegExp.$1):"right-down";

  this.vis=(para.search(/visibility\s*:\s*hidden/)==-1);

  this.target=para.search(/target\s*:\s*([\w\-]+)/)!=-1?(RegExp.$1):"";

  this.style=yx_findGroup(para.search(/style\s*:\s*([\w\-\s]+)/)!=-1?(RegExp.$1):"");

  this.sticky=(para.search(/sticky\s*:\s*yes/)!=-1);
  this.highlight=(para.search(/highlight\s*:\s*no/)==-1);

  this.ox=0; this.oy=0;

  this.lead=null; this.head=this;
  this.menu=new yx_menuOBJ(this,this,this.content);

  this.timer=-1; this.timeIt=yx_timeIt; this.sX=0; this.sY=0; this.z=zBase-1;
  this.holder=null; this.getHolder=yx_getHolder;

  this.showIns=yx_showIns; this.hideIns=yx_hideIns; this.movInsTo=yx_movInsTo; this.movInsBy=yx_movInsBy;
}

function yx_showIns() {
  if (this.holder==null) { this.getHolder(); }
  yx_closeIns(this); this.menu.showM();
}
function yx_hideIns() { this.menu.hideM(true); }
function yx_movInsTo(x,y) {
  if (this.menu.ready) {
    this.holder.x=x; this.holder.y=y;
    this.menu.hideM(false); this.menu.getPos(false);
  }
}
function yx_movInsBy(x,y) {
  if (this.menu.ready) {
    this.holder.x+=x; this.holder.y+=y;
    this.menu.hideM(false); this.menu.movMenuBy(x,y);
  }
}

function yx_timeIt() {
  yx_getDim();

  if (this.sX!=yx_sX || this.sY!=yx_sY) {
    var dx=Math.ceil((yx_sX-this.sX)/floatOffset), dy=Math.ceil((yx_sY-this.sY)/floatOffset); this.sX+=dx; this.sY+=dy;
    this.movInsBy(dx,dy);
  }

  this.timer=yx_callBack(this,"timeIt","()",floatTimer);
}

function yx_overOther() { yx_stopAll(); }
function yx_outOther() { yx_stopAll(); if (!this.sticky) yx_setIt(); }
function yx_clickOther() { yx_stopEvent(); }

function yx_markIt() {
  var item=this.item, menu=item.lead, prep=menu.active, sItem=item.styleI.sItem, sFont=item.styleI.sFont;
  var type=item.content.type, isSub=(type==yx_M), iis=item.item.style;

  if (prep!=null && prep!=item) { prep.offIt(); }
  menu.active=item;

  iis.color=(isSub && menu.open && sFont.fColorC!="")?sFont.fColorC:sFont.fColorH;
  iis.backgroundColor=(isSub && menu.open && sItem.iColorC!="none")?sItem.iColorC:sItem.iColorH;
  iis.fontWeight=sFont.fWeightH; iis.fontStyle=sFont.fStyleH; iis.textDecoration=sFont.textH;
  if (sItem.bSize>0) { iis.borderColor=(isSub && menu.open && sItem.bStyleC!="" && sItem.bColorC!="")?(sItem.bColorCT+" "+sItem.bColorCR+" "+sItem.bColorCB+" "+sItem.bColorCL):(sItem.bColorHT+" "+sItem.bColorHR+" "+sItem.bColorHB+" "+sItem.bColorHL); }

  if (item.imgBG1!="") { iis.backgroundImage=item.imgBG1; }
  if (item.img!=null && item.img.src.indexOf(item.img1)==-1) { item.img.src=item.img1; }
  if (item.icon!=null && item.icon.src.indexOf(item.icon1)==-1) { item.icon.src=item.icon1; }
  if (item.tag!=null && item.tag.src.indexOf(item.tag1)==-1) { item.tag.src=item.tag1; }
}

function yx_upIt(it) {
  var x=it.lead.lead;
  if (x.lead!=null) { x.cover.markIt(); yx_upIt(x); }
}

function yx_downIt(it) {
  var x=it.menu;
  if (x!=null && x.shown) {
    for (var i=0; i<x.itemL; i++) {
      if (x.items[i].menu!=null && x.items[i].menu.shown) {
        x.items[i].cover.markIt(); yx_downIt(x.items[i]);
        break;
      }
    }
  }
}

function yx_onIt() {
  var type=this.content.type, menu=this.lead;

  yx_closeIns(menu.head);
  if (menu.head.z<zBase) { yx_setIdx(menu.head,++zBase); }

  for (var i=0; i<menu.itemL; i++) {
    if (menu.items[i]!=this && menu.items[i].menu!=null) {
      menu.items[i].menu.hideM(true);
    }
  }

  if (this.code1!="") { eval(this.code1); }

  var sPad=menu.style.sPad;
  var dx=!sPad.scroll?0:menu.bar?yx_getDX(menu.x,this.x,sPad.iOff,menu.width,this.width):0, dy=!sPad.scroll?0:menu.bar?0:yx_getDY(menu.y,this.y,sPad.iOff,menu.height,this.height);
  if (dx!=0 || dy!=0) {
    yx_sTimer=yx_callBack(menu,"scrollIt","("+dx+","+dy+")",menuTimer);
  }
  else if (type==yx_M) {
    if (this.styleI.sItem.onOver || menu.open) { this.menu.showM(); }
  }
}

function yx_offIt() {
  var item=this.item, sItem=this.styleI.sItem, sFont=this.styleI.sFont, is=item.style;

  is.color=sFont.fColorN; is.backgroundColor=sItem.iColorN;
  is.fontWeight=sFont.fWeightN; is.fontStyle=sFont.fStyleN; is.textDecoration=sFont.textN;
  if (sItem.bSize>0) { is.borderColor=sItem.bColorNT+" "+sItem.bColorNR+" "+sItem.bColorNB+" "+sItem.bColorNL; }

  if (this.imgBG0!="") { is.backgroundImage=this.imgBG0; }
  if (this.img!=null && this.img.src.indexOf(this.img0)==-1) { this.img.src=this.img0; }
  if (this.icon!=null && this.icon.src.indexOf(this.icon0)==-1) { this.icon.src=this.icon0; }
  if (this.tag!=null && this.tag.src.indexOf(this.tag0)==-1) { this.tag.src=this.tag0; }
}

function yx_overItem() {
  var item=this.item, menu=item.lead;

  yx_stopAll();
  yx_showMsg(item.content.msg);

  this.markIt(); yx_upIt(item); yx_downIt(item);

  yx_iTimer=yx_callBack(item,"onIt","()",(menu.bar?menuTimerBar:menuTimer));
}

function yx_outItem() {
  yx_stopAll();
  if (this.item.code2!="") { eval(this.item.code2); }
  if (!this.sticky) { yx_setIt(); }
}

function yx_getHolder() {
  var x=0, y=0;
  if (this.pos=="relative") {
    var l=yx_findLayer(this.ref);
    if (l!=null) {
      x=yx_getLeft(l); y=yx_getTop(l); 
    }
  }
  else if (this.pos=="slot") {
    var s=yx_getSlot(parseInt(this.ref));
    x=s.x; y=s.y;
  }

  x+=this.dx; y+=this.dy; this.ox=x; this.oy=y;
  this.holder=new yx_xyObj(x,y);
}
// ------

function getMenuDim(i_name) {
  var ins=yx_findIns(i_name,true);
  if (ins!=null) {
    return new yx_dimOBJ(ins.menu.x, ins.menu.y, ins.menu.width, ins.menu.height, yx_getScrollX(), yx_getScrollY());
  }
  else {
    return null;
  }
}

function showMenu(n) {
  var ins=yx_findIns(n,false);
  if (ins!=null) {
    yx_stopAll();
    ins.showIns();
  }
}

function showMenuX(n) {
  var ins=yx_findIns(n,false);
  if (ins!=null) {
    yx_stopAll();
    ins.vis=true; ins.showIns();
  }
}

function hideMenu(n) {
  var ins=yx_findIns(n,true);
  if (ins!=null) { ins.hideIns(); }
}

function hideMenuX(n) {
  var ins=yx_findIns(n,true);
  if (ins!=null) { ins.vis=false; ins.hideIns(); }
}

function moveMenuTo(n,x,y) {
  var ins=yx_findIns(n,true);
  if (ins!=null) { ins.movInsTo(x,y); }
}

function moveMenuBy(n,x,y) {
  var ins=yx_findIns(n,true);
  if (ins!=null) { ins.movInsBy(x,y); }
}

function moveMenuBack(n) {
  var ins=yx_findIns(n,true);
  if (ins!=null) { ins.movInsTo(ins.ox,ins.oy); }
}

function addItemEvent(e_name,e_handler1,e_handler2) {
  var x=yx_findItemEvent(e_name);
  if (x==null) { yxICodes[yxICodes.length]=new yx_eventOBJ(e_name,e_handler1,e_handler2); }
}

function addMenuEvent(e_name,e_handler1,e_handler2) {
  var x=yx_findMenuEvent(e_name);
  if (x==null) { yxMCodes[yxMCodes.length]=new yx_eventOBJ(e_name,e_handler1,e_handler2); }
}

function addWindowEvent(e_handler) { yx_winEvent=e_handler; }

function openMenu(n) { yx_stopAll(); showMenu(n); }
function openMenuX(n) { yx_stopAll(); showMenuX(n); }
function closeMenu() { yx_stopAll(); yx_setIt(); }
function closeMenuX(n) {
  var ins=yx_findIns(n,true);
  if (ins!=null) { ins.vis=false; }
  closeMenu();
}
function clickMenu(n) { yx_stopEvent(); openMenu(n); }
function clickMenuX(n) { yx_stopEvent(); openMenuX(n); }
// ------

if (yx_menuSafe) {
  var yx_menuScript=scriptPath+(yx_isN6?"menuG4N6.js":yx_isN4?"menuG4N4.js":yx_isK3?"menuG4K3.js":yx_isO7?"menuG4O7.js":yx_isIE5?"menuG4IE5.js":"menuG4IE4.js");
  document.write("<scr"+"ipt language='javascript' src='"+yx_menuScript+"' type='text/javascript'><\/scr" + "ipt>");
  if (contentScript!="") {
    document.write("<scr"+"ipt language='javascript' src='"+contentScript+"' type='text/javascript'><\/scr" + "ipt>");
  }
  if (styleScript!="") {
    document.write("<scr"+"ipt language='javascript' src='"+styleScript+"' type='text/javascript'><\/scr" + "ipt>");
  }
  if (instanceScript!="") {
    document.write("<scr"+"ipt language='javascript' src='"+instanceScript+"' type='text/javascript'><\/scr" + "ipt>");
  }
}
else if (nonMenuPage!="") {
  setTimeout("window.location.replace('"+nonMenuPage+"')",0);
}
