//v.3.6 build 131108
/*
Copyright DHTMLX LTD. http://www.dhtmlx.com
You allowed to use this component or parts of it under GPL terms
To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
*/
function dhtmlXMenuObject(b,c){var a=this;this.addBaseIdAsContextZone=null;this.isDhtmlxMenuObject=!0;this.skin=c!=null?c:typeof dhtmlx!="undefined"&&typeof dhtmlx.skin=="string"?dhtmlx.skin:"dhx_skyblue";this.imagePath="";this._isIE6=!1;if(_isIE)this._isIE6=window.XMLHttpRequest==null?!0:!1;if(b==null)this.base=document.body;else{var d=typeof b=="string"?document.getElementById(b):b;if(d!=null){this.base=d;if(!this.base.id)this.base.id=(new Date).valueOf();for(;this.base.childNodes.length>0;)this.base.removeChild(this.base.childNodes[0]);
this.base.className+=" dhtmlxMenu_"+this.skin+"_Middle dir_left";this.base._autoSkinUpdate=!0;if(this.base.oncontextmenu)this.base._oldContextMenuHandler=this.base.oncontextmenu;this.addBaseIdAsContextZone=this.base.id;this.base.onselectstart=function(a){a=a||event;return a.returnValue=!1};this.base.oncontextmenu=function(a){a=a||event;return a.returnValue=!1}}else this.base=document.body}this.topId="dhxWebMenuTopId";if(!this.extendedModule){for(var f=function(){alert(this.i18n.dhxmenuextalert)},
e="setItemEnabled,setItemDisabled,isItemEnabled,_changeItemState,getItemText,setItemText,loadFromHTML,hideItem,showItem,isItemHidden,_changeItemVisible,setUserData,getUserData,setOpenMode,setWebModeTimeout,enableDynamicLoading,_updateLoaderIcon,getItemImage,setItemImage,clearItemImage,setAutoShowMode,setAutoHideMode,setContextMenuHideAllMode,getContextMenuHideAllMode,setVisibleArea,setTooltip,getTooltip,setHotKey,getHotKey,setItemSelected,setTopText,setRTL,setAlign,setHref,clearHref,getCircuit,_clearAllSelectedSubItemsInPolygon,_checkArrowsState,_addUpArrow,_addDownArrow,_removeUpArrow,_removeDownArrow,_isArrowExists,_doScrollUp,_doScrollDown,_countPolygonItems,setOverflowHeight,_getRadioImgObj,_setRadioState,_radioOnClickHandler,getRadioChecked,setRadioChecked,addRadioButton,_getCheckboxState,_setCheckboxState,_readLevel,_updateCheckboxImage,_checkboxOnClickHandler,setCheckboxState,getCheckboxState,addCheckbox,serialize".split(","),
g=0;gthis.menuY1+this.menuY2){var m=Math.floor((this.menuY2-this.menuY1-35)/24);this.limit=m}else this.limit=0,this.idPull["arrowup_"+a]!=null&&this._removeUpArrow(String(a).replace(this.idPrefix,
"")),this.idPull["arrowdown_"+a]!=null&&this._removeDownArrow(String(a).replace(this.idPrefix,""));if(this.limit>0&&this.limit0)this.limitw&&!this._rtl&&(l=q-s+2);ly&&this.menuY2!=null&&(n=Math.max(t+B-v+2,this._isVisibleArea?this.menuY1+2:2),this.context&&this.idPrefix+this.topId==a&&i!=null&&(n-=2),this.itemPull[a]!=null&&!this.context&&this.itemPull[a].parent==this.idPrefix+this.topId&&(n-=this.base.offsetHeight));
this.idPull[d].style.left=l+"px";this.idPull[d].style.top=n+e+"px";if(typeof this._menuEffect!="undefined"&&this._menuEffect!==!1)this._showPolygonEffect(d);else{this.idPull[d].style.visibility="";if(this.limit>0&&this.limit0;)this._openedPolygons.pop();var c=this._getSubItemToDeselectByPolygon(b);this._removeSubItemFromSelected(-1,-1);for(var d=0;d0&&(c=e)}return c};this._getMenuNodes=function(a){var b=[],c;for(c in this.itemPull)this.itemPull[c].parent==a&&(b[b.length]=c);return b};this._genStr=function(a){for(var b="",c="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",d=0;d0;)a._openedPolygons.pop();for(var b=0;b0;this.dLoad&&f.complex&&(f.loaded="no");this.itemPull[f.id]=f;for(var g=0;g1)g._menuOpenTM=window.setTimeout(function(){a._showPolygon(c,e)},p),f=!0}}f||a._showPolygon(c,e)}a.itemPull[a.idPrefix+parentId].loaded="yes";a.loaderIcon==!0&&a._updateLoaderIcon(a.idPrefix+parentId,!1)}this.destructor();a.callEvent("onXLE",[])}else b=this.getXMLTopNode("menu"),a._buildMenu(b,null),a.init(),a.callEvent("onXLE",[]),a._doOnLoad()};
this._xmlLoader=new dtmlXMLLoaderObject(this._xmlParser,window);this._showSubLevelItem=function(a,b){if(document.getElementById("arrow_"+this.idPrefix+a)!=null)document.getElementById("arrow_"+this.idPrefix+a).style.display=b?"none":"";if(document.getElementById("image_"+this.idPrefix+a)!=null)document.getElementById("image_"+this.idPrefix+a).style.display=b?"none":"";if(document.getElementById(this.idPrefix+a)!=null)document.getElementById(this.idPrefix+a).style.display=b?"":"none"};this._hideSubLevelItem=
function(a){this._showSubLevelItem(a,!0)};this.idPrefix=this._genStr(12);this._bodyClick=function(b){b=b||event;b.button==2||_isOpera&&b.ctrlKey==!0||(a.context?a.contextAutoHide&&(!_isOpera||a._isContextMenuVisible()&&_isOpera)&&a._hideContextMenu():a._clearAndHide&&a._clearAndHide())};this._bodyContext=function(b){var b=b||event,c=String((b.srcElement||b.target).className);if(!(c.search("dhtmlxMenu")!=-1&&c.search("SubLevelArea")!=-1)){for(var d=!0,e=b.target||b.srcElement;e!=null;)e.id!=null&&
a.isContextZone(e.id)&&(d=!1),e==document.body&&(d=!1),e=e.parentNode;d&&a.hideContextMenu()}};typeof window.addEventListener!="undefined"?(window.addEventListener("click",this._bodyClick,!1),window.addEventListener("contextmenu",this._bodyContext,!1)):(document.body.attachEvent("onclick",this._bodyClick),document.body.attachEvent("oncontextmenu",this._bodyContext));this._UID=this._genStr(32);dhtmlxMenuObjectLiveInstances[this._UID]=this;dhtmlxEventable(this);return this}
dhtmlXMenuObject.prototype.init=function(){if(this._isInited!=!0)this.dLoad?(this.callEvent("onXLS",[]),this._xmlLoader.loadXML(this.dLoadUrl+this.dLoadSign+"action=loadMenu&etc="+(new Date).getTime())):(this._initTopLevelMenu(),this._isInited=!0)};
dhtmlXMenuObject.prototype._countVisiblePolygonItems=function(b){var c=0,a;for(a in this.itemPull){var d=this.itemPull[a].parent,f=this.itemPull[a].type;this.idPull[a]!=null&&d==b&&(f=="item"||f=="radio"||f=="checkbox")&&this.idPull[a].style.display!="none"&&c++}return c};
dhtmlXMenuObject.prototype._redefineComplexState=function(b){if(this.idPrefix+this.topId!=b&&this.idPull["polygon_"+b]!=null&&this.idPull[b]!=null){var c=this._countVisiblePolygonItems(b);c>0&&!this.itemPull[b].complex&&this._updateItemComplexState(b,!0,!1);c==0&&this.itemPull[b].complex&&this._updateItemComplexState(b,!1,!1)}};
dhtmlXMenuObject.prototype._updateItemComplexState=function(b,c){if(!this.context&&this._getItemLevelType(b.replace(this.idPrefix,""))=="TopLevel")this.itemPull[b].complex=c;else if(!(this.idPull[b]==null||this.itemPull[b]==null))if(this.itemPull[b].complex=c,b!=this.idPrefix+this.topId){var a=null,d=this.idPull[b].childNodes[this._rtl?0:2];d.childNodes[0]&&String(d.childNodes[0].className).search("complex_arrow")===0&&(a=d.childNodes[0]);if(this.itemPull[b].complex){if(a==null){a=document.createElement("DIV");
a.className="complex_arrow";for(a.id="arrow_"+b;d.childNodes.length>0;)d.removeChild(d.childNodes[0]);d.appendChild(a)}if(this.dLoad&&this.itemPull[b].loaded=="get"&&this.loaderIcon){if(a.className!="complex_arrow_loading")a.className="complex_arrow_loading"}else a.className="complex_arrow"}else!this.itemPull[b].complex&&a!=null&&(d.removeChild(a),this.itemPull[b].hotkey_backup!=null&&this.setHotKey&&this.setHotKey(b.replace(this.idPrefix,""),this.itemPull[b].hotkey_backup))}};
dhtmlXMenuObject.prototype._getItemLevelType=function(b){return this.itemPull[this.idPrefix+b].parent==this.idPrefix+this.topId?"TopLevel":"SubLevelArea"};
dhtmlXMenuObject.prototype._redistribTopLevelSelection=function(b){var c=this._getSubItemToDeselectByPolygon("parent");this._removeSubItemFromSelected(-1,-1);for(var a=0;a0)d.title=
this.itemPull[b].tip;if(this.itemPull[b].imgen!=""||this.itemPull[b].imgdis!=""){var e=this.itemPull[b][this.itemPull[b].state=="enabled"?"imgen":"imgdis"];if(e){var g=document.createElement("IMG");g.border="0";g.id="image_"+b;g.src=this.imagePath+e;g.className="dhtmlxMenu_TopLevel_Item_Icon";d.childNodes.length>0&&!this._rtl?d.insertBefore(g,d.childNodes[0]):d.appendChild(g)}}d.onselectstart=function(a){a=a||event;return a.returnValue=!1};d.oncontextmenu=function(a){a=a||event;return a.returnValue=
!1};if(!this.cont)this.cont=document.createElement("DIV"),this.cont.dir="ltr",this.cont.className=this._align=="right"?"align_right":"align_left",this.base.appendChild(this.cont);c!=null&&(c++,c<0&&(c=0),c>this.cont.childNodes.length-1&&(c=null));c!=null?this.cont.insertBefore(d,this.cont.childNodes[c]):this.cont.appendChild(d);this.idPull[d.id]=d;this.itemPull[b].complex&&!this.dLoad&&this._addSubMenuPolygon(this.itemPull[b].id,this.itemPull[b].id);d.onmouseover=function(){a.menuMode=="web"&&window.clearTimeout(a.menuTimeoutHandler);
var b=a._getSubItemToDeselectByPolygon("parent");a._removeSubItemFromSelected(-1,-1);for(var c=0;c0)if(a!=null)a.src=this.imagePath+g;else if(c)a=document.createElement("IMG"),a.className="dhtmlxMenu_TopLevel_Item_Icon",a.src=this.imagePath+g,a.border="0",a.id="image_"+b,!this._rtl&&this.idPull[b].childNodes.length>0?this.idPull[b].insertBefore(a,this.idPull[b].childNodes[0]):this.idPull[b].appendChild(a);else{a=document.createElement("IMG");a.className="sub_icon";a.src=this.imagePath+g;a.border="0";a.id="image_"+
b;for(var h=this.idPull[b].childNodes[this._rtl?2:0];h.childNodes.length>0;)h.removeChild(h.childNodes[0]);h.appendChild(a)}else a!=null&&a.parentNode.removeChild(a)};
dhtmlXMenuObject.prototype.removeItem=function(b,c,a){c||(b=this.idPrefix+b);var d=null;if(b!=this.idPrefix+this.topId){if(this.itemPull[b]==null)return;this.idPull["polygon_"+b]&&this.idPull["polygon_"+b]._tmShow&&window.clearTimeout(this.idPull["polygon_"+b]._tmShow);var f=this.itemPull[b].type;if(f=="separator"){var e=this.idPull["separator_"+b];this.itemPull[b].parent==this.idPrefix+this.topId?(e.onclick=null,e.onselectstart=null,e.id=null):(e.childNodes[0].childNodes[0].onclick=null,e.childNodes[0].childNodes[0].onselectstart=
null,e.childNodes[0].childNodes[0].id=null,e.childNodes[0].removeChild(e.childNodes[0].childNodes[0]),e.removeChild(e.childNodes[0]));e.parentNode.removeChild(e);this.idPull["separator_"+b]=null;this.itemPull[b]=null;delete this.idPull["separator_"+b]}else{d=this.itemPull[b].parent;e=this.idPull[b];e.onclick=null;e.oncontextmenu=null;e.onmouseover=null;e.onmouseout=null;e.onselectstart=null;for(e.id=null;e.childNodes.length>0;)e.removeChild(e.childNodes[0]);e.parentNode.removeChild(e);this.idPull[b]=
null;this.itemPull[b]=null;delete this.idPull[b]}delete this.itemPull[b];f=e=null}for(var g in this.itemPull)this.itemPull[g].parent==b&&this.removeItem(g,!0,!0);var h=Array(b);d!=null&&!a&&this.idPull["polygon_"+d]!=null&&this.idPull["polygon_"+d].tbd.childNodes.length==0&&(h.push(d),this._updateItemComplexState(d,!1,!1));for(var j=0;j0&&!this.itemPull[b].complex){var A=document.createElement("DIV");A.className="sub_item_hk";A.innerHTML=this.itemPull[b].hotkey;o.appendChild(A)}else o.innerHTML=" ";d.appendChild(this._rtl?o:f);d.appendChild(j);d.appendChild(this._rtl?f:o);d.id=this.itemPull[b].id;d.parent=this.itemPull[b].parent;if(this.itemPull[b].tip.length>0)d.title=this.itemPull[b].tip;if(!this._hideTMData)this._hideTMData=
{};d.onselectstart=function(a){a=a||event;return a.returnValue=!1};d.onmouseover=function(){a._hideTMData[this.id]&&window.clearTimeout(a._hideTMData[this.id]);a.menuMode=="web"&&window.clearTimeout(a.menuTimeoutHandler);this._visible||a._redistribSubLevelSelection(this.id,this.parent);this._visible=!0};d.onmouseout=function(){if(a.menuMode=="web")a.menuTimeoutHandler&&window.clearTimeout(a.menuTimeoutHandler),a.menuTimeoutHandler=window.setTimeout(function(){a&&a._clearAndHide&&a._clearAndHide()},
a.menuTimeoutMsec,"JavaScript");var b=this;a._hideTMData[this.id]&&window.clearTimeout(a._hideTMData[this.id]);a._hideTMData[this.id]=window.setTimeout(function(){b._visible=!1},50)};d.onclick=function(b){if(a.checkEvent("onClick")||!a.itemPull[this.id].complex){b=b||event;b.cancelBubble=!0;b.returnValue=!1;tc=a.itemPull[this.id].complex?"c":"-";td=a.itemPull[this.id].state=="enabled"?"-":"d";var c={ctrl:b.ctrlKey,alt:b.altKey,shift:b.shiftKey};switch(a.itemPull[this.id].type){case "checkbox":a._checkboxOnClickHandler(this.id.replace(a.idPrefix,
""),tc+td+"n",c);break;case "radio":a._radioOnClickHandler(this.id.replace(a.idPrefix,""),tc+td+"n",c);break;case "item":a._doOnClick(this.id.replace(a.idPrefix,""),tc+td+"n",c)}return!1}};var p=this.idPull["polygon_"+this.itemPull[b].parent];c!=null&&(c++,c<0&&(c=0),c>p.tbd.childNodes.length-1&&(c=null));c!=null&&p.tbd.childNodes[c]!=null?p.tbd.insertBefore(d,p.tbd.childNodes[c]):p.tbd.appendChild(d);this.idPull[d.id]=d};
dhtmlXMenuObject.prototype._renderSeparator=function(b,c){var a=this.context?"SubLevelArea":this.itemPull[b].parent==this.idPrefix+this.topId?"TopLevel":"SubLevelArea";if(!(a=="TopLevel"&&this.context)){var d=this;if(a!="TopLevel"){var f=document.createElement("TR");f.className="sub_sep";var e=document.createElement("TD");e.colSpan="3";f.appendChild(e)}var g=document.createElement("DIV");g.id="separator_"+b;g.className=a=="TopLevel"?"top_sep":"sub_sep";g.onselectstart=function(a){a=a||event;a.returnValue=
!1};g.onclick=function(a){a=a||event;a.cancelBubble=!0;var b={ctrl:a.ctrlKey,alt:a.altKey,shift:a.shiftKey};d._doOnClick(this.id.replace("separator_"+d.idPrefix,""),"--s",b)};if(a=="TopLevel"){if(c!=null)c++,c<0&&(c=0),this.cont.childNodes[c]!=null?this.cont.insertBefore(g,this.cont.childNodes[c]):this.cont.appendChild(g);else{var h=this.cont.childNodes[this.cont.childNodes.length-1];String(h).search("TopLevel_Text")==-1?this.cont.appendChild(g):this.cont.insertBefore(g,h)}this.idPull[g.id]=g}else{var j=
this.idPull["polygon_"+this.itemPull[b].parent];c!=null&&(c++,c<0&&(c=0),c>j.tbd.childNodes.length-1&&(c=null));c!=null&&j.tbd.childNodes[c]!=null?j.tbd.insertBefore(f,j.tbd.childNodes[c]):j.tbd.appendChild(f);e.appendChild(g);this.idPull[g.id]=f}}};dhtmlXMenuObject.prototype.addNewSeparator=function(b,c){var c=this.idPrefix+(c!=null?c:this._genStr(24)),a=this.idPrefix+this.getParentId(b);this._addItemIntoGlobalStrorage(c,a,"","separator",!1,"","");this._renderSeparator(c,this.getItemPosition(b))};
dhtmlXMenuObject.prototype.hide=function(){this._clearAndHide()};dhtmlXMenuObject.prototype.clearAll=function(){this.removeItem(this.idPrefix+this.topId,!0);this._isInited=!1;this.idPrefix=this._genStr(12);this.itemPull={}};
dhtmlXMenuObject.prototype.unload=function(){typeof window.addEventListener=="function"?(window.removeEventListener("click",this._bodyClick,!1),window.removeEventListener("contextmenu",this._bodyContext,!1)):(document.body.detachEvent("onclick",this._bodyClick),document.body.detachEvent("oncontextmenu",this._bodyContext));this._bodyContext=this._bodyClick=null;this.removeItem(this.idPrefix+this.topId,!0);this.idPull=this.itemPull=null;if(this.context)for(var b in this.contextZones)this.removeContextZone(b);
if(this.cont!=null)this.cont.className="",this.cont.parentNode.removeChild(this.cont),this.cont=null;if(this.base!=null){this.base.className="";if(!this.context)this.base.oncontextmenu=this.base._oldContextMenuHandler||null;this.base=this.base.onselectstart=null}this.setSkin=null;this.detachAllEvents();if(this._xmlLoader)this._xmlLoader.destructor(),this._xmlLoader=null;this.extendedModule=this.serialize=this.addCheckbox=this.getCheckboxState=this.setCheckboxState=this.addRadioButton=this.setRadioChecked=
this.getRadioChecked=this.userData=this.setOverflowHeight=this.contextZones=this.getCircuit=this.clearHref=this.setHref=this.setAlign=this.setRTL=this.setTopText=this.setItemSelected=this.getHotKey=this.setHotKey=this.getTooltip=this.setTooltip=this.setVisibleArea=this.getContextMenuHideAllMode=this.setContextMenuHideAllMode=this.setAutoHideMode=this.setAutoShowMode=this.clearItemImage=this.setItemImage=this.getItemImage=this.enableDynamicLoading=this.setWebModeTimeout=this.setOpenMode=this.getUserData=
this.setUserData=this.isItemHidden=this.showItem=this.hideItem=this.loadFromHTML=this.setItemText=this.getItemText=this.isItemEnabled=this.setItemDisabled=this.setItemEnabled=this._removeArrow=this._checkboxOnClickHandler=this._updateCheckboxImage=this._readLevel=this._setCheckboxState=this._getCheckboxState=this._radioOnClickHandler=this._setRadioState=this._getRadioImgObj=this._countPolygonItems=this._doScrollDown=this._doScrollUp=this._isArrowExists=this._removeDownArrow=this._removeUpArrow=this._addDownArrow=
this._addUpArrow=this._checkArrowsState=this._clearAllSelectedSubItemsInPolygon=this._updateLoaderIcon=this._changeItemVisible=this._changeItemState=this.hideContextMenu=this.showContextMenu=this.hide=this.detachAllEvents=this.radio=this.items=this.unload=this.dhx_Event=this.detachEvent=this.eventCatcher=this.checkEvent=this.callEvent=this.attachEvent=this.addNewSeparator=this.addNewChild=this.addNewSibling=this.getParentId=this.setItemPosition=this.getItemPosition=this.clearAll=this._hideContextMenu=
this._renderSeparator=this._renderSublevelItem=this._renderSublevelPolygon=this._addSubMenuPolygon=this._addItemIntoGlobalStrorage=this._autoDetectVisibleArea=this._doOnContextBeforeCall=this._showContextMenu=this._isContextMenuVisible=this.isContextZone=this.removeContextZone=this.addContextZone=this.renderAsContextMenu=this._getAllParents=this.removeItem=this._updateItemImage=this.setIconPath=this.setIconsPath=this.setImagePath=this._renderToplevelItem=this._initTopLevelMenu=this._redistribTopLevelSelection=
this._getItemLevelType=this._updateItemComplexState=this._redefineComplexState=this._countVisiblePolygonItems=this._hideSubLevelItem=this._showSubLevelItem=this._xmlParser=this._buildMenu=this.loadXMLString=this.loadXML=this.init=this.forEachItem=this.getItemType=this._doOnLoad=this._clearAndHide=this._genStr=this._getMenuNodes=this._searchMenuNode=this._doOnTouchMenu=this._doOnClick=this._redistribSubLevelSelection=this._showPolygon=this._hidePolygon=this._getSubItemToDeselectByPolygon=this._removeSubItemFromSelected=
this._addSubItemToSelected=this._openedPolygons=this._selectedSubItems=this._enableDacSupport=this.zIndStep=this.zIndInit=this.zInd=this.dacSpeedIE=this.dacSpeed=this.dacCyclesIE=this.dacCycles=this.topId=this.skin=this.userDataTagName=this.itemTipTagName=this.itemTextTagName=this.itemTagName=this.itemHrefTagName=this.itemHotKeyTagName=this.isDhtmlxMenuObject=this.menuTouched=this.menuTimeoutMsec=this.menuTimeoutHandler=this.menuModeTopLevelTimeoutTime=this.menuModeTopLevelTimeout=this.menuMode=this.imagePath=
this.idPrefix=this.menuLastClicked=this.menuSelected=this.limit=this.dirTopLevel=this.dirSubLevel=this.fixedPosition=this.loaderIcon=this.dLoadUrl=this.dLoadSign=this.dLoad=this.contextMenuZoneId=this.contextHideAllMode=this.contextAutoShow=this.contextAutoHide=this.context=this.addBaseIdAsContextZone=this._topLevelRightMargin=this._topLevelBottomMargin=this._topLevelOffsetLeft=this._topLevelBottomMargin=this._scrollUpTMTime=this._scrollUpTMStep=this._scrollDownTMTime=this._scrollDownTMStep=this._rtl=
this._isInited=this._isIE6=this._arrowFFFix=this._align=null;dhtmlxMenuObjectLiveInstances[this._UID]=null;try{delete dhtmlxMenuObjectLiveInstances[this._UID]}catch(c){}this._UID=null};var dhtmlxMenuObjectLiveInstances={};dhtmlXMenuObject.prototype.i18n={dhxmenuextalert:"dhtmlxmenu_ext.js required"};
(function(){dhtmlx.extend_api("dhtmlXMenuObject",{_init:function(b){return[b.parent,b.skin]},align:"setAlign",top_text:"setTopText",context:"renderAsContextMenu",icon_path:"setIconsPath",open_mode:"setOpenMode",rtl:"setRTL",skin:"setSkin",dynamic:"enableDynamicLoading",xml:"loadXML",items:"items",overflow:"setOverflowHeight"},{items:function(b,c){for(var a=1E5,d=null,f=0;f