<!--
var sI=new Array();
function buildMenu() {
	var label=1;
	ssmHTML="";
	var debut_label='<div class="mLabel" id="label1';
	var debut_box='<div class="mBox" id="box1';
	var fin='</div>';
	for(i=0;i<sI.length;i++){
		if(sI[i][2]>1){
			if(i)
				ssmHTML+=fin;
			ssmHTML+=debut_label+label+'">'+'<a class="mlbl" href="'+sI[i][1]+'">'+sI[i][0]+'</a>'+fin+debut_box+label+'">';
			label++;
		}
		else{
			ssmHTML+='<a class="m" href="'+sI[i][1]+'">'+sI[i][0]+'</a>';
		}
	}
	ssmHTML+='</div>';
	document.write(ssmHTML);
}
function addHdr(text, link) {if(!link)link="javascript://";sI[sI.length]=[text, link, 2]}
function addLink(text, link){if(!link)link="javascript://";sI[sI.length]=[text, link, 3]}
function addItem(text, link){if(!link)link="javascript://";sI[sI.length]=[text, link, 0]}
function addText(text){sI[sI.length]=[text, '', 1]}
//////////////////////////////////////////////
function resizeListener(e) {
  if (is.opera5or6 || is.nav4) {
    location.replace(location.href);
  }
  else {
    menu1.paint(mark1.pageX(), mark1.pageY());
    menu2.paint(0, window.cbe.height() - 60);
    menu3.paint(window.cbe.width() - menu3.lblW[0], 0);
  }
}

////

var cbeTotalMenus=0, cbeActiveMenu=null;
function cbeMenu(
  horizontal,
  menuX, menuY, menuZ,
  lblWidthsArray, lblHeight,
  boxWidthsArray,
  activeColor, inactiveColor,
  activeBkgnd, inactiveBkgnd,
  boxBkgnd
) {
  // properties
  this.n = ++cbeTotalMenus;
  this.hz = horizontal;
  this.x = menuX;
  this.y = menuY;
  this.z = menuZ;
  this.lblW = lblWidthsArray;
  this.lblH = lblHeight;
  this.boxW = boxWidthsArray;
  this.ac = activeColor;
  this.ic = inactiveColor;
  this.ab = activeBkgnd;
  this.ib = inactiveBkgnd;
  this.bb = boxBkgnd;
  this.active = null;
  // methods
  this.paint = function(menuX, menuY) {
    var i=1, x, y, lbl, box;
    if (arguments.length > 1) {
      this.x = menuX;
      this.y = menuY;
    }
    x = this.x;
    y = this.y;
    lbl = cbeGetElementById('label'+this.n+""+i);
    while (lbl) {
      lbl = lbl.cbe;
      lbl.zIndex(this.z);
      lbl.resizeTo(this.lblW[i-1], this.lblH);
      lbl.moveTo(x, y);
      lbl.color(this.ic);
      lbl.background(this.ib);
      lbl.show();
      lbl.box = i;
      lbl.menu = this;

	lbl.addEventListener('drag');
	lbl.addEventListener('dragEnd', dragEndListener, false);

      if (arguments.length==3) lbl.addEventListener('mouseover', menuShowListener, false);
      lbl.box = cbeGetElementById('box'+this.n+""+i).cbe;
      if (lbl.box) {
        lbl.box.width(this.boxW[i-1]);
        var bx, by;
        if (this.hz) { // horizontal
          if (x + this.boxW[i-1] > window.cbe.width()) { bx = x - (this.boxW[i-1] - this.lblW[i-1]); }
          else { bx = x; }
          if (y + this.lblH + lbl.box.height() > window.cbe.height()) { by = y - lbl.box.height(); }
          else { by = y + this.lblH; }
        }
        else { // vertical
          if (x + this.boxW[i-1] > window.cbe.width()) { bx = x - this.boxW[i-1]; }
          else { bx = x + this.lblW[i-1]; }
          if (y + lbl.box.height() > window.cbe.height()) { by = y + this.lblH - lbl.box.height(); }
          else { by = y; }
        }
        lbl.box.moveTo(bx, by);
        lbl.box.lbl = lbl;
        lbl.box.zIndex(this.z);
        lbl.box.background(this.bb);
        lbl.box.hide();
      }
      if (this.hz) x += this.lblW[i-1];
      else y += this.lblH;
      lbl = cbeGetElementById('label'+this.n+""+(++i));
    }
  }
  // constructor code
  this.paint(this.x, this.y, 'init');
  document.cbe.addEventListener("mousemove", menuHideListener, false);
}

function dragEndListener(e){
	var lbl = e.cbeCurrentTarget;
	var bx, by;
	x=lbl.left();
	y=lbl.top();
if (x + lbl.box.width() > window.cbe.width()) { bx = x - lbl.box.width(); }
          else { bx = x + lbl.width(); }
          if (y + lbl.box.height() > window.cbe.height()) { by = y + this.lblH - lbl.box.height(); }
          else { by = y; }
lbl.box.moveTo(bx, by);
}

function menuShowListener(e) {
  var lbl = e.cbeCurrentTarget;
  var menu = lbl.menu;
  if (menu.active) {
    if (menu.active == lbl) return;
    menu.active.box.hide();
    menu.active.color(menu.ic);
    menu.active.background(menu.ib);
  }
  if (cbeActiveMenu && cbeActiveMenu != menu) {
    menuHide(cbeActiveMenu);
  }
  lbl.box.show();
  lbl.color(menu.ac);
  lbl.background(menu.ab);
  menu.active = lbl;
  cbeActiveMenu = menu;
}
function menuHideListener(e) {
  if (cbeActiveMenu && cbeActiveMenu.active && !e.cbeTarget.lbl && !e.cbeTarget.box) {
    menuHide(cbeActiveMenu);
  }
}
function menuHide(menu) {
  menu.active.box.hide();
  menu.active.color(menu.ic);
  menu.active.background(menu.ib);
  menu.active = null;
  cbeActiveMenu = null;
}

//-->
