var oItem1, oItem2, oItem3, oItem4, oItem5, oItem6, oItem7, oItem8, oItem9, oItem10, oItem11, oItem12, oItem13;
var bMenuOpen=false;
var oSubShowed=null, oSubImg=null;
var aMenu=[];
menuItem=function(sItem) {
    this.item=getDiv(sItem);
    this.subItem=getDiv('sub_'+sItem);
    this.subName='sub_'+sItem;
    this.name=sItem;
    this.imgRoll=true;
    this.showed=false;
    this.diffH=(!is.ns4)?this.subItem.offsetHeight:this.subItem.clip.height;
    this.defY=(!is.ns4)?parseInt(this.item.offsetTop):this.item.top;
    this.defX=(!is.ns4)?parseInt(this.item.offsetLeft):this.item.left;
    aMenu[aMenu.length]=this;
    return this;
}

showMenu=function(nWhich,sWhich) {
    if (oSubShowed) setVisible(oSubShowed.subName,false);
    var oSub=aMenu[nWhich-1]
    var nDiff=oSub.diffH
    for (var i=0; i<aMenu.length; i++) {
        setXY(aMenu[i].name,aMenu[i].defX,aMenu[i].defY)
    }
    if (!oSub.showed) {
        for (var i=nWhich; i<aMenu.length; i++) {
            setXY(aMenu[i].name,aMenu[i].defX,aMenu[i].defY+nDiff)
        }
        swapImage(oSub.name+'_img',Preload.getImgById('left_'+sWhich+'_pick').src,oSub.name);
        setVisible(oSub.subName,true)
        if (oSubShowed && oSubShowed!=oSub) {
            oSubShowed.showed=false;
            oSubShowed.imgRoll=true;
            swapImage(oSubShowed.name+'_img',Preload.getImgById('left_'+oSubImg+'_off').src,oSubShowed.name);
        }
        oSub.imgRoll=false;
        oSub.showed=true;
    } else {
        oSub.showed=false;
        oSub.imgRoll=true;
        swapImage(oSub.name+'_img',Preload.getImgById('left_'+sWhich+'_off').src,oSub.name);
    }
    oSubShowed=aMenu[nWhich-1];
    oSubImg=sWhich;
}
addMenu=function() {
    oItem1=new menuItem('item1');
    oItem2=new menuItem('item2');
    oItem3=new menuItem('item3');
    oItem4=new menuItem('item4');
    oItem5=new menuItem('item5');
    oItem6=new menuItem('item6');
    oItem7=new menuItem('item7');
    oItem8=new menuItem('item8'); 
    oItem9=new menuItem('item9'); 
    oItem10=new menuItem('item10'); 
    oItem11=new menuItem('item11'); 
}
