function openmenu(id,e){ if(menu){ var item=menu.getItem(id); if(item){ item.closeSiblings(); if(!item.isOpen()) item.open(e); } } } function menuItem(text,href,id){ this.text=text; this.href=href; this.id=id; this.parent=null; this.parentCell=null; this.timer=null; this.items=new Array(); this.expand=null; this.isActive=false; this.openLeft=false; this.addItem=function addItem(item){ this.items.push(item); item.parent=this; }; this.getItem=function getItem(itemId){ if(this.id==itemId){ return this; } for(var i=0;i=0) this.parentCell.className=this.parentCell.className.replace(/ItemOver/,"Item"); if(tbl) this.parentCell.removeChild(tbl); } }; this.closeSiblings=function closeSiblings(){ for(var i=0;i0){ item.expand=document.createElement('img'); item.expand.src="/images/expand0.png"; item.expand.className="submenuItem"; item.expand.style.right="5px"; cell.appendChild(item.expand); } tbl.appendChild(cell); } if(cell) cell.style.borderStyle="none"; var parent=(this.parent!=menu?this.parent.parentCell:document.getElementById(this.id)); if(!this.parentCell){ if(this.parent==menu) this.parentCell=document.getElementById(this.id+this.text); else if(e) this.parentCell=(e.currentTarget?e.currentTarget:e.srcElement); else this.parentCell=document.getElementById(this.id).lastChild; } tbl.id="submenu"+this.id; tbl.className="submenu"; var left,top,width; tbl.menuId=this; if(tbl.attachEvent){ tbl.attachEvent("onmouseover",menuMouseOver); tbl.attachEvent("onmouseout",menuMouseOut); tbl.attachEvent("onmousedown",menuClick); document.body.appendChild(tbl); width=getWidth(tbl); document.body.removeChild(tbl); } else{ tbl.addEventListener("mouseover",menuMouseOver,false); tbl.addEventListener("mouseout",menuMouseOut,false); tbl.addEventListener("mousedown",menuClick,false); } var show=tbl.innerHTML!="" if(show || this.parent==menu){ tbl.style.zIndex="5"; this.parentCell.appendChild(tbl); this.timer=menuOpenTime; if(document.documentMode && document.documentMode<8){ left=getLeft(this.parentCell); top=getTop(tbl); if(this.isActive){ //left-=3; } else if(this.parent==menu){ top+=18; } else{ left+=getWidth(this.parentCell); top-=1; } } else{ left=getLeft(tbl)-1; top=getTop(tbl); width=getWidth(tbl); if(this.parent==menu){ top+=2; } else{ left+=getWidth(this.parentCell)-2; top=getTop(this.parentCell)+7; if(document.documentMode){ left--; top--; } } } if(left>700) this.openLeft=true; if(this.parent.openLeft){ tbl.style.right=left+"px"; this.openLeft=true; } else tbl.style.left=left+"px"; tbl.style.top=top+"px"; width=Math.max(100,width); tbl.style.width=width+"px"; if(this.parent==menu){ i=find(this.parent.items,this)-1; i=(i>=0 && this.parent.items[i].isActive?1:0); var cell=document.createElement('div'); var width; cell.className="tab"; cell.style.top="-19px"; cell.innerHTML=this.text+"W"; tbl.appendChild(cell); width=getWidth(cell)+4; left=Math.floor((getWidth(this.parentCell)-width)/2); cell.style.width=width+"px"; cell.style.left=left+"px"; cell.innerHTML=this.text; if(cell.attachEvent){ cell.menuId=this; cell.attachEvent("onmousedown",menuClick); } if(this.isActive){ tbl.style.display="inline"; tbl.style.top=(top+(document.documentMode?0:-1))+"px"; } cell=document.createElement('div'); cell.className="tabLeft"; cell.style.left=(left-20)+"px"; cell.style.top=(-18-i)+"px"; tbl.appendChild(cell); if(cell.attachEvent){ cell.menuId=this; cell.attachEvent("onmousedown",menuClick); } cell=document.createElement('div'); cell.className="tabRight"; cell.style.left=(left+width-1)+"px"; cell.style.top="-18px"; tbl.appendChild(cell); if(cell.attachEvent){ cell.menuId=this; cell.attachEvent("onmousedown",menuClick); } cell=document.createElement('div'); cell.className="tabBottom"; cell.style.top="-1px"; tbl.appendChild(cell); cell.style.width=width+"px"; cell.style.left=left+"px"; if(cell.attachEvent){ cell.menuId=this; cell.attachEvent("onmousedown",menuClick); } } if(show){ var height=Math.max(0,16+tbl.clientHeight-this.parentCell.parentNode.offsetHeight+this.parentCell.offsetTop); var cell=document.createElement('div'); cell.className="shadow"; cell.style.right="-7px"; cell.style.bottom="-7px"; if(this.parent.openLeft) cell.style.height=height+"px"; else cell.style.height=tbl.clientHeight+"px"; if(!this.parent.openLeft || height>0) tbl.appendChild(cell); cell=document.createElement('div'); cell.className="shadow"; cell.style.right="-1px"; cell.style.bottom="-7px"; cell.style.height="6px"; cell.style.width=(tbl.clientWidth-5)+"px"; tbl.appendChild(cell); } else{ tbl.style.borderColor="#c3c3c3"; tbl.style.borderBottom="0px"; tbl.style.width="0px"; } } }; } function find(items,target){ for(i=0;i=0) obj.className+="Over"; openmenu(obj.menuId.id,e); obj.menuId.clearCloseTimer(); } } function menuMouseOut(e){ var obj=(e.currentTarget?e.currentTarget:e.srcElement); var rel=(e.relatedTarget?e.relatedTarget:e.toElement); if(obj.menuId){ try{ if(rel && !rel.menuId) rel=rel.parentNode; if(!(rel && rel.menuId && obj.menuId.getItem(rel.menuId.id))){ if(obj.menuId.expand) obj.menuId.expand.src="/images/expand0.png"; do{ obj.menuId.setCloseTimer(); obj=obj.menuId.parent.parentCell; }while(obj && obj!=rel); } } catch(err){ do{ obj.menuId.setCloseTimer(); obj=obj.menuId.parent.parentCell; }while(obj && obj.menuId); } } } function makeActive(menuItem){ if(menuItem){ tblwidth=getWidth(menuItem); menuItem.style.width=tblwidth+"px"; menuItem.innerHTML=" "; menuItem.menuId.isActive=true; var tbl=document.createElement('div'); var left=0, top=0, width=0; tbl.className="submenuActive"; menuItem.appendChild(tbl); tbl.style.position="relative"; tbl.style.marginLeft="-1px"; tbl.style.marginRight="-11px"; width=Math.max(100,width); //tbl.style.width=width+"px"; if(document.documentMode){ if(document.documentMode<8){ menuItem.style.color="#c3c3c3"; top=2; } else{ //left+=getWidth(menuItem); top+=3; } } else top+=2; tbl.style.left=left+"px"; tbl.style.top=top+"px"; var cell=document.createElement('div'); var width; cell.className="tab"; cell.style.top="-19px"; //cell.style.color="#309a65"; cell.innerHTML=menuItem.menuId.text+"W"; tbl.appendChild(cell); width=getWidth(cell)+4; left=Math.floor((getWidth(menuItem)-width)/2); cell.style.width=width+"px"; cell.style.left=left+"px"; cell.style.filter="alpha(opacity=80)"; cell.innerHTML=menuItem.menuId.text; if(cell.attachEvent){ cell.menuId=menuItem.menuId; cell.attachEvent("onmouseover",menuMouseOver); cell.attachEvent("onmousedown",menuClick); } cell=document.createElement('div'); cell.style.top="-1px"; tbl.appendChild(cell); cell.className="tabBottom"; cell.style.width=width+"px"; cell.style.left=left+"px"; //cell.style.filter="alpha(opacity=80)"; cell=document.createElement('div'); cell.className="tabLeft"; cell.style.left=(left-20)+"px"; cell.style.top="-18px"; //cell.style.filter="alpha(opacity=80)"; tbl.appendChild(cell); cell=document.createElement('div'); cell.className="tabRight"; cell.style.left=(left+width)+"px"; cell.style.top="-18px"; //cell.style.filter="alpha(opacity=80)"; tbl.appendChild(cell); tbl.style.borderColor="#c3c3c3"; tbl.style.borderBottom="0px"; tbl.style.zIndex="0"; } } function menuClick(e){ var obj=(e.currentTarget?e.currentTarget:e.srcElement); if(obj.menuId){ e.cancelBubble=true; if(obj.menuId.href.indexOf("javascript:")==0) eval(obj.menuId.href.substr(11)); else if(e.button==(e.currentTarget?1:4) || (e.ctrlKey && e.button==(e.currentTarget?0:1)))//middle or ctrl+left window.open(obj.menuId.href,'_blank'); else if(e.button==(e.currentTarget?0:1))//left window.location=obj.menuId.href; } } function menuCancel(e){ var key=(e.which?e.which:e.keyCode); if(key==27) for(var i=0;i