// +------------------------------------------------------------+// | yx_menu G2 (frame)              Full Version               |// | Created 12/12/1999              Last Modified 07/06/2000   |// | Web Site:                       http://yx.webprovider.com  |// | eMail:                          yangxin@iname.com          |// +------------------------------------------------------------+// | Copyright 2000  Xin Yang        All Rights Reserved.       |// +------------------------------------------------------------+// | For personal purpose, send me your URL and put a link back |// | to my web site, then you can use this script free.         |// |                                                            |// | For commercial purpose, obtain quotation for referencing,  |// | using, hosting, selling or distributing this script.       |// |                                                            |// | In all cases copyright must remain intact.                 |// +------------------------------------------------------------+var _isIE4=false,_isNN4=false,_menuTimer=0,_menuOffset=0,frameOffset=4;var popInstance=-1,popRegistered=false,mapRegistered=false,mapX=0,mapY=0;var instanceValid=true,instanceReady=false;var frameWidth=0,frameHeight=0,halfWidth=0,halfHeight=0,contentWidth=0,contentHeight=0,scrollBar=0;var lastInstance=-1,lastIndex=1,holdOn=false;var yxI=new Array(),iCount=0,yxS=new Array(),sCount=0;function getInstance(_name) {  for (var i=0; i<iCount; i++) {    if (yxI[i].name==_name) { return i; }  }  return -1;}function setDIM() {  if (_isNN4) {    frameWidth=window.innerWidth; frameHeight=window.innerHeight;    contentWidth=(frameHeight<window.document.height-frameOffset)?(frameWidth-scrollBar+frameOffset):(frameWidth+frameOffset);    contentHeight=(frameWidth<window.document.width-frameOffset)?(frameHeight-scrollBar+frameOffset):(frameHeight+frameOffset);  }  else {    contentWidth=window.document.body.clientWidth; contentHeight=window.document.body.clientHeight;  }  halfWidth=Math.ceil(contentWidth/2); halfHeight=Math.ceil(contentHeight/2);}function resizeFrame() {  if (_isNN4) {    if (window.innerWidth!=frameWidth || window.innerHeight!=frameHeight) { document.location.reload(); }  }  else {    var oldWidth=contentWidth,oldHeight=contentHeight;    setDIM();    var dx=contentWidth-oldWidth,dy=contentHeight-oldHeight;    if (dx!=0 || dy!=0) {      for (var i=0; i<iCount; i++) {        if ((yxI[i].position==2 || yxI[i].position==3 || yxI[i].position==4) && dx!=0) { yxI[i].holder.xx+=dx; }        if ((yxI[i].position==1 || yxI[i].position==5 || yxI[i].position==8) && dx!=0) { yxI[i].holder.xx+=Math.floor(dx/2); }        if ((yxI[i].position==4 || yxI[i].position==5 || yxI[i].position==6) && dy!=0) { yxI[i].holder.yy+=dy; }        if ((yxI[i].position==3 || yxI[i].position==7 || yxI[i].position==8) && dy!=0) { yxI[i].holder.yy+=Math.floor(dy/2); }        yxI[i].moveInstanceTo(yxI[i].holder.xx,yxI[i].holder.yy);      }    }  }}function popMenu(e) {  if (!holdOn) {    holdOn=true;    var menuX=0,menuY=0;    if (_isIE4) {      menuX=event.clientX+window.document.body.scrollLeft; menuY=event.clientY+window.document.body.scrollTop;    }    else {      menuX=e.pageX; menuY=e.pageY;    }    for (var i=0; i<iCount; i++) {      if (i==popInstance) {        menuX+=(yxI[i].direction==0 || yxI[i].direction==3)?-_menuOffset:_menuOffset;        menuY+=(yxI[i].direction==0 || yxI[i].direction==1)?-_menuOffset:_menuOffset;        yxI[i].moveInstanceTo(menuX,menuY);        yxI[i].showInstance();      }      else {        yxI[i].hideInstance();      }    }    holdOn=false;  }  return false;}function mapMenu(e) {  if (_isIE4) {    mapX=event.clientX+window.document.body.scrollLeft; mapY=event.clientY+window.document.body.scrollTop;  }  else {    mapX=e.pageX; mapY=e.pageY;  }  return true;}function _hideInstance(_instance) { yxI[_instance].timer=eval('setTimeout("yxI['+_instance+'].hideInstance()",'+_menuTimer+')'); }function clearTimer(_instance) { clearTimeout(yxI[_instance].timer); }function _checkInstance(_instance) {  var holder=yxI[_instance].holder;  if (_isIE4) {    holder.style.pixelLeft=holder.xx+window.document.body.scrollLeft;    holder.style.pixelTop=holder.yy+window.document.body.scrollTop;  }  else {    holder.moveTo(holder.xx+window.pageXOffset,holder.yy+window.pageYOffset);  }  holder.dy=top.getTop(holder);  eval('setTimeout("_checkInstance('+_instance+')",'+_menuTimer+')');}function _registerPop(_instance) {  popInstance=_instance;  if (_isIE4) {    window.document.ondblclick=popMenu;  }  else {    window.document.onDblClick=popMenu;    window.document.captureEvents(Event.DBLCLICK);  }}function _registerMap() {  if (_isIE4) {    window.document.onclick=mapMenu;  }  else {    window.document.onClick=mapMenu;    window.document.captureEvents(Event.CLICK);  }}function _initMenu(_scrollBar) {  window.onunload=delFrame;  _isIE4=top.isIE4; _isNN4=top.isNN4;  _menuTimer=top.menuTimer; _menuOffset=top.menuOffset;  scrollBar=(_scrollBar==0)?0:20;  setDIM();  buildMenu();  if (instanceValid) {    instanceReady=true;    window.onresize=resizeFrame;    top.showMessage("Menu activated");  }}function _openMap(_name) {  if (!holdOn && instanceReady) {    holdOn=true;    for (var i=0; i<iCount; i++) {      if (yxI[i].name==_name) {        mapX+=((yxI[i].direction==0 || yxI[i].direction==3)?-_menuOffset:_menuOffset);        mapY+=((yxI[i].direction==0 || yxI[i].direction==1)?-_menuOffset:_menuOffset);        yxI[i].moveInstanceTo(mapX,mapY);        yxI[i].showInstance();      }      else {        yxI[i].hideInstance();      }    }    holdOn=false;    return true;  }  return false;}function _openMenu(_name) {  if (!holdOn && instanceReady) {    holdOn=true;    for (var i=0; i<iCount; i++) {      if (yxI[i].name==_name) {        yxI[i].showInstance();      }      else {        yxI[i].hideInstance();      }    }    holdOn=false;    return true;  }  return false;}function _closeMenu(_name) {  if (!holdOn && instanceReady) {    holdOn=true;    var iIndex=getInstance(_name);    if (iIndex!=-1) {      if (yxI[iIndex].shown) { _hideInstance(iIndex); }    }    holdOn=false;    return true;  }  return false;}function _closeMenuNow(_name) {  if (!holdOn && instanceReady) {    holdOn=true;    var iIndex=getInstance(_name);    if (iIndex!=-1) {      if (yxI[iIndex].shown) { yxI[iIndex].hideInstance(); }    }    holdOn=false;    return true;  }  return false;}function _switchMenu(_name) {  if (!holdOn && instanceReady) {    holdOn=true;    for (var i=0; i<iCount; i++) {      if (yxI[i].name==_name) {        if (yxI[i].shown) {          yxI[i].hideInstance();        }        else {          yxI[i].showInstance();        }      }      else {        yxI[i].hideInstance();      }    }    holdOn=false;    return true;  }  return false;}function _moveMenuTo(_name,_x,_y) {  if (instanceReady) {    var iIndex=getInstance(_name);    if (iIndex!=-1) {      yxI[iIndex].moveInstanceTo(_x,_y);      return true;    }  }  return false;}function _moveMenuBy(_name,_x,_y) {  if (instanceReady) {    var iIndex=getInstance(_name);    if (iIndex!=-1) {      yxI[iIndex].moveInstanceBy(_x,_y);      return true;    }  }  return false;}function 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 _getMenuDim(_name) {  if (instanceReady) {    var iIndex=getInstance(_name);    if (iIndex!=-1) {      if (yxI[iIndex].menu.ready) {        var pad=yxI[iIndex].menu.pad.layer;
        if (_isIE4) {          _obj=pad.children[0];          return (new dimOBJ(top._getLeft(pad),top._getTop(pad),_obj.offsetWidth,_obj.offsetHeight,window.document.body.scrollLeft,window.document.body.scrollTop));        }        else {          return (new dimOBJ(pad.pageX,pad.pageY,pad.document.width,pad.document.height,window.pageXOffset,window.pageYOffset));        }      }    }  }  return null;}function _getItemDim(_name,_item) {  if (instanceReady) {    var iIndex=getInstance(_name);    if (iIndex!=-1) {      if (yxI[iIndex].menu.ready) {        if (_item<yxI[iIndex].menu.items.length) {          var item=yxI[iIndex].menu.items[_item].layer;          if (_isIE4) {            _obj=item.children[0];            return (new dimOBJ(top._getLeft(item),top._getTop(item),_obj.offsetWidth,_obj.offsetHeight,window.document.body.scrollLeft,window.document.body.scrollTop));          }          else {            return (new dimOBJ(item.pageX,item.pageY,item.document.width,item.document.height,window.pageXOffset,window.pageYOffset));          }        }      }    }  }  return null;}function initMenu(_scrollBar) {  if (top.groupReady) {    _initMenu(_scrollBar);  }  else {    eval('setTimeout("initMenu('+_scrollBar+')",200)');  }}function addStyle(_styleName,_paddingWidth,_paddingHeight,_spacing,_spacingColor,_colorNormal,_colorHighlighted,_border,_borderColorBright,_borderColorDark,_textFont,_textSize,_textWeight,_textDecoration,_textColor,_tag,_tagWidth,_tagHeight,_tagImage,_imagePath,_widthRatio) {  top.addStyle_(self,_styleName,_paddingWidth,_paddingHeight,_spacing,_spacingColor,_colorNormal,_colorHighlighted,_border,_borderColorBright,_borderColorDark,_textFont,_textSize,_textWeight,_textDecoration,_textColor,_tag,_tagWidth,_tagHeight,_tagImage,_imagePath,_widthRatio);}function addInstance(_name,_type,_position,_holder,_x,_y,_direction,_form,_initial,_target,_group,_style1,_style2) {  top.addInstance_(self,_name,_type,_position,_holder,_x,_y,_direction,_form,_initial,_target,_group,_style1,_style2);}function addFrame(_name) { if (!top.addFrame_(_name,self)) { eval('setTimeout("addFrame('+_name+')",200)'); } }function delFrame() { top.delFrame(self); }function openMap(_fName,_iName) { return top.openMap_(_fName,_iName); }function openMenu(_fName,_iName) { return top.openMenu_(_fName,_iName); }function closeMenu(_fName,_iName) { return top.closeMenu_(_fName,_iName); }function closeMenuNow(_fName,_iName) { return top.closeMenuNow_(_fName,_iName); }function switchMenu(_fName,_iName) { return top.switchMenu_(_fName,_iName); }function moveMenuTo(_fName,_iName,_x,_y) { return top.moveMenuTo_(_fName,_iName,_x,_y); }function moveMenuBy(_fName,_iName,_x,_y) { return top.moveMenuBy_(_fName,_iName,_x,_y); }function getMenuDim(_fName,_iName) { return top.getMenuDim_(_fName,_iName); }function getItemDim(_fName,_iName,_iIndex) { return top.getItemDim_(_fName,_iName,_iIndex); }