<!--
function makeMenuItem(objMenu) {
var theIndex=0;
var ii,tt;
var tempArr = new Array();
for(ii=0;ii<ProductCatalog.length;ii++) {
if(ProductCatalog[ii][4]>=0) {
ProductCatalog[ProductCatalog[ii][4]][5]=true;
}
}
objMenu.addLink("New items","","JavaScript:onCatalogChange('-2');");
objMenu.addHR2();
for(ii=0;ii<ProductCatalog.length;ii++) {
tt=ProductCatalog[ii][4];
if(tt<0) {
if(ProductCatalog[ii][5]) {
tempArr[theIndex++]=objMenu.addMenu(ProductCatalog[ii][2]);
objMenu.addHR2();
} else {
tempArr[theIndex++]=objMenu.addLink(ProductCatalog[ii][2],"","JavaScript:onCatalogChange(" + ProductCatalog[ii][0] + ");");
objMenu.addHR2();
}
} else {
if(ProductCatalog[ii][5]) {
tempArr[theIndex++]=tempArr[tt].addMenu(ProductCatalog[ii][2]);
tempArr[tt].addHR2();

} else {
tempArr[theIndex++]=tempArr[tt].addLink(ProductCatalog[ii][2],"","JavaScript:onCatalogChange(" + ProductCatalog[ii][0] + ");");
tempArr[tt].addHR2();
}
}
}

}
function initMenu() {
BM = new TopMenu("BM","TT","getLeft(TT)","getTop(TT)+1")
sKind=document.all.sKind;
obj=document.form1;
//alert('aa');
makeMenuItem(BM);
document.all.loadingshow.style.display="none";
/*
if(obj.key.value=="") {
obj.key.value=defaultKeyWord
}
obj.sKind.options[0].text="All Categories "
if(mode=='search') {
for(i=0;i<obj.sKind.options.length;i++) {
if(kind==obj.sKind.options[i].value) {
obj.sKind.options[i].selected=true;
break;
}
}
}
*/
}
function getTop(e){
var t=e.offsetTop
while(e=e.offsetParent){
    t+=e.offsetTop;
}    
return t;
}
function getLeft(e){
var t=e.offsetLeft
while(e=e.offsetParent){
    t+=e.offsetLeft;
}    
return t;
}



var IconList = new Array();   // icon图片 集合， 下标从 1 开始

IconList[0] = new Image();

IconList[0].src = " "  //用来加载鼠标事件的WAV

IconList[1] = new Image();

IconList[1].src = " ";  //用来加载鼠标事件的图片



//----------------  检测变量 菜单的显示隐藏就靠它了！！！  ------------------//


var SubMenuList = new Array();

var NowSubMenu = "";

var mouseCanSound = false;  //---------------------------  声音开关 ------  声音开关 ------------------//

var menuSpeed     =  10;   //---------- 菜单显示速度 ------------//

var alphaStep     =  40;   //---------- Alpaha 变化 度 -----------//


//------------- 构建 顶部菜单 对象 -------------//


function TopMenu(objName,where,L,T)
{
this.id   = "Menu_"+objName;
this.obj  = objName;
this.length  = 0;

this.L       = L

this.T       = T

this.addMenu = addMenu;
this.addLink = addLink;
this.addHR   = addHR;
this.addHR2   = addHR2;

if(where)
where = eval(where)
else
where = eval("document.body")

where.insertAdjacentHTML('afterBegin','<table id="'+this.id+'" border="0" cellspacing="0" cellpadding="0" class="menutableT" ></table>');
}



//----------- 构建 子菜单 对象 -------------//

function SubMenu(objName,objID)
{
this.obj = objName;
this.id  = objID;

this.addMenu = addMenu;
this.addLink = addLink;
this.addHR   = addHR;
this.addHR2   = addHR2;

this.length  = 0;
}



//-------------- 菜单对象 addMenu 方法 ------------//
function addMenu(word,icon,url,target,title)
{
var subID    = this.id + "_" + this.length;
var subObj  = this.obj+"["+this.length+"]";

var oldID   = this.id;

eval(subObj+"= new SubMenu('"+subObj+"','"+subID+"')");

 makeMenu(subID,oldID,word,icon,url,target,title);
 return(this[this.length++]);
}


//------------- 菜单对象 addLink 方法 -------------//
function addLink(word,icon,url,target,title)
{
var subID    = this.id + "_" + this.length;
var oldID  = this.id;

 makeLink(subID,oldID,word,icon,url,target,title);
 return(this[this.length++]);
}


//------------ 菜单对象 addHR 方法 -----------------//
function addHR()
{
var oldID = this.id;

var Oobj = document.getElementById(oldID);

Oobj.insertRow();

Oobj.rows(Oobj.rows.length-1).insertCell();

with(Oobj.rows(Oobj.rows.length-1))
{
cells(0).colSpan= 4;
cells(0).insertAdjacentHTML('beforeEnd','<hr class="menuhr" size="1" width="95%">');
}

}
//------------ 菜单对象 addHR 方法 -----------------//
function addHR2()
{
var oldID = this.id;

var Oobj = document.getElementById(oldID);

Oobj.insertRow();

Oobj.rows(Oobj.rows.length-1).insertCell();
with(Oobj.rows(Oobj.rows.length-1).style)
{
height="1";
}
with(Oobj.rows(Oobj.rows.length-1))
{
cells(0).colSpan= 4;
cells(0).align="center";
cells(0).innerHTML="<img src=img/menuHrBg.gif width=100% height=1>";
}

}


//-------------- 生成 菜单 makeMenu 方法 -----------//
function makeMenu(subID,oldID,word,icon,url,target,thetitle)
{
var thelink = '';


if(icon&&icon!="")
{
icon = '<img border="0" src="'+IconList[icon].src+'">';
}
else
{
icon = '';
}

if(!thetitle||thetitle=="")
{
thetitle = '';
}


if(url&&url!="")
{
thelink += '<a href="'+url+'" ';

if(target&&target!="")
{
thelink += '  ';
thelink += 'target="'+target+'" '
}

thelink += '></a>';
}

var Oobj = document.getElementById(oldID);

Oobj.insertRow();


with(Oobj.rows(Oobj.rows.length-1))
{
id = "tr"+subID;
className= "menutrout";

title       = thetitle;

}
eventObj = "tr"+subID;

eval(eventObj+'.attachEvent("onmouseover",MtrOver('+eventObj+'))');
eval(eventObj+'.attachEvent("onclick",MtrClick('+eventObj+'))');

var trObj = eval(eventObj);

for(i=0;i<4;i++)
{
trObj.insertCell();
}

with(Oobj.rows(Oobj.rows.length-1))
{
cells(0).className = "menutd0";
cells(0).innerHTML = icon;

cells(1).innerHTML = thelink+'<nobr class=indentWord>'+word+'</nobr>';
cells(1).calssName = "indentWord"

cells(2).className = "menutd1";
cells(2).innerHTML = "4";

cells(3).className = "menutd2";
cells(3).innerText = " ";

}



document.body.insertAdjacentHTML('beforeEnd','<table id="'+subID+'" border="0" cellspacing="0" cellpadding="0" style="top: 0; left: 0; visibility: hidden; filter:Alpha(Opacity=0);" class="menutable"></table>');



}



//---------------- 生成连接 makeLink 方法 ------------//
function makeLink(subID,oldID,word,icon,url,target,thetitle)
{


var thelink = '';

if(icon&&icon!="")
{
icon = '<img border="0" src="'+IconList[icon].src+'">';
}
else
{
icon = '';
}

if(!thetitle||thetitle=="")
{
thetitle = '';
}


if(url&&url!="")
{
thelink += '<a href="'+url+'" ';

if(target&&target!="")
{
thelink += '  ';
thelink += 'target="'+target+'" '
}

thelink += '></a>';
}

var Oobj = document.getElementById(oldID);

Oobj.insertRow();


with(Oobj.rows(Oobj.rows.length-1))
{
id = "tr"+subID;
className= "menutrout";
title       = thetitle;

}

eventObj = "tr"+subID;

eval(eventObj+'.attachEvent("onmouseover",LtrOver('+eventObj+'))');
eval(eventObj+'.attachEvent("onmouseout",LtrOut('+eventObj+'))');
eval(eventObj+'.attachEvent("onclick",MtrClick('+eventObj+'))');

var trObj = eval(eventObj);

for(i=0;i<4;i++)
{
trObj.insertCell();
}

with(Oobj.rows(Oobj.rows.length-1))
{
cells(0).className = "menutd0";
cells(0).innerHTML = icon;

cells(1).innerHTML = thelink+'<nobr class=indentWord>'+word+'</nobr>';

cells(2).className = "linktd1";
cells(2).innerText = " ";

cells(3).className = "menutd2";
cells(3).innerText = " ";

}

}


//--------- MtrOver(obj)-------------------//
function MtrOver(obj)
{
return sub_over;

function sub_over()
{

var sonid = obj.id.substring(2,obj.id.length);

var topobj = obj.parentElement.parentElement; 

NowSubMenu = topobj.id;

if(obj.className=="menutrout")
{
mouseWave();
}

HideMenu(1);

SubMenuList[returnIndex(NowSubMenu)] = NowSubMenu;


ShowTheMenu(sonid,MPreturn(sonid))


SubMenuList[returnIndex(obj.id)] = sonid;

obj.className = "menutrin"; 

topobj.oldTR = obj.id; 


}

}

//--------- LtrOver(obj)-------------------//
function LtrOver(obj)
{
return sub_over;
function sub_over()
{
var topobj = obj.parentElement.parentElement; 

NowSubMenu = topobj.id;

HideMenu(1);

SubMenuList[returnIndex(NowSubMenu)] = NowSubMenu;

if(topobj.oldTR)
{ 
eval(topobj.oldTR+'.className = "menutrout"'); 
} 

obj.className = "menutrin"; 

topobj.oldTR = obj.id; 

}
}

//--------- LtrOut(obj)-------------------//
function LtrOut(obj)
{
return sub_out;

function sub_out()
{
var topobj = obj.parentElement.parentElement; 

obj.className = "menutrout"; 

topobj.oldTR = false; 
}
}

//----------MtrClick(obj)-----------------//

function MtrClick(obj)
{
return sub_click;

function sub_click()
{
if(obj.cells(1).all.tags("A").length>0)
{
obj.cells(1).all.tags("A")(0).click();
}

}
}

//---------- returnIndex(str)--------------//

function returnIndex(str)
{
return (str.split("_").length-3)
}


//---------ShowTheMenu(obj,num)-----------------//

function ShowTheMenu(obj,num)
{
var i=0;
var tempObj = obj.split('_')[obj.split('_').length-1].length+1
var topobj = eval(obj.substring(0,obj.length-tempObj));
var Menuobj = eval(topobj.id.split("_")[1])

var ML      = 0
if(Menuobj.L&&Menuobj.id==topobj.id)
{
ML+= eval(Menuobj.L)
}
else
{
if(Menuobj.id==topobj.id)
{
ML = topobj.offsetLeft
}
}
var MT      = 0
if(Menuobj.T&&Menuobj.id==topobj.id)
{
MT+= eval(Menuobj.T)
}
else
{
if(Menuobj.id==topobj.id)
{
MT = topobj.offsetTop
}
}

var trobj  = eval("tr"+obj);

var obj = eval(obj);

var TheTDLeft = trobj.parentElement.parentElement.parentElement.offsetLeft;


if(num==0)
{
with(obj.style)
{
pixelLeft = topobj.style.pixelLeft +topobj.offsetWidth+ML;
pixelTop  = topobj.style.pixelTop + trobj.offsetTop+MT;
}
}
if(num==1)
{
with(obj.style)
{
pixelLeft = topobj.style.pixelLeft + topobj.offsetWidth+ML;
pixelTop  = topobj.style.pixelTop  + trobj.offsetTop + trobj.offsetHeight - obj.offsetHeight+MT+100;
}
}
if(num==2)
{
with(obj.style)
{
pixelLeft = topobj.style.pixelLeft -  obj.offsetWidth+ML+100;
pixelTop  = topobj.style.pixelTop + trobj.offsetTop+MT+100;
}
}
if(num==3)
{
with(obj.style)
{
pixelLeft = topobj.style.pixelLeft -  obj.offsetWidth+ML+100;
pixelTop  = topobj.style.pixelTop  + trobj.offsetTop + trobj.offsetHeight - obj.offsetHeight+MT+100;
}
}

obj.style.visibility  = "visible"; 

if(obj.alphaing)
{
clearInterval(obj.alphaing);
}

obj.alphaing = setInterval("menu_alpha_up("+obj.id+","+alphaStep+")",menuSpeed);
}

//----------HideMenu(num)-------------------//

/*----------------------
var SubMenuList = new Array();

var NowSubMenu = "";

---------------------*/

function HideMenu(num)
{
var thenowMenu = "";

var obj = null;

if(num==1)
{
thenowMenu = NowSubMenu
}



for(i=SubMenuList.length-1;i>=0;i--)
{
if(SubMenuList[i]&&SubMenuList[i]!=thenowMenu)
{

obj = eval(SubMenuList[i]);

if(obj.alphaing)
{
clearInterval(obj.alphaing);
}

obj.alphaing = setInterval("menu_alpha_down("+obj.id+","+alphaStep+")",menuSpeed);

obj.style.visibility = "hidden";//-----如果想缓慢隐藏，请去掉这项---------------//------------//

eval("tr"+SubMenuList[i]).className = "menutrout";

SubMenuList[i] = null;
}
else
{
if(SubMenuList[i]==thenowMenu)
{
return;
}
}
}

NowSubMenu = "";
}

//-----------MenuPosition return(obj)--------------//

function MPreturn(obj)
{
var tempObj = obj.split('_')[obj.split('_').length-1].length+1
var topobj = eval(obj.substring(0,obj.length-tempObj));
var trobj  = eval("tr"+obj);

var x = topobj.style.pixelLeft + topobj.offsetWidth;
var y = topobj.style.pixelTop  + trobj.offsetTop;

obj = eval(obj);

var judgerY =  obj.offsetHeight + y;
var judgerX =  obj.offsetWidth  + x;

var py = 0;
var px = 0;

if(judgerY>=document.body.clientHeight)
{
py = 1;
}

if(judgerX>= document.body.clientWidth)
{
px = 2;
} 

return (px+py);
}

//-----------mouseWave()-------------//

function mouseWave()
{
if(mouseCanSound)
{
theBS.src= IconList[0].src;
}
}

//----------- menu_alpha_down -------//

function menu_alpha_down(obj,num)
{
var obj = eval(obj);

if(obj.filters.Alpha.Opacity > 0 )
{
obj.filters.Alpha.Opacity += -num;
}
else
{
clearInterval(obj.alphaing);
obj.filters.Alpha.Opacity = 0;
obj.alphaing = false;
obj.style.visibility = "hidden";
}
}


//------------ menu_alpha_up --------//

function menu_alpha_up(obj,num)
{
var obj = eval(obj);

if(obj.filters.Alpha.Opacity<100)
obj.filters.Alpha.Opacity += num;
else
{
clearInterval(obj.alphaing);
obj.filters.Alpha.Opacity = 100;
obj.alphaing = false;
}
}

//---------- IE mouseup --------//

function document.onmouseup()
{
HideMenu();
}

-->