// Menu G5.2.10 (non-frame/loader)
// Last Modified: 10-Dec-2003
// Web Site: yxScripts.com
// Email: m_yangxin@hotmail.com

// Copyright 2003  Xin Yang   All Rights Reserved.

// ------
var _scriptPath="http://www.yxScripts.com/menuG5/script/";
var _menuTimer=500;
var _floatTimer=100;
var _floatOffset=1;
var _zBase=2;
var _menuMargin=1;
// ------

Object.prototype.copy=function() {var o=new Object(); for (var i in this) { o[i]=typeof(this[i])=='object'?this[i].copy():this[i]; } return o; }
Array.prototype.copy=function() {var a=new Array(); for (var i in this) { a[i]=typeof(this[i])=='object'?this[i].copy():this[i]; } return a; }

var yx_navigator=navigator.userAgent.toLowerCase();
var yx_isMac=(yx_navigator.indexOf("mac")!=-1);
var yx_isOpera=(yx_navigator.indexOf("opera")!=-1);
var yx_isOpera7=(yx_navigator.indexOf("opera 7")!=-1);
var yx_isSafari=(yx_navigator.indexOf("safari")!=-1);
var yx_isIE=(yx_navigator.indexOf("msie")!=-1 && !yx_isOpera && !yx_isSafari);
var yx_isIE5=(yx_isIE && yx_navigator.indexOf("msie 4")==-1);
var yx_isGecko=(yx_navigator.indexOf("gecko")!=-1);

var yx_menuSafe=(yx_isGecko || yx_isOpera7 || yx_isIE5 && !yx_isMac);

if (typeof(webPath)=="undefined") { webPath=""; }
if (typeof(scriptPath)=="undefined") { scriptPath=_scriptPath; }
if (typeof(menuTimer)=="undefined") { menuTimer=_menuTimer; }
if (typeof(floatTimer)=="undefined") { floatTimer=_floatTimer; }
if (typeof(floatOffset)=="undefined") { floatOffset=_floatOffset; }
if (typeof(zBase)=="undefined") { zBase=_zBase; }
if (typeof(menuMargin)=="undefined") { menuMargin=_menuMargin; }

var yx_M="M", yx_L="L", yx_C="C", yx_I="I", yx_S="S";
var yx_goodContent=true, yx_winEvent="", yx_loaded=false, yx_curTop=null, yx_curSub=null;
var yx_callBackCounter=0, yx_callBacks=new Array();
var yx_onItemTimer=0, yx_offItemTimer=0, yx_scrollingTimer=0, yx_edgeMargin=menuMargin, yx_scrollingLeft=0, yx_scrollingTop=0, yx_winWidth=0, yx_winHeight=0;
var yx_pixelGIF=new Image(1,1); yx_pixelGIF.src=scriptPath+"onePixel.gif";
var yx_pathRE=/(^\w+:)|(^\/)|(^\.)/, yx_cssRE=/css\s*:([\w\-\s]+)(,([\w\-\s]+))?(,([\w\-\s]+))?(,([\w\-\s]+))?/;

function yx_newElement(tag) { return document.createElement(tag); }
function yx_newIMG(_src,w,h,_align) {
  var xx=yx_newElement("IMG");
  with (xx) { src=_src; width=w; height=h; border=0; hspace=0; vspace=0; align=_align; }
  return xx;
}
function yx_newLayer(x,y,h,vis,idx) {
  var xx=yx_newElement("DIV"), _h=h==null?document.body:h;
  with (xx.style) { position="absolute"; visibility=vis; left=x+"px"; top=y+"px"; zIndex=idx; }
  return _h.appendChild(xx);
}

function yx_findLayer(n) { return document.getElementById(n); }
function yx_setZIndex(l,idx) { l.style.zIndex=idx; }
function yx_getZIndex(l) { return l.style.zIndex; }
function yx_showLayer(l) { l.style.visibility="visible"; }
function yx_hideLayer(l) { l.style.visibility="hidden"; }
function yx_moveLayerTo(l,x,y) { l.style.left=x+"px"; l.style.top=y+"px"; }
function yx_moveLayerBy(l,x,y) { l.style.left=(parseInt(l.style.left)+x)+"px"; l.style.top=(parseInt(l.style.top)+y)+"px"; }
function yx_getLeft(l) { return l.offsetLeft+(l.offsetParent?yx_getLeft(l.offsetParent):0); }
function yx_getTop(l) { return l.offsetTop+(l.offsetParent?yx_getTop(l.offsetParent):0); }

function yx_downItem() {
  var item=this.item, si=item.styleI;

  yx_stopEvent(); yx_stopIt(yx_scrollingTimer); yx_scrollingTimer=0;
  if (si.sItem.onOver || item.content.type!=yx_M) { yx_setCSS(item,si.sItem.cssM,si.sTag.cssM,si.sIcon.cssM,si.sFont.cssM,false,si.sItem.xAlign,si.sItem.yAlign); }
}

function yx_clickItem() {
  var item=this.item, content=item.content, type=content.type, menu=item.lead;

  yx_stopEvent();
  if (type==yx_M || type==yx_L) {
    if (!item.styleI.sItem.onOver && type==yx_M) {
      if (item.menu.shown) {
        item.menu.hideM(false); menu.open=false; this.markIt(0);
      }
      else if (!item.menu.go) {
        menu.open=true; yx_stopIt(yx_onItemTimer); yx_onItemTimer=yx_callBack(item,"onIt","()",0);
      }
    }
    else if (content.link!="") {
      yx_closeIns(null); yx_goLink(content.link,menu.head.target);
    }
  }
  else if (content.code!="") {
    yx_closeIns(null); eval(content.code);
  }
}

function yx_makeC() {
  var lead=this.lead, head=lead.head, content=this.content, type=content.type;

  if (type!=yx_I) {
    var c=yx_newIMG(yx_pixelGIF.src,this.width,this.height,"top");
    with (c.style) { position="absolute"; left=this.x+"px"; top=this.y+"px"; zIndex=3; }
    lead.holder.appendChild(c);

    if (type==yx_S) {
      c.onmouseover=yx_overOther; c.onmouseout=yx_outOther; c.onclick=yx_clickOther;
    }
    else {
      c.onmouseover=yx_overItem; c.onmouseout=yx_outItem; c.onmousedown=yx_downItem; c.onclick=yx_clickItem;
      c.markIt=yx_markIt; c.item=this;
      if (this.styleI.sItem.cursor!="") { c.className=this.styleI.sItem.cursor; }
      if (this.content.msg!="" && this.content.msg.charAt(0)!=" ") { c.title=this.content.msg; }
    }
    c.sticky=head.sticky; c.item=this; this.cover=c;
  }
  else {
    this.item.onmouseover=yx_overOther; this.item.onmouseout=yx_outOther; this.item.sticky=head.sticky;
  }

  var ee=yx_findItemEvent(content.group);
  if (ee!=null) { this.code1=ee.code1; this.code2=ee.code2; }

  if (type==yx_M) { this.menu=new yx_menuOBJ(head,this,content); }
}

function yx_itemWidth(item) { return item.dis.offsetWidth+(item.tag!=null?item.tag.offsetWidth:0)+(item.icon!=null?item.icon.offsetWidth:0); }

function yx_setIt() { yx_offItemTimer=setTimeout("yx_closeIns(null)",menuTimer*2); }
function yx_stopIt(t) { if (t>0) clearTimeout(t); }
function yx_stopAll() { yx_stopIt(yx_onItemTimer); yx_onItemTimer=0; yx_stopIt(yx_offItemTimer); yx_offItemTimer=0; yx_stopIt(yx_scrollingTimer); yx_scrollingTimer=0; }
function yx_getPath(path) { return yx_pathRE.test(path)?path:(webPath+path); }
function yx_showMsg(msg) { window.status=msg; }
function yx_callBack(obj,func,para,t) {
  var x=yx_callBackCounter++; yx_callBacks[x]=obj;
  var tm=setTimeout(("yx_callBacks["+x+"]."+func+para),t);
  if (yx_callBackCounter>200) { yx_callBackCounter=0; }
  return tm;
}
function yx_goLink(link,ft) {
	if (typeof(targetFrame)!="undefined") {
				targetFrms = document.getElementsByTagName('iframe');
				for (i=0;i<targetFrms.length;i++) {
					if (targetFrms[i].name==targetFrame) { targetFrm=targetFrms[i];	}
				}
	      if (typeof(targetFrm)!="undefined") { targetFrm.src=yx_getPath(link); }
	     		else { alert('Nenalezen iframe :'+targetFrame); }
	      return;
	}

  if (link.substring(0,11).toLowerCase()=="javascript:") {
    eval(link.substring(11));
  } else {
    if (ft!="") {
      window.open(yx_getPath(link),ft);
    }
    else {
      window.location.href=yx_getPath(link);
    }
  }
}

function yx_findOBJ(obj,n) {
  for (var i=0; i<obj.length; i++) { if (obj[i].name==n) { return obj[i]; } }
  return null;
}
function yx_getOBJ(obj,n) {
  for (var i=0; i<obj.length; i++) { if (obj[i].name==n) { return obj[i]; } }
  return obj[0];
}

function yx_trim(str) { return (str.replace(/^\s+/,"")).replace(/\s$/,""); }
function yx_getCSS(para) {
  var ra=para.match(yx_cssRE), pa=new Array();
  pa[0]=(ra && ra[1])?yx_trim(ra[1]):""; pa[1]=(ra && ra[3])?yx_trim(ra[3]):pa[0]; pa[2]=(ra && ra[5])?yx_trim(ra[5]):pa[1]; pa[3]=(ra && ra[7])?yx_trim(ra[7]):pa[1];
  return pa;
}

function yx_stylePadOBJ(sp,para) {
  this.name=sp;

  this.cssN=para.search(/pad-css\s*:([\w\-\s]+)/)!=-1?yx_trim(RegExp.$1):"";
  this.hcssN=para.search(/holder-css\s*:([\w\-\s]+)/)!=-1?yx_trim(RegExp.$1):"";

  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|abs-center-up|abs-center-down|right-top|left-top|right-middle|left-middle|right-bottom|left-bottom)/)!=-1?(RegExp.$1):"";

  this.scroll=para.search(/scroll\s*:\s*(both|x-only|y-only|none)/)!=-1?(RegExp.$1):"none";
  this.step=para.search(/step\s*:\s*(\d+)/)!=-1?(RegExp.$1-0):0;
  this.flip=(para.search(/flip\s*:\s*no/)==-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;
}; var yx_stylePads=new Array(new yx_stylePadOBJ("",""));

function yx_styleItemOBJ(si,para) {
  this.name=si;

  var pa=yx_getCSS(para);
  this.cssN=pa[0]; this.cssH=pa[1]; this.cssM=pa[2]; this.cssS=pa[3];
  this.cursor=para.search(/cursor\s*:([\w\-\s]+)/)!=-1?yx_trim(RegExp.$1):"";

  this.xAlign=para.search(/align\s*:\s*(left|center|right)/)!=-1?(RegExp.$1):"center";
  this.yAlign=para.search(/valign\s*:\s*(top|middle|bottom)/)!=-1?(RegExp.$1):"middle";
  this.actual=(para.search(/width\s*:\s*actual/)!=-1);
  this.onOver=(para.search(/sub-menu\s*:\s*mouse-click/)==-1);
}; var yx_styleItems=new Array(new yx_styleItemOBJ("","width:actual;"));

function yx_styleFontOBJ(sf,para) {
  this.name=sf;

  var pa=yx_getCSS(para);
  this.cssN=pa[0]; this.cssH=pa[1]; this.cssM=pa[2]; this.cssS=pa[3];
}; var yx_styleFonts=new Array(new yx_styleFontOBJ("",""));

function yx_styleTagOBJ(st,para) {
  this.name=st;

  var pa=yx_getCSS(para);
  this.cssN=pa[0]; this.cssH=pa[1]; this.cssM=pa[2]; this.cssS=pa[3];
}; var yx_styleTags=new Array(new yx_styleTagOBJ("",""));

function yx_styleIconOBJ(so,para) {
  this.name=so;

  var pa=yx_getCSS(para);
  this.cssN=pa[0]; this.cssH=pa[1]; this.cssM=pa[2]; this.cssS=pa[3];
}; var yx_styleIcons=new Array(new yx_styleIconOBJ("",""));

function yx_styleSeparatorOBJ(ss,para) {
  this.name=ss;

  var ra=para.match(/css\s*:([\w\-\s]+)(,([\w\-\s]+))?/);
  this.cssTL=(ra && ra[1])?yx_trim(ra[1]):""; this.cssBR=(ra && ra[3])?yx_trim(ra[3]):"";
}; var yx_styleSeparators=new Array(new yx_styleSeparatorOBJ("",""));

function yx_styleMenuOBJ(sm,sp,si,sf,st,so,ss) {
  this.name=sm;

  this.sPad=yx_getPad(sp); this.sItem=yx_getItem(si); this.sFont=yx_getFont(sf); this.sTag=yx_getTag(st); this.sIcon=yx_getIcon(so); this.sSeparator=yx_getSeparator(ss);
}; var yx_styleMenus=new Array(new yx_styleMenuOBJ("", "", "", "", "", "",""));

function addStylePad(sp,para) { yx_stylePads[yx_stylePads.length]=new yx_stylePadOBJ(sp,para); }
function addStyleItem(si,para) { yx_styleItems[yx_styleItems.length]=new yx_styleItemOBJ(si,para); }
function addStyleFont(sf,para) { yx_styleFonts[yx_styleFonts.length]=new yx_styleFontOBJ(sf,para); }
function addStyleTag(st,para) { yx_styleTags[yx_styleTags.length]=new yx_styleTagOBJ(st,para); }
function addStyleIcon(so,para) { yx_styleIcons[yx_styleIcons.length]=new yx_styleIconOBJ(so,para); }
function addStyleSeparator(ss,para) { yx_styleSeparators[yx_styleSeparators.length]=new yx_styleSeparatorOBJ(ss,para); }
function addStyleMenu(sm,sp,si,sf,st,so,ss) { yx_styleMenus[yx_styleMenus.length]=new yx_styleMenuOBJ(sm,sp,si,sf,st,so,ss); }

function yx_groupOBJ(menu,style) { this.menu=menu; this.style=style; }
function yx_styleGroupOBJ(sg) { this.name=sg; this.member=new Array(); }; var yx_styleGroups=new Array();
function addStyleGroup(sg,sm) {
  var xGroup=yx_findGroup(sg);
  if (xGroup==null) { var x=yx_styleGroups.length; yx_styleGroups[x]=new yx_styleGroupOBJ(sg); xGroup=yx_styleGroups[x]; }

  var xLen=xGroup.member.length;
  for (var i=2; i<addStyleGroup.arguments.length; i++) { xGroup.member[xLen+i-2]=new yx_groupOBJ(addStyleGroup.arguments[i],sm); }
}
function setDefaultStyle(sp,si,sf,st,so,ss) {
  if (sp!="") { yx_styleMenus[0].sPad=yx_getPad(sp); }
  if (si!="") { yx_styleMenus[0].sItem=yx_getItem(si); }
  if (sf!="") { yx_styleMenus[0].sFont=yx_getFont(sf); }
  if (st!="") { yx_styleMenus[0].sTag=yx_getTag(st); }
  if (so!="") { yx_styleMenus[0].sIcon=yx_getIcon(so); }
  if (ss!="") { yx_styleMenus[0].sSeparator=yx_getSeparator(ss); }
}

function yx_getPad(sp) { return yx_getOBJ(yx_stylePads,sp); }
function yx_getItem(si) { return yx_getOBJ(yx_styleItems,si); }
function yx_getFont(sf) { return yx_getOBJ(yx_styleFonts,sf); }
function yx_getTag(st) { return yx_getOBJ(yx_styleTags,st); }
function yx_getIcon(so) { return yx_getOBJ(yx_styleIcons,so); }
function yx_getSeparator(ss) { return yx_getOBJ(yx_styleSeparators,ss); }
function yx_getMenu(sm) { return yx_findOBJ(yx_styleMenus,sm); }
function yx_findGroup(sg) { return yx_findOBJ(yx_styleGroups,sg); }
function yx_findContent(n) { return yx_findOBJ(yx_content,n); }
function yx_findItemEvent(n) { return yx_findOBJ(yx_iCodes,n); }
function yx_findMenuEvent(n) { return yx_findOBJ(yx_mCodes,n); }

function yx_linkOBJ(dis,msg,link,id) { this.type=yx_L; this.dis=dis; this.msg=msg; this.link=link; this.group=id; }
function yx_commandOBJ(dis,msg,code,id) { this.type=yx_C; this.dis=dis; this.msg=msg; this.code=code; this.group=id; }
function yx_infoOBJ(dis,id) { this.type=yx_I; this.dis=dis; this.group=id; }
function yx_separatorOBJ(id) { this.type=yx_S; this.group=id; }

function yx_submenuOBJ(dis,msg,link,sub,id) {
  this.name=sub; this.type=yx_M;
  this.dis=dis; this.msg=msg; this.link=link; this.group=id;

  var x=yx_findMenu(sub);
  this.items=x==null?new Array():x.menu.items;

  this.addM=yx_addM; this.addL=yx_addL; this.addC=yx_addC; this.addI=yx_addI; this.addS=yx_addS;
}

function yx_topmenuOBJ(tm) {
  this.name=tm; this.items=new Array();
  this.addM=yx_addM; this.addL=yx_addL; this.addC=yx_addC; this.addI=yx_addI; this.addS=yx_addS;
}

function yx_contentOBJ(n,obj){ this.name=n; this.menu=obj; }; yx_content=new Array();

function yx_addM(dis,msg,link,sub,id) { this.items[this.items.length]=new yx_submenuOBJ(dis,msg,link,sub,id); }
function yx_addL(dis,msg,link,id) { this.items[this.items.length]=new yx_linkOBJ(dis,msg,link,id); }
function yx_addC(dis,msg,code,id) { this.items[this.items.length]=new yx_commandOBJ(dis,msg,code,id); }
function yx_addI(dis,id) { this.items[this.items.length]=new yx_infoOBJ(dis,id); }
function yx_addS(id) { this.items[this.items.length]=new yx_separatorOBJ(id); }

function yx_findM(m,n) {
  if (m.name==n) { return m; }

  var sm=null;
  for (var i=0; i<m.items.length; i++) {
    if (m.items[i].type==yx_M) { sm=yx_findM(m.items[i],n); if (sm!=null) { break; } }
  }
  return sm;
}
function yx_findMenu(n) { return (yx_curSub!=null && yx_curSub.name==n)?yx_curSub:yx_findM(yx_curTop,n); }
function yx_badContent(n) { yx_goodContent=false; yx_showMsg("["+n+"] Not Found."); }

function addMenu(n,tm) {
  if (yx_goodContent) {
    yx_curTop=new yx_topmenuOBJ(tm); yx_curSub=null;

    var c=yx_findContent(n);
    if (c==null) {
      yx_content[yx_content.length]=new yx_contentOBJ(n,yx_curTop);
    }
    else {
      delete(c.menu); c.menu=yx_curTop;
    }
  }
}

function addSubMenu(n,dis,msg,link,sub,id) {
  if (yx_goodContent) {
    yx_curSub=yx_findMenu(n);

    if (yx_curSub!=null) {
      yx_curSub.addM(dis,msg||"",link||"",sub,id||"");
    }
    else {
      yx_badContent(n);
    }
  }
}

function addLink(n,dis,msg,link,id) {
  if (yx_goodContent) {
    yx_curSub=yx_findMenu(n);

    if (yx_curSub!=null) {
      yx_curSub.addL(dis,msg||"",link||"",id||"");
    }
    else {
      yx_badContent(n);
    }
  }
}

function addCommand(n,dis,msg,code,id) {
  if (yx_goodContent) {
    yx_curSub=yx_findMenu(n);

    if (yx_curSub!=null) {
      yx_curSub.addC(dis,msg||"",code||"",id||"");
    }
    else {
      yx_badContent(n);
    }
  }
}

function addInfo(n,dis,id) {
  if (yx_goodContent) {
    yx_curSub=yx_findMenu(n);

    if (yx_curSub!=null) {
      yx_curSub.addI(dis,id||"");
    }
    else {
      yx_badContent(n);
    }
  }
}

function addSeparator(n,id) {
  if (yx_goodContent) {
    yx_curSub=yx_findMenu(n);

    if (yx_curSub!=null) {
      yx_curSub.addS(id||"");
    }
    else {
      yx_badContent(n);
    }
  }
}

function endMenu() {
  if (yx_goodContent) { yx_showMsg("Menu Parsed"); }
  yx_curTop=null; yx_curSub=null;
}

function yx_getMenuStyle(menu) {
  if (menu.head.style!=null) {
    var styles=menu.head.style.member;
    for (var i=0; i<styles.length; i++) {
      if (styles[i].menu==menu.content.name) { return yx_getMenu(styles[i].style); }
    }
  }
  return menu.lead==menu.head?yx_styleMenus[0]:menu.lead.lead.style;
}

function yx_getItemStyle(item) {
  if (item.content.group!="" && item.lead.head.style!=null) {
    var styles=item.lead.head.style.member;
    for (var i=0; i<styles.length; i++) {
      if (styles[i].menu==item.content.group) {
        return yx_getMenu(styles[i].style);
      }
    }
  }
  return item.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_winWidth/2):(yx_winWidth-1));
  var y=(n==0 || n==1 || n==2)?0:((n==3 || n==7 || n== 8)?Math.round(yx_winHeight/2):(yx_winHeight-1));
  return (new yx_xyOBJ(x,y));
}

function yx_findIns(n,mode) {
  var ins=yx_findOBJ(yx_ins,n);
  return mode?((ins!=null && ins.menu!=null && ins.menu.ready)?ins:null):ins;
}

function yx_closeIns(ins) {
  for (var i=0; i<yx_ins.length; i++) {
    if (yx_ins[i].menu.shown && yx_ins[i]!=ins) yx_ins[i].hideIns();
  }
}

function yx_setIdx(ins,idx) { ins.z=idx; yx_setZIndex(ins.menu.holder,idx); }

function addInstance(n,mc,para) {
  if (yx_menuSafe) {
    var content=yx_findContent(mc);
    if (content!=null) {
      for (var i=0; i<yx_ins.length; i++) { if (yx_ins[i].name==n) { yx_dropIns(i); break; } }
      yx_ins[yx_ins.length]=new yx_insOBJ(n,content.copy().menu,para);
      yx_showMsg("Menu ["+n+"] Enabled");
    }
  }
}

function yx_eventOBJ(n,eh1,eh2) { this.name=n; this.code1=eh1; this.code2=eh2; }; var yx_iCodes=new Array(), yx_mCodes=new Array();
function addItemEvent(n,eh1,eh2) { var x=yx_findItemEvent(n); if (x==null) { yx_iCodes[yx_iCodes.length]=new yx_eventOBJ(n,eh1,eh2); } }
function addMenuEvent(n,eh1,eh2) { var x=yx_findMenuEvent(n); if (x==null) { yx_mCodes[yx_mCodes.length]=new yx_eventOBJ(n,eh1,eh2); } }
function addWindowEvent(eh) { yx_winEvent=eh; }

function yx_dimOBJ(x,y,w,h,sx,sy) { this.x=x; this.y=y; this.width=w; this.height=h; this.scrollx=sx; this.scrolly=sy; }
function yx_getDim() { yx_scrollingLeft=yx_getScrollX(); yx_scrollingTop=yx_getScrollY(); yx_winWidth=yx_getWinWidth(); yx_winHeight=yx_getWinHeight(); }

function yx_getPos(mode) {
  var head=this.head, pItem=this.lead, pMenu=pItem.lead, sPad=this.style.sPad, sW=this.sW, sH=this.sH;
  var x_align=head.xAlign, y_align=head.yAlign, dir=sPad.dir==""?(head.dir):(sPad.dir);

  yx_getDim();

  var padX=0, padY=0;
  if (pItem==head) {
    padX=x_align=="left"?0:x_align=="center"?(-Math.round(this.width/2)):(-this.width+1);
    padY=y_align=="top"?0:y_align=="middle"?(-Math.round(this.height/2)):(-this.height+1);

    if (head.floating && head.timer>0) { yx_stopIt(head.timer); head.timer=-1; head.holder.x=head.ox; head.holder.y=head.oy; }
    padX+=head.holder.x; padY+=head.holder.y;
    if (head.pos=="slot" || head.floating) { padX+=yx_scrollingLeft; padY+=yx_scrollingTop; }
  }
  else {
    var iX=pMenu.x+pItem.x, iY=pMenu.y+pItem.y, iW=pItem.width, iH=pItem.height;
    if (pMenu.bar) {
      padY=dir.indexOf("up")!=-1?(iY-this.height+sH):(iY+iH-sH);
      padX=dir.indexOf("abs-center")!=-1?(pMenu.x+Math.round((pMenu.width-this.width)/2)):dir.indexOf("abs-left")!=-1?pMenu.x:dir.indexOf("abs-right")!=-1?(pMenu.x+pMenu.width-this.width):dir.indexOf("center")!=-1?(iX+Math.round((iW-this.width)/2)):dir.indexOf("left")!=-1?(iX+iW-this.width+sW):(iX-sW);
    }
    else {
      padX=dir.indexOf("left")!=-1?(iX-this.width+sW):(iX+iW-sW);
      padY=dir.indexOf("top")!=-1?pMenu.y:dir.indexOf("bottom")!=-1?(pMenu.y+pMenu.height-this.height):dir.indexOf("middle")!=-1?(pMenu.y+Math.round((pMenu.height-this.height)/2)):dir.indexOf("up")!=-1?(iY+iH-this.height+sH):(iY-sH);
    }

    padX+=sPad.dx; padY+=sPad.dy;

    if (sPad.flip) {
      var padTop=padY, padBottom=padTop+this.height-1, padLeft=padX, padRight=padLeft+this.width-1;
      var dx=0, dx2=0, dy=0, dy2=0;

      if (pMenu.bar) {
        if (dir.indexOf("down")!=-1 && padBottom-yx_scrollingTop>=yx_winHeight && padTop-this.height-pItem.height+2*sH>=yx_scrollingTop) {
          dy=-this.height-pItem.height+2*sH-2*sPad.dy; padTop+=dy; padBottom+=dy;
        }
        if (dir.indexOf("up")!=-1 && padTop<yx_scrollingTop && padBottom+this.height+pItem.height-2*sH-yx_scrollingTop<yx_winHeight) {
          dy=this.height+pItem.height-2*sH-2*sPad.dy; padTop+=dy; padBottom+=dy;
        }
      }
      else {
        if (dir.indexOf("right")!=-1 && padRight-yx_scrollingLeft>=yx_winWidth && padLeft-this.width-pItem.width+2*sW>=yx_scrollingLeft) {
          dx=-this.width-pItem.width+2*sW-2*sPad.dx; padLeft+=dx; padRight+=dx;
        }
        if (dir.indexOf("left")!=-1 && padLeft<yx_scrollingLeft && padRight+this.width+pItem.width-2*sW-yx_scrollingLeft<yx_winWidth) {
          dx=this.width+pItem.width-2*sW-2*sPad.dx; padLeft+=dx; padRight+=dx;
        }
      }

      if (padBottom-yx_scrollingTop>=yx_winHeight) { dy2=yx_winHeight+yx_scrollingTop-padBottom-yx_edgeMargin; }
      if (padTop+dy2<yx_scrollingTop) { dy2=yx_scrollingTop-padTop+yx_edgeMargin; }
      if (padRight-yx_scrollingLeft>=yx_winWidth) { dx2=yx_winWidth+yx_scrollingLeft-padRight-yx_edgeMargin; }
      if (padLeft+dx2<yx_scrollingLeft) { dx2=yx_scrollingLeft-padLeft+yx_edgeMargin; }

      padX+=dx+dx2; padY+=dy+dy2;
    }
  }

  this.moveMTo(padX,padY);

  if (mode && !this.shown && (pMenu==null || pMenu.active==pItem)) {
    yx_setZIndex(this.holder, pMenu!=null?(yx_getZIndex(pMenu.holder)+1):(++zBase));
    yx_showLayer(this.holder); this.shown=true;

    if (this.code1!="") { eval(this.code1); }
  }

  if (pItem==head && head.floating && head.timer<0) { head.sX=yx_scrollingLeft; head.sY=yx_scrollingTop; head.timeIt(); }
}

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); }
    }

    if (this.lead==this.head && this.head.vis && this.code2!="") { eval(this.code2); }
  }
}

function yx_getDX(mx,ix,dis,mw,iw) { return (mx+ix<yx_scrollingLeft || mx+ix-dis-iw<yx_scrollingLeft && mx<yx_scrollingLeft)?iw:(mx+ix+iw-yx_scrollingLeft>yx_winWidth || mx+ix+iw+dis+iw-yx_scrollingLeft>yx_winWidth && mx+mw-yx_scrollingLeft>yx_winWidth)?-iw:0; }
function yx_getDY(my,iy,dis,mh,ih) { return (my+iy<yx_scrollingTop || my+iy-dis-ih<yx_scrollingTop && my<yx_scrollingTop)?ih:(my+iy+ih-yx_scrollingTop>yx_winHeight || my+iy+ih+dis+ih-yx_scrollingTop>yx_winHeight && my+mh-yx_scrollingTop>yx_winHeight)?-ih:0; }

function yx_dropM() {
  var items=this.items;
  for (var i=0; i<this.itemL; i++) {
    if (items[i].menu!=null && items[i].menu.ready) { items[i].menu.dropM(); }
  }
  document.body.removeChild(this.holder);
}
function yx_moveMTo(x,y) { yx_moveLayerTo(this.holder,x,y); this.x=x; this.y=y; }
function yx_moveMBy(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_scrollingLeft) {
    dx=yx_scrollingLeft-this.x+yx_edgeMargin;
  }
  else if (dx<0 && this.x+this.width-yx_scrollingLeft+dx<=yx_winWidth) {
    dx=yx_winWidth+yx_scrollingLeft-this.x-this.width-yx_edgeMargin;
  }
  else if (dy>0 && this.y+dy>=yx_scrollingTop) {
    dy=yx_scrollingTop-this.y+yx_edgeMargin;
  }
  else if (dy<0 && this.y+this.height-yx_scrollingTop+dy<=yx_winHeight) {
    dy=yx_winHeight+yx_scrollingTop-this.y-this.height-yx_edgeMargin;
  }
  else {
    done=false;
  }

  this.moveMBy(dx,dy);
  if (!done) { yx_scrollingTimer=yx_callBack(this,"scrollIt","("+dx+","+dy+")",floatTimer); }
}

function yx_itemOBJ(lead,content) {
  this.lead=lead; this.content=content; this.styleI=null;

  this.item=null; this.tag=null; this.icon=null; this.dis=null;
  this.cover=null; this.menu=null;

  this.x=0; this.y=0; this.ox=0; this.oy=0; this.width=0; this.height=0; this.ow=0; this.oh=0;
  this.code1=""; this.code2="";

  this.makeI=yx_makeI; this.makeC=yx_makeC; this.onIt=yx_onIt; this.offIt=yx_offIt;
}

function yx_menuOBJ(head,lead,content) {
  this.head=head; this.lead=lead; this.content=content; this.style=null;

  this.holder=null; this.pad=null;
  this.items=new Array(); this.active=null; this.itemL=content.items.length; this.actual=false;

  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.sW=0; this.sH=0; this.getPos=yx_getPos;
  this.code1=""; this.code2="";

  this.makeM=yx_makeM; this.showM=yx_showM; this.hideM=yx_hideM; this.blurM=yx_blurM; this.moveMTo=yx_moveMTo; this.moveMBy=yx_moveMBy; this.dropM=yx_dropM;
  this.scrollIt=yx_scrollIt; this.bar=false;
}

function yx_insOBJ(n,content,para) {
  this.name=n; this.content=content;

  this.floating=(para.search(/floating\s*:\s*yes/)!=-1);

  var ra=para.match(/position\s*:\s*(absolute|relative|slot)(\s+([\w\-]+))?/);
  this.pos=(ra && ra[1])?ra[1]:"absolute";
  this.ref=(ra && ra[3])?ra[3]:"";

  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|abs-center-up|abs-center-down|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.sticky=(para.search(/sticky\s*:\s*yes/)!=-1);
  this.highlight=(para.search(/highlight\s*:\s*no/)==-1);

  this.style=yx_findGroup(para.search(/style\s*:\s*([\w\-]+)/)!=-1?(RegExp.$1):"");

  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.ox=0; this.oy=0;

  this.showIns=yx_showIns; this.hideIns=yx_hideIns; this.movInsTo=yx_movInsTo; this.movInsBy=yx_movInsBy;
}; yx_ins=new Array();

function yx_showIns() {
  yx_checkPage();
  if (yx_loaded) {
    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.getPos(false); this.menu.blurM();
  }
}
function yx_movInsBy(x,y) {
  if (this.menu.ready) {
    this.holder.x+=x; this.holder.y+=y;
    this.menu.moveMBy(x,y); this.menu.blurM();
  }
}
function yx_dropIns(i) {
  if (yx_ins[i].menu.ready) { yx_stopIt(yx_ins[i].timer); yx_ins[i].menu.dropM(); }
  delete(yx_ins[i]); yx_ins[i]={name:"", menu:{ready:false, shown:false}};
}

function yx_timeIt() {
  yx_getDim();

  if (this.sX!=yx_scrollingLeft || this.sY!=yx_scrollingTop) {
    var mx=yx_scrollingLeft>this.sX?Math.ceil:Math.floor, my=yx_scrollingTop>this.sY?Math.ceil:Math.floor;
    var dx=mx((yx_scrollingLeft-this.sX)/floatOffset), dy=my((yx_scrollingTop-this.sY)/floatOffset); this.sX+=dx; this.sY+=dy;
    this.movInsBy(dx,dy);
  }

  this.timer=yx_callBack(this,"timeIt","()",floatTimer);
}

function yx_bringUp(item) {yx_setZIndex(item.item,3); yx_setZIndex(item.cover,4); }
function yx_bringDown(item) { yx_setZIndex(item.item,2); yx_setZIndex(item.cover,3); }

function yx_overOther() { yx_stopAll(); }
function yx_outOther() { yx_stopAll(); if (!this.sticky) yx_setIt(); }
function yx_clickOther() { yx_stopEvent(); }

function yx_markIt(mode) {
  var item=this.item, menu=item.lead, prep=menu.active;
  var si=item.styleI, sItem=si.sItem, sFont=si.sFont, sTag=si.sTag, sIcon=si.sIcon;

  if (prep!=null && prep!=item) { prep.offIt(); }
  menu.active=item;

  yx_bringUp(item);
  yx_setCSS(item,mode==0?sItem.cssH:sItem.cssS,mode==0?sTag.cssH:sTag.cssS,mode==0?sIcon.cssH:sIcon.cssS,mode==0?sFont.cssH:sFont.cssS,(mode==0 && item!=prep),sItem.xAlign,sItem.yAlign);
}

function yx_upIt(it) {
  var x=it.lead.lead;
  if (x.lead!=null) { x.cover.markIt(1); 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(1); 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=="none" || sPad.scroll=="y-only")?0:yx_getDX(menu.x,this.x,menu.bar?sPad.iOff:0,menu.width,sPad.step==0?this.width:sPad.step), dy=(sPad.scroll=="none" || sPad.scroll=="x-only")?0:yx_getDY(menu.y,this.y,menu.bar?0:sPad.iOff,menu.height,sPad.step==0?this.height:sPad.step);
  if (dx!=0 || dy!=0) {
    yx_scrollingTimer=yx_callBack(menu,"scrollIt","("+dx+","+dy+")",menuTimer);
  }
  else if (type==yx_M) {
    if ((this.styleI.sItem.onOver || menu.open) && !this.menu.shown) {
      this.menu.showM();
    }
    else if (!menu.head.highlight) {
      this.menu.blurM();
    }
  }
}

function yx_offIt() {
  var si=this.styleI;
  yx_bringDown(this);
  yx_setCSS(this,si.sItem.cssN,si.sTag.cssN,si.sIcon.cssN,si.sFont.cssN,false,si.sItem.xAlign,si.sItem.yAlign);
}

function yx_overItem() {
  var item=this.item;

  if (item.lead.shown) {
    yx_stopAll(); yx_showMsg(item.content.msg);
    this.markIt(0); yx_upIt(item); yx_downIt(item);
    yx_onItemTimer=yx_callBack(item,"onIt","()",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 yx_resizeIt() {
  yx_stopAll(); yx_otherResize(); yx_getDim();

  for (var i=0; i<yx_ins.length; i++) {
    var ins=yx_ins[i];
    if (ins.menu.ready) {
      yx_stopIt(ins.timer); ins.timer=-1;
      ins.hideIns(); ins.getHolder(); ins.menu.getPos(false);
    }
  }

  if (yx_winEvent!="") { eval(yx_winEvent); }
}

function yx_void() { return true; }

function getMenuDim(n) { var ins=yx_findIns(n,true); return ins==null?null:(new yx_dimOBJ(ins.menu.x, ins.menu.y, ins.menu.width, ins.menu.height, yx_getScrollX(), yx_getScrollY())); }
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 openMenu(n) { yx_stopAll(); yx_onItemTimer=setTimeout("showMenu('"+n+"')",menuTimer); }
function openMenuX(n) { yx_stopAll(); yx_onItemTimer=setTimeout("showMenuX('"+n+"')",menuTimer); }
function closeMenuNow() { yx_closeIns(null); }
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(); showMenu(n); }
function clickMenuX(n) { yx_stopEvent(); showMenuX(n); }
function switchMenu(n) { yx_stopEvent(); var ins=yx_findIns(n,false); if (ins!=null) { var act=(ins.vis && ins.menu.shown)?hideMenuX:showMenuX; act(n); } }
function setHolder(n,id) { var ins=yx_findIns(n,false), l=yx_findLayer(id); if (ins!=null && l!=null) { ins.ox=yx_getLeft(l)+ins.dx; ins.oy=yx_getTop(l)+ins.dy; ins.holder=new yx_xyOBJ(ins.ox,ins.oy); } }
function setCoordinates(n,x,y) { var ins=yx_findIns(n,false); if (ins!=null) { ins.ox=x; ins.oy=y; ins.holder=new yx_xyOBJ(x,y); } }
function slideMenuBack(n) { var ins=yx_findIns(n,false); if (ins!=null) { addMenuEvent(ins.menu.content.name, "", "moveMenuBack('"+n+"')"); } }
function updateItemDisplay(id,dis) { var item=yx_findLayer("yx"+id); if (item!=null && item.item.content.type!=yx_S) { item.item.dis.innerHTML=dis; } }
function updateItemLink(id,link) { var item=yx_findLayer("yx"+id); if (item!=null && item.item.content.type==yx_L) { item.item.content.link=link; } }
function updateItemCode(id,code) { var item=yx_findLayer("yx"+id); if (item!=null && item.item.content.type==yx_C) { item.item.content.code=code; } }

if (yx_menuSafe) {
  var yx_menuScript=scriptPath+(yx_isGecko?"menuG5Gecko.js":yx_isOpera7?"menuG5Opera.js":"menuG5IE.js");
  document.write("<scr"+"ipt language='javascript' src='"+yx_menuScript+"' type='text/javascript'><\/scr"+"ipt>");
  if (typeof(contentScript)!="undefined") {
    document.write("<scr"+"ipt language='javascript' src='"+contentScript+"' type='text/javascript'><\/scr"+"ipt>");
  }
  if (typeof(styleScript)!="undefined") {
    document.write("<scr"+"ipt language='javascript' src='"+styleScript+"' type='text/javascript'><\/scr"+"ipt>");
  }
  if (typeof(instanceScript)!="undefined") {
    document.write("<scr"+"ipt language='javascript' src='"+instanceScript+"' type='text/javascript'><\/scr"+"ipt>");
  }
}
else if (typeof(nonMenuPage)!="undefined") {
  setTimeout("window.location.replace('"+nonMenuPage+"')",0);
}

