//v.2.0 build 81107
/*
Copyright DHTMLX LTD. http://www.dhtmlx.com
To use this component please contact sales@dhtmlx.com to obtain license
*/
function dhtmlXMenuObject(baseId, skin) {var main_self = this;this.addBaseIdAsContextZone = null;this.skin = (skin!=null?skin:"dhx_blue");this.skinPath = "imgs/"+this.skin;this.imagePath = this.skinPath;this._isIE6 = false;if (_isIE){this._isIE6 = (window.XMLHttpRequest==null?true:false)};if (baseId == null){this.base = document.body}else {if (document.getElementById(baseId)!= null) {this.base = document.getElementById(baseId);while (this.base.childNodes.length > 0){this.base.removeChild(this.base.childNodes[0])};this.base.className += " dhtmlxMenu_"+this.skin+"_Middle";this.base._autoSkinUpdate = true;this.addBaseIdAsContextZone = baseId}else {this.base = document.body}};this.topId = "dhxWebMenuTopId";this.menu = new Array();this.subMenuData = new Array();this.menuSelected = -1;this.menuLastClicked = -1;this.idPrefix = "";this.itemTagName = "item";this.itemTextTagName = "itemtext";this.userDataTagName = "userdata";this.itemTipTagName = "tooltip";this.itemHotKeyTagName = "hotkey";this.dirTopLevel = "bottom";this.dirSubLevel = "right";this.menuX1 = null;this.menuX2 = null;this.menuY1 = null;this.menuY2 = null;this.menuMode = "web";this.menuTimeoutMsec = 400;this.menuTimeoutHandler = null;this.idPull = {};this.itemPull = {};this.userData = {};this.radio = {};this.menuTouched = false;this.zIndInit = 1200;this.zInd = this.zIndInit;this.zIndStep = 50;this.menuModeTopLevelTimeout = true;this.menuModeTopLevelTimeoutTime = 200;this.topLevelItemPaddingIconExists = 27;this.topLevelItemPaddingIconNotExists = 6;this._topLevelBottomMargin = 1;this._topLevelRightMargin = 0;this._arrowFFFix = (_isIE ? 0 : -4);this.setSkin = function(skin) {var oldSkin = this.skin;this.skin = skin;switch (this.skin){case "standard":
this._topLevelBottomMargin = 1;this._arrowFFFix = (_isIE ? 0 : -4);break;case "clear_blue":
case "clear_green":
case "clear_silver":
this._topLevelBottomMargin = 3;this._arrowFFFix = (_isIE ? 0 : -4);break;case "aqua_orange":
case "aqua_sky":
case "aqua_dark":
this._topLevelBottomMargin = 1;this._arrowFFFix = (_isIE ? 0 : -2);break;case "modern_blue":
case "modern_red":
case "modern_black":
this._topLevelBottomMargin = 3;this._arrowFFFix = (_isIE ? 0 : -2);break;case "glassy_blue":
this._topLevelBottomMargin = 0;break;case "dhx_black":
case "dhx_blue":
this._topLevelBottomMargin = 2;this._topLevelRightMargin = 1;break};if (this.base._autoSkinUpdate){this.base.className = this.base.className.replace("dhtmlxMenu_"+oldSkin+"_Middle", "")+" dhtmlxMenu_"+this.skin+"_Middle"}};this.setSkin(this.skin);this.dLoad = false;this.dLoadUrl = "";this.loaderIcon = false;this.limit = 0;this._scrollUpTM = null;this._scrollUpTMTime = 20;this._scrollUpTMStep = 3;this._scrollDownTM = null;this._scrollDownTMTime = 20;this._scrollDownTMStep = 3;this.context = false;this.contextZones = {};this.contextMenuZoneId = false;this.contextAutoShow = true;this.contextAutoHide = true;this.sxDacProc = null;this.dacSpeed = 30;this.dacCycles = [];for (var q=0;q<10;q++){this.dacCycles[q] = q};this.dacSpeedIE = 60;this.dacCyclesIE = [];for (var q=0;q<3;q++){this.dacCyclesIE[q] = q*2+1};this._enableDacSupport = function(dac) {this.sxDacProc = dac};this._selectedSubItems = new Array();this._openedPolygons = new Array();this._addSubItemToSelected = function(item, polygon) {var t = true;for (var q=0;q 0 && this.limit < itemCount){var auId = "arrowup_"+id;var adId = "arrowdown_"+id;if (this.idPull["arrowup_"+id] != null){arrowUp = this.idPull["arrowup_"+id];arrowUp.style.visibility = "hidden";arrowUp.style.display = "";arrowUp.style.zIndex = this.zInd;arrUpH = arrowUp.offsetHeight};if (this.idPull["arrowdown_"+id] != null){arrowDown = this.idPull["arrowdown_"+id];arrowDown.style.visibility = "hidden";arrowDown.style.display = "";arrowDown.style.zIndex = this.zInd;arrDownH = arrowDown.offsetHeight}};this.idPull[pId].style.visibility = "hidden";this.idPull[pId].style.display = "";this.idPull[pId].style.zIndex = this.zInd;if (this.limit > 0 && this.limit < itemCount){this.idPull[pId].style.height = this.idPull[pId].childNodes[0].offsetHeight*this.limit;this.idPull[pId].scrollTop = 0};this.zInd += this.zIndStep;if (this.itemPull[id] != null){var parPoly = "polygon_"+this.itemPull[id]["parent"]}else if (this.context){var parPoly = this.idPull[this.idPrefix+this.topId]};var scrTp = (this.idPull[parPoly] != null ? this.idPull[parPoly].scrollTop : 0);var srcX = (this.idPull[id].tagName != null ? getAbsoluteLeft(this.idPull[id]) : this.idPull[id][0]);var srcY = (this.idPull[id].tagName != null ? getAbsoluteTop(this.idPull[id]) : this.idPull[id][1]) - scrTp;var srcW = (this.idPull[id].tagName != null ? this.idPull[id].offsetWidth : 0);var srcH = (this.idPull[id].tagName != null ? this.idPull[id].offsetHeight + arrUpH + arrDownH : 0);var x = 0;var y = 0;var w = this.idPull[pId].offsetWidth;var h = this.idPull[pId].offsetHeight;if (openType == "bottom"){x = srcX - 1 + (openType==this.dirTopLevel?this._topLevelRightMargin:0);y = srcY - 1 + srcH - arrUpH - arrDownH + this._topLevelBottomMargin};if (openType == "right"){x = srcX + srcW - 1;y = srcY + 2};if (openType == "top"){x = srcX - 1;y = srcY - h + 2};var mx = (this.menuX2!=null?this.menuX2:0);var my = (this.menuY2!=null?this.menuY2:0);if (mx == 0){if (window.innerWidth){mx = window.innerWidth;my = window.innerHeight}else {mx = document.body.offsetWidth;my = document.body.scrollHeight}};if (x+w > mx){x = srcX - w + 2};if (y+h > my && this.menuY2 != null){y = srcY + srcH - h + 2};this.idPull[pId].style.left = x+"px";this.idPull[pId].style.top = y+arrUpH+"px";if ((this.sxDacProc != null)&& (this.idPull["sxDac_" + id] != null)) {this.idPull["sxDac_"+id]._show()}else {this.idPull[pId].style.visibility = "";if (this.limit > 0 && this.limit < itemCount){arrowUp.style.left = x+"px";arrowUp.style.top = y+"px";arrowUp.style.width = w+this._arrowFFFix+"px";arrowUp.style.visibility = "";arrowDown.style.left = x+"px";arrowDown.style.top = y+arrUpH+h+"px";arrowDown.style.width = w+this._arrowFFFix+"px";arrowDown.style.visibility = "";this._checkArrowsState(id)};if (this._isIE6){var pIdIE6 = pId+"_ie6cover";if (this.idPull[pIdIE6] == null){var ifr = document.createElement("IFRAME");ifr.className = "dhtmlxMenu_IE6CoverFix_"+this.skin;ifr.frameBorder = 0;document.body.appendChild(ifr)
this.idPull[pIdIE6] = ifr};this.idPull[pIdIE6].style.left = this.idPull[pId].style.left;this.idPull[pIdIE6].style.top = this.idPull[pId].style.top;this.idPull[pIdIE6].style.width = this.idPull[pId].offsetWidth+"px";this.idPull[pIdIE6].style.height = this.idPull[pId].offsetHeight+"px";this.idPull[pIdIE6].style.zIndex = this.idPull[pId].style.zIndex-1;this.idPull[pIdIE6].style.display = ""};this.callEvent("_onPolyShow",[id.replace(this.idPrefix,"")])}}};this._redistribSubLevelSelection = function(id, parentId) {while (this._openedPolygons.length > 0){this._openedPolygons.pop()};var i = this._getSubItemToDeselectByPolygon(parentId);this._removeSubItemFromSelected(-1, -1);for (var q=0;q 0){m = j}}};return m};this._getMenuNodes = function(node) {var m = new Array;for (var a in this.itemPull){if (this.itemPull[a]["parent"] == node){m[m.length] = a}};return m};this._genStr = function(w) {var s = "";var z = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";for (var q=0;q 0){main_self._openedPolygons.pop()};for (var q=0;q0));if (this.dLoad && item["complex"]){item["loaded"] = "no"};this.itemPull[item["id"]] = item;for (var w=0;w 1){item._menuOpenTM = window.oldSetTimeout(function(){main_self._showPolygon(pId, level)}, delay);isShow = true}}};if (!isShow){main_self._showPolygon(pId, level)}};main_self.itemPull[main_self.idPrefix+parentId]["loaded"] = "yes";if (main_self.loaderIcon == true){main_self._updateLoaderIcon(main_self.idPrefix+parentId, false)}};this.destructor();main_self.callEvent("onXLE",[])}else {var t = this.getXMLTopNode("menu");main_self._buildMenu(t, null);main_self.init();main_self.callEvent("onXLE",[]);main_self._doOnLoad()}};this._xmlLoader = new dtmlXMLLoaderObject(this._xmlParser, window);this._showSubLevelItem = function(id,back) {if (document.getElementById("arrow_" + this.idPrefix + id)!= null) {document.getElementById("arrow_" + this.idPrefix + id).style.display = (back?"none":"")};if (document.getElementById("image_" + this.idPrefix + id)!= null) {document.getElementById("image_" + this.idPrefix + id).style.display = (back?"none":"")};if (document.getElementById(this.idPrefix + id)!= null) {document.getElementById(this.idPrefix + id).style.display = (back?"":"none")}};this._hideSubLevelItem = function(id) {this._showSubLevelItem(id,true)
};this.idPrefix = this._genStr(12);dhtmlxEvent(document.body, "click", function(){if (main_self.context){main_self._hideContextMenu()}else {main_self._clearAndHide()}});dhtmlxEvent(document.body, "contextmenu", function(e) {if (main_self._skip_hide){main_self._skip_hide = false;return};e = e||event;var toHide = true;var testZone = e.target || e.srcElement;if (testZone.id != null){if (main_self.isContextZone(testZone.id)) {toHide = false}};if (toHide){main_self.hideContextMenu()}});this.dhx_Event();return this};dhtmlXMenuObject.prototype.init = function() {if (this._isInited == true){return};if (this.dLoad){this.callEvent("onXLS", []);this._xmlLoader.loadXML(this.dLoadUrl+"?action=loadMenu&etc="+new Date().getTime())}else {this._initTopLevelMenu();this._isInited = true}};dhtmlXMenuObject.prototype._initTopLevelMenu = function() {this.dirTopLevel = "bottom";this.dirSubLevel = "right";if (this.context){this.idPull[this.idPrefix+this.topId] = new Array(0,0);this._addSubMenuPolygon(this.idPrefix+this.topId, this.idPrefix+this.topId);this._attachEvents()}else {var m = this._getMenuNodes(this.idPrefix + this.topId);for (var q=0;q 0)&& (!this.itemPull[id]["complex"])) {this._updateItemComplexState(id, true, false)};if ((u == 0)&& (this.itemPull[id]["complex"])) {this._updateItemComplexState(id, false, false)}}};dhtmlXMenuObject.prototype._updateItemComplexState = function(id, state, over) {if ((!this.context)&& (this._getItemLevelType(id.replace(this.idPrefix,"")) == "TopLevel")) {this.itemPull[id]["complex"] = state;return};if ((this.idPull[id] == null)|| (this.itemPull[id] == null)) {return};this.itemPull[id]["complex"] = state;var arrowObj = null;if (id == this.idPrefix+this.topId){return};for (var q=0;q