dhtmlxmenubar.js 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273
  1. /*
  2. * Copyright DHTMLX LTD. http://www.dhtmlx.com You allowed to use this component
  3. * or parts of it under GPL terms To use it on other terms or get Professional
  4. * edition of the component please contact us at sales@dhtmlx.com
  5. */
  6. function dhtmlXMenuBarObject(htmlObject, width, height, name, vMode, gfxPath,
  7. httpsdummy) {
  8. if (typeof(htmlObject) != "object")
  9. this.parentObject = document.getElementById(htmlObject);
  10. else
  11. this.parentObject = htmlObject;
  12. if (!this.parentObject)
  13. this.parentObject = document.body;
  14. this.setGfxPathA = this.setGfxPath;
  15. this.setGfxPath = function() {
  16. this.setGfxPathA.apply(this, arguments);
  17. var self = this;
  18. dhtmlXMenuItemObject.prototype.dummyImg = function() {
  19. return self.sysGfxPath + "blank.gif"
  20. }
  21. };
  22. if ((_isIE) && (this.parentObject == document.body)) {
  23. var zdiv = document.createElement("DIV");
  24. zdiv.style.position = "absolute";
  25. zdiv.style.zIndex = 30;
  26. zdiv.style.top = 0;
  27. zdiv.style.left = 0;
  28. document.body.insertBefore(zdiv, document.body.firstChild);
  29. this.parentObject = zdiv
  30. };
  31. if (!vMode)
  32. this.flsmd = true;
  33. this.tname = name;
  34. this.topMenu = this;
  35. this.width = width;
  36. this.height = height;
  37. this.topNod = 0;
  38. this._httpsdummy = httpsdummy;
  39. this.ieFix = (document.all ? true : false);
  40. var detect = navigator.userAgent.toLowerCase();
  41. place = detect.indexOf('opera') + 1;
  42. if (place)
  43. this.ieFix = false;
  44. this.ieWinMode = true;
  45. this.ieWinModeState = 0;
  46. this.zIndex = 30;
  47. this.maxItems = 99;
  48. this.echsw = true;
  49. this.sysGfxPath = gfxPath;
  50. this.dividerCell = 0;
  51. this.firstCell = 0;
  52. this.nameCell = 0;
  53. this.crossCell = 0;
  54. this.echsw2 = true;
  55. this.tableCSS = "menuTable";
  56. this.titleCSS = "menuName";
  57. this.secTableCSS = "secondMenuTable";
  58. this.extraMode = convertStringToBoolean(vMode);
  59. this.defaultAction = 0;
  60. this.onShow = 0;
  61. this.onHide = 0;
  62. var lastOpenedPanel = 0;
  63. var lastSelectedItem = 0;
  64. this.items = new Array();
  65. this.itemsCount = 0;
  66. this.gitems = new Array();
  67. this.gitemsCount = 0;
  68. this.subMenus = new Array();
  69. this.subMenusCount = 0;
  70. if (!this.extraMode)
  71. this._createPanel();
  72. else
  73. this._createVPanel();
  74. this.hiddenForm = document.createElement("FORM");
  75. this.hiddenForm.style.display = "none";
  76. this.parentObject.appendChild(this.hiddenForm);
  77. if (this._extendedInit)
  78. this._extendedInit();
  79. this.xmlLoader = new dtmlXMLLoaderObject(this._parseXMLTree, this);
  80. this.setMenuMode("classic");
  81. this.setBarSize(this.width, this.height);
  82. this.showBar();
  83. return this
  84. };
  85. dhtmlXMenuBarObject.prototype = new dhtmlXProtobarObject;
  86. dhtmlXMenuBarObject.prototype.setZIndex = function(zIndex) {
  87. this.zIndex = zIndex;
  88. this.topNod.style.zIndex = this.zIndex;
  89. if (this.topNod.ieFix)
  90. this.topNod.ieFix.style.zIndex = this.zIndex - 1;
  91. if ((_isIE) && (this.parentObject)
  92. && (this.parentObject.style.position == "absolute"))
  93. this.parentObject.style.zIndex = zIndex
  94. };
  95. dhtmlXMenuBarObject.prototype.setIconSize = function(size) {
  96. this._aimsize = size
  97. };
  98. function dhtmlXMenuBarPanelObject(parentPanel, parentItem, mode, minWidth,
  99. withoutImages) {
  100. this.extraMode = !convertStringToBoolean(mode);
  101. this.parentPanel = parentPanel;
  102. this.parentItem = parentItem;
  103. this.parentObject = parentPanel.parentObject;
  104. this.topMenu = parentPanel.topMenu;
  105. this.topNod = 0;
  106. this.dividerCell = 0;
  107. this.firstCell = 0;
  108. this.nameCell = 0;
  109. this.crossCell = 0;
  110. this.maxItems = 99;
  111. this.items = new Array();
  112. this.itemsCount = 0;
  113. this.withoutImages = (withoutImages == 1);
  114. this.mixedImages = (withoutImages == 2);
  115. if (minWidth)
  116. this.width = minWidth;
  117. if ((!this.topMenu.flsmd) || (this.topMenu != this.parentPanel))
  118. this.parentItem.setHasChild(true);
  119. if (mode)
  120. this._createVPanel = this.topMenu._createPanel;
  121. else
  122. this._createVPanel = this.topMenu._createVPanel;
  123. this._createVPanel();
  124. this.topNod.panel = this;
  125. this.topNod.onmouseover = this.topMenu._onmouseoverZ;
  126. this.topNod.onmouseout = this.topMenu._onmouseoutZ;
  127. parentItem.subMenu = this;
  128. this.topNod.style.position = "absolute";
  129. this.topMenu.subMenus[this.topMenu.subMenusCount] = this;
  130. this.topMenu.subMenusCount++;
  131. return this
  132. };
  133. dhtmlXMenuBarObject.prototype.enableIESelectBoxFix = function(mode) {
  134. this.ieFix = convertStringToBoolean(mode)
  135. };
  136. dhtmlXMenuBarObject.prototype.enableTooltip = function(mode) {
  137. this._endtt = (!convertStringToBoolean(mode))
  138. };
  139. dhtmlXMenuBarObject.prototype.disableSmartPositioning = function(mode) {
  140. this._skipAPP = convertStringToBoolean(mode)
  141. };
  142. dhtmlXMenuBarObject.prototype.enableMenuHandle = function(mode) {
  143. if (convertStringToBoolean(mode))
  144. this.dividerCell.style.display = "";
  145. else
  146. this.dividerCell.style.display = "none"
  147. };
  148. dhtmlXMenuBarObject.prototype.enableChildIcon = function(mode) {
  149. this.echsw = convertStringToBoolean(mode)
  150. };
  151. dhtmlXMenuBarObject.prototype.setHrefMode = function(mode) {
  152. this._hmode = mode
  153. };
  154. dhtmlXMenuBarObject.prototype.enableDirectOnClick = function(mode) {
  155. this._dirClick = convertStringToBoolean(mode)
  156. };
  157. dhtmlXMenuBarObject.prototype.enableChildIconSwitching = function(mode) {
  158. this.echsw2 = convertStringToBoolean(mode)
  159. };
  160. dhtmlXMenuBarObject.prototype.enableWindowOpenMode = function(mode) {
  161. this.ieWinMode = convertStringToBoolean(mode)
  162. };
  163. dhtmlXMenuBarObject.prototype._getItemIndex = function(id) {
  164. for (var i = 0; i < this.gitemsCount; i++) {
  165. if (this.gitems[i].id == id)
  166. return i
  167. };
  168. return -1
  169. };
  170. dhtmlXMenuBarObject.prototype.getItem = function(itemId) {
  171. var z = this._getItemIndex(itemId);
  172. if (z >= 0)
  173. return this.gitems[z]
  174. };
  175. dhtmlXMenuBarObject.prototype._showScroll = function(node, order, rest, mode) {
  176. if (!node.items[order])
  177. return;
  178. if (mode == "")
  179. if (rest == 1)
  180. node.cAr[2]++;
  181. else
  182. node.cAr[0]--;
  183. else if (rest == 1)
  184. node.cAr[0]++;
  185. else
  186. node.cAr[2]--;
  187. if ((!node.items[order].CSSTag) || (node.items[order].hide)) {
  188. node.items[order].topNod.parentNode.style.display = mode;
  189. this._showScroll(node, order * 1 + rest * 1, rest, mode)
  190. } else {
  191. node.items[order].topNod.parentNode.style.display = mode
  192. }
  193. };
  194. dhtmlXMenuBarObject.prototype._fixScrollState = function(node, rest) {
  195. if (parseInt(node.topNod.offsetWidth) > parseInt(node.topNod.width))
  196. node.topNod.width = node.topNod.offsetWidth;
  197. var flag = 0;
  198. if (rest > 0) {
  199. this._showScroll(node, node.cAr[0], 1, "none");
  200. this._showScroll(node, node.cAr[2], 1, "")
  201. } else {
  202. this._showScroll(node, node.cAr[0] - 1, -1, "");
  203. this._showScroll(node, node.cAr[2] - 1, -1, "none")
  204. };
  205. z.scrollState += rest * 1;
  206. if ((node.scrollState * 1 + node.maxItems * 1) == (node.realItemsCount))
  207. node.scrollDown.className = "menuScrollerDisabled";
  208. else {
  209. node.scrollDown.className = "menuScrollerEnabled";
  210. flag++
  211. };
  212. if (node.scrollState == 0)
  213. node.scrollUp.className = "menuScrollerDisabled";
  214. else {
  215. node.scrollUp.className = "menuScrollerEnabled";
  216. flag++
  217. };
  218. return flag
  219. };
  220. dhtmlXMenuBarObject.prototype._scrollstart = function() {
  221. if (this.timeoutops)
  222. clearTimeout(this.timeoutops);
  223. z = this.parentNode.parentNode.parentNode.menu;
  224. if (z.scrollDown == this)
  225. var rest = 1;
  226. else
  227. var rest = -1;
  228. if (z.topMenu._fixScrollState(z, rest) == 2)
  229. this.timeoutops = setTimeout(new z.topMenu._delayedTimerCall(this,
  230. "onmouseover", 0, 0), 333)
  231. };
  232. dhtmlXMenuBarObject.prototype._scrollend = function(node) {
  233. if (this.timeoutops)
  234. window.clearTimeout(this.timeoutops)
  235. };
  236. dhtmlXMenuBarObject.prototype._scrollCheck = function(node) {
  237. var z_count = 0;
  238. for (var i = 0; i < node.itemsCount; i++)
  239. if ((node.items[i].CSSTag) && (!node.items[i].hide))
  240. z_count++;
  241. node.realItemsCount = z_count;
  242. node.cAr = new Array(0, 0, 0);
  243. if ((node.realItemsCount > node.maxItems) && (node.scrollDown)) {
  244. node.scrollDown.style.display = "";
  245. node.scrollUp.style.display = "";
  246. node.scrollDown.className = 'menuScrollerEnabled';
  247. node.scrollState = 0;
  248. node.scrollUp.onmouseover = this._scrollstart;
  249. node.scrollUp.onmouseout = this._scrollend;
  250. node.scrollDown.onmouseover = this._scrollstart;
  251. node.scrollDown.onmouseout = this._scrollend;
  252. node.cAr[2] = 0;
  253. var z_count = 0;
  254. var b_flag = true;
  255. for (var i = 0; i < node.itemsCount; i++) {
  256. if ((node.items[i].CSSTag) && (!node.items[i].hide))
  257. z_count++;
  258. if (z_count > node.maxItems) {
  259. node.items[i].topNod.parentNode.style.display = "none";
  260. if (node.cAr[2] == 0)
  261. node.cAr[2] = i
  262. } else {
  263. node.items[i].topNod.parentNode.style.display = ""
  264. }
  265. }
  266. }
  267. };
  268. dhtmlXMenuBarObject.prototype._scrollClear = function(node) {
  269. for (var i = 0; i < node.itemsCount; i++) {
  270. if ((node.items[i].CSSTag) && (!node.items[i].hide))
  271. node.items[i].topNod.parentNode.style.display = "";
  272. if (node.scrollDown)
  273. node.scrollDown.style.display = "none";
  274. if (node.scrollUp)
  275. node.scrollUp.style.display = "none"
  276. }
  277. };
  278. dhtmlXMenuBarObject.prototype.getPanel = function(panelId) {
  279. var z = this._getGItemIndex(panelId);
  280. if (z < 0)
  281. return this;
  282. else
  283. return this.gitems[z].subMenu
  284. };
  285. dhtmlXMenuBarObject.prototype.addItem = function(panel, item) {
  286. if (this == panel)
  287. this.addFirstLevel(panel, item);
  288. else
  289. this.addSecondLevel(panel, item)
  290. };
  291. dhtmlXMenuBarObject.prototype._addItem = function(panel, item) {
  292. panel.items[panel.itemsCount] = item;
  293. panel.firstCell.parentNode.insertBefore(item.getTopNode(), panel.firstCell);
  294. item.getTopNode().style.marginBottom = "20px";
  295. item.parentNod = this;
  296. item.parentPanel = panel;
  297. if (this.defaultAction)
  298. item.setAction(this.defaultAction);
  299. panel.itemsCount++;
  300. this.gitems[this.gitemsCount] = item;
  301. this.gitemsCount++
  302. };
  303. dhtmlXMenuBarObject.prototype.addItem_vertical = function(panel, item) {
  304. panel.items[panel.itemsCount] = item;
  305. var tr = document.createElement("tr");
  306. tr.style.verticalAlign = "top";
  307. tr.appendChild(item.getTopNode());
  308. panel.firstCell.parentNode.insertBefore(tr, panel.firstCell);
  309. item.parentNod = this;
  310. item.parentPanel = panel;
  311. if (this.defaultAction)
  312. item.setAction(this.defaultAction);
  313. panel.itemsCount++;
  314. this.gitems[this.gitemsCount] = item;
  315. this.gitemsCount++
  316. };
  317. dhtmlXMenuBarObject.prototype._getGItemIndex = function(id) {
  318. return (this._getItemIndex(id))
  319. };
  320. dhtmlXMenuBarObject.prototype.clearAll = function(id) {
  321. for (var i = 0; i < this.gitemsCount; i++) {
  322. var x = this.gitems[i].getTopNode();
  323. x.parentNode.removeChild(x);
  324. x = this.gitems[i].parentPanel;
  325. if (x != this.topMenu && x.topNod) {
  326. x.topNod.parentNode.removeChild(x.topNod);
  327. x.topNod = null
  328. }
  329. };
  330. this.items = new Array();
  331. this.itemsCount = 0;
  332. this.gitems = new Array();
  333. this.gitemsCount = 0;
  334. this.subMenus = new Array();
  335. this.subMenusCount = 0;
  336. this.realWinModeStart = this.ieWinModeState = this._lastOpenedPanel = this._lastSelectedItem = null
  337. };
  338. dhtmlXMenuBarObject.prototype.removeItem = function(id) {
  339. var z = this._getGItemIndex(id);
  340. if (z >= 0) {
  341. var panel = this.gitems[z].parentPanel;
  342. if (this.gitems[z].removeItem)
  343. this.gitems[z].removeItem();
  344. if (panel.firstCell.tagName == "TR")
  345. var zw = this.gitems[z].getTopNode().parentNode
  346. else
  347. var zw = this.gitems[z].getTopNode().parentNode
  348. zw.parentNode.removeChild(zw);
  349. panel.itemsCount--;
  350. for (var i = 0; i < panel.itemsCount; i++)
  351. if (panel.items[i] == this.gitems[z]) {
  352. panel.items[i] = panel.items[i + 1];
  353. panel.items[i + 1] = this.gitems[z]
  354. };
  355. panel.items[panel.itemsCount] = 0;
  356. this.gitemsCount--;
  357. for (var i = z; i < this.gitemsCount; i++) {
  358. this.gitems[i] = this.gitems[i + 1]
  359. };
  360. this.gitems[this.gitemsCount] = 0
  361. }
  362. };
  363. dhtmlXMenuBarObject.prototype._parseXMLTree = function(that, node, level,
  364. parentNode, aTempNode, mode) {
  365. if (!node) {
  366. node = that.xmlLoader.getXMLTopNode("menu");
  367. if (that._awaitXML) {
  368. aTempNode = that._awaitXML;
  369. parentNode = aTempNode.parentPanel;
  370. level = 1;
  371. that._awaitXML = null;
  372. mode = this.modeValue
  373. } else {
  374. level = 0;
  375. parentNode = that;
  376. mode = node.getAttribute("mode");
  377. if (mode)
  378. that.setMenuMode(mode);
  379. var menuAlign = node.getAttribute("menuAlign");
  380. if (menuAlign)
  381. that.setBarAlign(menuAlign);
  382. that.maxItems = node.getAttribute("maxItems") || 99;
  383. var absolutePosition = node.getAttribute("absolutePosition");
  384. var aleft = node.getAttribute("left");
  385. var atop = node.getAttribute("top");
  386. if (absolutePosition)
  387. that.topNod.style.top = parseInt(atop || 0) + "px";
  388. if (absolutePosition)
  389. that.topNod.style.left = parseInt(aleft || 0) + "px";
  390. if (absolutePosition == "yes")
  391. that.topNod.style.position = "absolute";
  392. var name = node.getAttribute("name");
  393. if (name)
  394. that.setTitleText(name);
  395. var width = node.getAttribute("width");
  396. var height = node.getAttribute("height");
  397. that.setBarSize(width, height);
  398. var imageTextButtonCssClass = node
  399. .getAttribute("imageTextButtonCssClass");
  400. var globalTextCss = node.getAttribute("globalTextCss");
  401. that.globalSecondCss = node.getAttribute("globalSecondCss");
  402. that.globalCss = node.getAttribute("globalCss");
  403. that.globalTextCss = node.getAttribute("globalTextCss");
  404. if (node.getAttribute("withoutImages"))
  405. that.withoutImages = true;
  406. if (node.getAttribute("mixedImages"))
  407. that.mixedImages = true;
  408. that.type = node.getAttribute("type") || "a1"
  409. }
  410. };
  411. if (level) {
  412. var parentNode = new dhtmlXMenuBarPanelObject(parentNode, aTempNode,
  413. ((mode != "classic") && (mode != "popup")), node
  414. .getAttribute("panelWidth"), (node
  415. .getAttribute("withoutImages") ? 1 : (node
  416. .getAttribute("mixedImages") ? 2 : 0)));
  417. parentNode.maxItems = node.getAttribute("maxItems") || that.maxItems
  418. };
  419. for (var i = 0; i < node.childNodes.length; i++) {
  420. if (node.childNodes[i].nodeType == 1) {
  421. var localItem = node.childNodes[i]
  422. if (!level) {
  423. if ((!localItem.getAttribute("className")) && (that.globalCss))
  424. localItem.setAttribute("className", that.globalCss)
  425. } else if (!localItem.getAttribute("className")) {
  426. if (that.globalSecondCss)
  427. localItem.setAttribute("className", that.globalSecondCss);
  428. else
  429. localItem.setAttribute("className", "menuButtonSecond")
  430. };
  431. if ((!localItem.getAttribute("textClassName"))
  432. && (that.globalTextCss))
  433. localItem.setAttribute("textClassName", that.globalTextCss);
  434. var tempsrc = localItem.getAttribute("src");
  435. if (parentNode.withoutImages) {
  436. localItem.setAttribute("src", "");
  437. localItem.setAttribute("src2", that.sysGfxPath + "blank.gif")
  438. } else {
  439. if ((parentNode.mixedImages) && (tempsrc == null))
  440. tempsrc = that.sysGfxPath + "blank.gif";
  441. else
  442. tempsrc = that.sysGfxPath + (tempsrc || "blank.gif");
  443. localItem.setAttribute("src", tempsrc)
  444. };
  445. tempsrc = localItem.getAttribute("width");
  446. if (tempsrc == null) {
  447. localItem.setAttribute("width", "100%")
  448. };
  449. if (that._endtt)
  450. localItem.setAttribute("tooltip", "");
  451. if (that._aimsize)
  452. localItem.setAttribute("imageSize", that._aimsize);
  453. var z = eval("window.dhtmlX" + localItem.tagName + "Object");
  454. if (z)
  455. var TempNode = new z(localItem, node.getAttribute("type")
  456. || that.type);
  457. else
  458. var TempNode = null;
  459. if (localItem.tagName == "divider")
  460. if ((level) || (that.modeValue == "popup"))
  461. that.addItem(parentNode,
  462. new dhtmlXMenuDividerYObject(localItem
  463. .getAttribute("id")));
  464. else
  465. that.addItem(parentNode,
  466. new dhtmlXMenuDividerXObject(localItem
  467. .getAttribute("id")));
  468. else if (TempNode)
  469. if (level)
  470. that.addItem(parentNode, TempNode);
  471. else
  472. that.addItem(parentNode, TempNode);
  473. if (localItem.getAttribute("disabled"))
  474. TempNode.disable();
  475. if ((TempNode) && (localItem.getAttribute("submenu"))) {
  476. TempNode.submenu = localItem.getAttribute("submenu");
  477. TempNode.setHasChild(true)
  478. };
  479. if (that.checkXMLChild(localItem))
  480. that._parseXMLTree(that, localItem, level + 1, parentNode,
  481. TempNode, mode)
  482. }
  483. };
  484. that._scrollCheck(parentNode);
  485. if (level == 0) {
  486. if (that.topMenu.correctMenuPosition)
  487. that.topMenu.correctMenuPosition(that.topMenu.topNod);
  488. if (that.topMenu.waitCall)
  489. that.topMenu.waitCall()
  490. }
  491. };
  492. dhtmlXMenuBarObject.prototype.checkXMLChild = function(node) {
  493. for (var i = 0; i < node.childNodes.length; i++)
  494. if (node.childNodes[i].nodeType == 1)
  495. return true;
  496. return false
  497. };
  498. dhtmlXMenuBarObject.prototype._createPanel = function() {
  499. if (!this.width)
  500. this.width = 1;
  501. if (!this.height)
  502. this.height = 1;
  503. if (this.width.toString().indexOf("%") == -1)
  504. this.width = parseInt(this.width) + "px";
  505. if (this.height.toString().indexOf("%") == -1)
  506. this.height = parseInt(this.height) + "px";
  507. var div = document.createElement("div");
  508. div.innerHTML = '<table cellpadding="0" cellspacing="0" class="'
  509. + this.topMenu.tableCSS
  510. + '" width="'
  511. + this.width
  512. + '" height="'
  513. + this.height
  514. + '"><tbody>'
  515. + '<tr>'
  516. + '<td width="3px" style="display:none"><div class="menuHandle">&nbsp;</div></td>'
  517. + '<td class="' + this.topMenu.titleCSS + '" style="display:none">'
  518. + this.topMenu.tname + '</td>' + '<td></td>' + '<td align="right" '
  519. + (_isOpera ? '' : 'width="100%"') + ' class="'
  520. + this.topMenu.titleCSS + '">&nbsp;' + this.topMenu.tname
  521. + '</td><td >&nbsp;</td></tr></tbody></table>';
  522. var table = div.childNodes[0];
  523. table.style.display = "none";
  524. table.setAttribute("UNSELECTABLE", "on");
  525. table.onselectstart = this.topMenu.badDummy;
  526. this.topNod = table;
  527. this.dividerCell = table.childNodes[0].childNodes[0].childNodes[0];
  528. this.dividerCell.menu = this;
  529. this.preNameCell = this.dividerCell.nextSibling;
  530. this.firstCell = this.preNameCell.nextSibling;
  531. this.nameCell = this.firstCell.nextSibling;
  532. this.crossCell = this.nameCell.nextSibling;
  533. if (this.topMenu != this) {
  534. this.dividerCell.style.display = "none";
  535. this.preNameCell.style.display = "none";
  536. this.nameCell.style.display = "none";
  537. this.crossCell.style.display = "none";
  538. table.className = this.topMenu.secTableCSS
  539. };
  540. this.topNod.style.zIndex = this.topMenu.zIndex;
  541. if (this.topMenu.ieFix) {
  542. var iframe = document.createElement("IFRAME");
  543. if (this._httpsdummy || this.topMenu.sysGfxPath)
  544. iframe.src = (this._httpsdummy || (this.topMenu.sysGfxPath + "/blank.html"));
  545. iframe.style.zIndex = this.topMenu.zIndex - 1;
  546. iframe.style.position = "absolute";
  547. iframe.style.display = "none";
  548. iframe.scrolling = "no";
  549. iframe.frameBorder = 0;
  550. this.parentObject.appendChild(iframe);
  551. this._del_iframe = iframe;
  552. this.topNod.ieFix = iframe
  553. };
  554. this.parentObject.appendChild(table);
  555. this._del_table = table
  556. };
  557. dhtmlXMenuBarObject.prototype.setMenuCSS = function(table, title, secTable) {
  558. this.tableCSS = table;
  559. this.titleCSS = title;
  560. this.secTableCSS = secTable;
  561. this.topNod.className = this.tableCSS;
  562. this.preNameCell.className = this.titleCSS;
  563. this.nameCell.className = this.titleCSS
  564. };
  565. dhtmlXMenuBarObject.prototype._adjustGFXPath = function(path) {
  566. if (this.extraMode) {
  567. this.topNod.rows[0].cells[0].childNodes[0].src = path + 'btn_up1.gif';
  568. this.topNod.rows[this.topNod.rows.length - 3].cells[0].childNodes[0].src = path
  569. + 'btn_up2.gif'
  570. }
  571. };
  572. dhtmlXMenuBarObject.prototype._createVPanel = function() {
  573. if (!this.width)
  574. this.width = 120;
  575. if (!this.height)
  576. this.height = 20;
  577. if (this.width.toString().indexOf("%") == -1)
  578. this.width = parseInt(this.width) + "px";
  579. if (this.height.toString().indexOf("%") == -1)
  580. this.height = parseInt(this.height) + "px";
  581. var div = document.createElement("div");
  582. div.innerHTML = '<table cellpadding="0" cellspacing="0" class="'
  583. + this.topMenu.tableCSS
  584. + '" width="'
  585. + this.width
  586. + '" ><tbody>'
  587. + '<tr ><td class="menuScrollerDisabled" style="display:none"><img src="'
  588. + this.topMenu.sysGfxPath
  589. + 'btn_up1.gif"/></td></tr>'
  590. + '<tr><td class="'
  591. + this.topMenu.titleCSS
  592. + '" style="display:none">'
  593. + this.tname
  594. + '</td></tr>'
  595. + '<tr><td></td></tr>'
  596. + '<tr><td class="menuScrollerDisabled" style="display:none"><img src="'
  597. + this.topMenu.sysGfxPath + 'btn_up2.gif"/></td></tr>'
  598. + '<tr><td align="right" class="' + this.topMenu.titleCSS
  599. + '" style="display:none">' + this.tname + '</td></tr>'
  600. + '<tr><td></td></tr>' + '</tbody></table>';
  601. var table = div.childNodes[0];
  602. table.style.display = 'none';
  603. this.topNod = table;
  604. table.onselectstart = this.topMenu.badDummy;
  605. table.setAttribute("UNSELECTABLE", "on");
  606. this.dividerCell = table.childNodes[0].childNodes[0].childNodes[0];
  607. table.menu = this;
  608. this.scrollUp = this.dividerCell;
  609. this.scrollonmouseover = "";
  610. this.preNameCell = table.childNodes[0].childNodes[1].childNodes[0];
  611. this.firstCell = table.childNodes[0].childNodes[2];
  612. this.scrollDown = table.childNodes[0].childNodes[3].childNodes[0];
  613. this.nameCell = table.childNodes[0].childNodes[4].childNodes[0];
  614. this.crossCell = table.childNodes[0].childNodes[5].childNodes[0];
  615. if (this.topMenu != this) {
  616. this.preNameCell.parentNode.style.display = "none";
  617. this.nameCell.parentNode.style.display = "none";
  618. this.crossCell.parentNode.style.display = "none";
  619. table.className = this.topMenu.secTableCSS
  620. };
  621. this.topNod.style.zIndex = this.topMenu.zIndex;
  622. if (this.topMenu.ieFix) {
  623. var iframe = document.createElement("IFRAME");
  624. iframe.style.zIndex = this.topMenu.zIndex - 1;
  625. iframe.style.position = "absolute";
  626. iframe.src = (this._httpsdummy || (this.topMenu.sysGfxPath + "blank.gif"));
  627. iframe.style.display = "none";
  628. iframe.scrolling = "no";
  629. iframe.frameBorder = 0;
  630. this.parentObject.appendChild(iframe);
  631. this._del_iframe = iframe;
  632. this.topNod.ieFix = iframe
  633. };
  634. this.parentObject.appendChild(table);
  635. this._del_table = table
  636. };
  637. function dhtmlXMenuItemObject(id, text, width, src, className, disableImage,
  638. href, target, type, image_size) {
  639. type = type || "a1";
  640. var src2 = "";
  641. var tooltip = "";
  642. if (id.tagName == "MenuItem") {
  643. type = text || "a1";
  644. src = id.getAttribute("src");
  645. src2 = id.getAttribute("src2");
  646. text = id.getAttribute("name");
  647. className = id.getAttribute("className");
  648. disableImage = id.getAttribute("disableImage");
  649. width = id.getAttribute("width");
  650. href = id.getAttribute("href");
  651. if (_isKHTML)
  652. href = href.replace(/\&\#38;/g, "&");
  653. target = id.getAttribute("target");
  654. tooltip = id.getAttribute("tooltip");
  655. if ((tooltip !== "") && (!tooltip))
  656. tooltip = text;
  657. image_size = id.getAttribute("imageSize");
  658. id = id.getAttribute("id")
  659. };
  660. if (id)
  661. this.id = id;
  662. else
  663. this.id = (allGetServerTime()).valueOf();
  664. src2 = src2 || src;
  665. image_size = parseInt(image_size) || 18;
  666. this.topNod = 0;
  667. this.action = 0;
  668. this.persAction = 0;
  669. this.src = src;
  670. this.text = text;
  671. this.href = href;
  672. this.target = target;
  673. // alert(this.href + this.target)
  674. this.className = className || "menuButton";
  675. this.textClassName = "defaultMenuText";
  676. this.disableImage = disableImage;
  677. td = document.createElement("td");
  678. this.topNod = td;
  679. td.align = "center";
  680. td.noWrap = true;
  681. if (width && width.toString().indexOf("%") == -1) {
  682. width = parseInt(width) + "px";
  683. if (_isOpera)
  684. td.style.width = width
  685. };
  686. td.innerHTML = "<table align='left' cellpadding='0' cellspacing='0' border='0' style='"
  687. + (width ? ("width:" + width + ";") : "")
  688. + " height:100%;'><tr><td width='"
  689. + (2 + image_size)
  690. + "px' style=' "
  691. + (src ? "" : "display:none;")
  692. + "'><img src='"
  693. + (src2 ? src2 : this.dummyImg())
  694. + "' border='0' width='"
  695. + image_size
  696. + "px' height='"
  697. + image_size
  698. + "px'/></td><td width='100%' align='left' style=' "
  699. + (src ? " padding-left:2px;" : "")
  700. + " overflow:hidden;' ><table width='100%' height='100%' cellpadding='0' cellspacing='0'><tr><td title='"
  701. + tooltip
  702. + "' class='"
  703. + this.textClassName
  704. + "' nowrap='nowrap' >"
  705. + this.text
  706. + "</td><td width='12px'><img style='display:none' src='"
  707. + this.dummyImg() + "'/></td></tr></table></td></tr></table>";
  708. this.imageTag = td.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0];
  709. this.childMenuTag = td.childNodes[0].childNodes[0].childNodes[0].childNodes[1].childNodes[0].childNodes[0].childNodes[0].childNodes[1].childNodes[0];
  710. this.textTag = this.childMenuTag.parentNode.parentNode.childNodes[0];
  711. switch (type) {
  712. case "a1" :
  713. this.CSSTag = td;
  714. this.CSSImageTag = null;
  715. break;
  716. case "a2" :
  717. this.CSSTag = td.childNodes[0];
  718. this.CSSImageTag = null;
  719. break;
  720. case "a3" :
  721. this.CSSTag = td.childNodes[0].childNodes[0].childNodes[0].childNodes[1];
  722. this.CSSImageTag = null;
  723. break;
  724. case "b1" :
  725. this.CSSTag = td;
  726. this.CSSImageTag = this.imageTag.parentNode;
  727. break;
  728. case "b2" :
  729. this.CSSTag = td.childNodes[0];
  730. this.CSSImageTag = this.imageTag.parentNode;
  731. break;
  732. case "b3" :
  733. this.CSSTag = td.childNodes[0].childNodes[0].childNodes[0].childNodes[1];
  734. this.CSSImageTag = this.imageTag.parentNode;
  735. break
  736. };
  737. td.id = "menuItem_" + this.id;
  738. this.CSSTag.className = this.className;
  739. td.objectNode = this;
  740. this.enable();
  741. return this
  742. };
  743. dhtmlXMenuItemObject.prototype = new dhtmlXButtonPrototypeObject;
  744. dhtmlXMenuItemObject.prototype.dummyImg = function() {
  745. return ""
  746. };
  747. dhtmlXMenuItemObject.prototype.enable = function() {
  748. if (this.disableImage)
  749. this.imageTag.src = this.src;
  750. else if (!this.className)
  751. this.topNod.className = this.objectNode.className;
  752. else
  753. this.topNod.className = this.className;
  754. if (this.textTag)
  755. this.textTag.className = this.textClassName;
  756. this.topNod.onmouseover = this._onmouseoverX;
  757. this.topNod.onmouseout = this._onmouseoutX;
  758. this.topNod.onmousedown = this._onmousedownX;
  759. this.topNod.onmouseup = this._onclickX
  760. };
  761. dhtmlXMenuItemObject.prototype._onmousedownX = function(e) {
  762. if ((!this.objectNode.parentPanel.parentPanel)
  763. && ((this.objectNode.subMenu) || (this.objectNode.submenu)))
  764. this.objectNode._onclickX(e, this.objectNode)
  765. };
  766. dhtmlXMenuItemObject.prototype.setHasChild = function(mode) {
  767. if ((convertStringToBoolean(mode)) && (this.parentPanel.topMenu.echsw)) {
  768. this.childMenuTag.src = this.parentPanel.topMenu.sysGfxPath
  769. + 'btn_rt1.gif';
  770. this.childMenuTag.style.display = ''
  771. } else
  772. this.childMenuTag.style.display = 'none'
  773. };
  774. dhtmlXMenuItemObject.prototype.setText = function(newText) {
  775. this.textTag.innerHTML = newText
  776. };
  777. dhtmlXMenuItemObject.prototype._onclickX = function(e, that) {
  778. if (!e)
  779. e = event;
  780. e.cancelBubble = true;
  781. if (!that)
  782. that = this.objectNode;
  783. var thatM = that.parentPanel.topMenu;
  784. if (that.topNod.dstatus)
  785. return;
  786. if (that.submenu) {
  787. var a_that = that;
  788. var a_top = thatM;
  789. thatM.loadXMLFor(that.submenu, that.id, function() {
  790. a_that.submenu = null;
  791. a_that._onclickX([], a_that)
  792. });
  793. a_that.submenu = null;
  794. return
  795. };
  796. if ((thatM.ieWinMode) && (!thatM.ieWinModeState) && (that.subMenu)) {
  797. that.parentPanel.topMenu._onItemOver(that, that.subMenu);
  798. if (document.body.currentActiveMenu != thatM)
  799. if (document.body.onmouseup) {
  800. document.body.onmouseup()
  801. };
  802. if (thatM.realWinModeStart) {
  803. that.parentPanel.topMenu.ieWinModeState = 1;
  804. if (document.body.onmouseup != thatM._onclickclose) {
  805. thatM.olddoc = document.body.onmouseup;
  806. document.body.onmouseup = thatM._onclickclose
  807. };
  808. document.body.currentActiveMenu = that.parentPanel.topMenu;
  809. thatM.realWinModeStart = 0
  810. } else
  811. thatM.realWinModeStart = 1;
  812. return
  813. };
  814. if ((thatM.ieWinMode) && (thatM.ieWinModeState) && (that.subMenu)) {
  815. if ((!thatM.realWinModeStart) && (that.parentPanel == thatM)) {
  816. thatM.realWinModeStart = 1;
  817. return
  818. } else
  819. thatM.realWinModeStart = 0
  820. };
  821. thatM.realWinModeStart = 0;
  822. thatM.ieWinModeState = 0;
  823. thatM.dropTimers(that.parentPanel);
  824. thatM._closePanel(that.parentPanel);
  825. thatM.lastSelectedItem = 0;
  826. thatM.probablyCloseMe = 0;
  827. thatM.lastOpenedPanel = "";
  828. if (that.parentPanel.topMenu.ieWinMode) {
  829. if (that.parentPanel.topMenu.olddoc)
  830. document.body.onclick = that.parentPanel.topMenu.olddoc;
  831. else
  832. document.body.onclick = null
  833. };
  834. if ((that.parentPanel.topMenu.ieWinMode) && (!that.parentPanel.parentPanel)
  835. && (that.subMenu)) {
  836. return
  837. };
  838. that.parentPanel.topMenu._unMarkItem(that, "down");
  839. if (that.parentPanel.topMenu._dirClick)
  840. that._onclickY(0, 0);
  841. else
  842. setTimeout(new that.parentPanel.topMenu._delayedTimerCall(that,
  843. "_onclickY", 0, 0), 100);
  844. return
  845. };
  846. dhtmlXMenuBarObject.prototype._onclickclose = function(e) {
  847. var that = this.currentActiveMenu;
  848. if (that.olddoc)
  849. document.body.onmouseup = that.olddoc;
  850. else
  851. document.body.onmouseup = null;
  852. that.realWinModeStart = 0;
  853. that.lastOpenedPanel = "";
  854. that.ieWinModeState = 0;
  855. that.dropTimers(that);
  856. that._closePanel(that);
  857. that.lastSelectedItem = 0
  858. };
  859. dhtmlXMenuBarObject.prototype.close = function(e) {
  860. if (this.olddoc)
  861. document.body.onmouseup = this.olddoc;
  862. else
  863. document.body.onmouseup = null;
  864. that.realWinModeStart = 0;
  865. that.lastOpenedPanel = "";
  866. that.ieWinModeState = 0;
  867. that.dropTimers(this);
  868. that._closePanel(this);
  869. that.lastSelectedItem = 0
  870. };
  871. dhtmlXMenuItemObject.prototype._onclickY = function() {
  872. if ((!this.persAction) || (this.persAction()))
  873. if ((!this.action) || (this.action(this.id)))
  874. if (this.href) {
  875. if (this.target) {
  876. var form = this.parentPanel.topMenu.hiddenForm;
  877. form.action = this.href;
  878. form.target = this.target;
  879. form.method = (this.parentPanel.topMenu._hmode
  880. ? this.parentPanel.topMenu._hmode
  881. : "GET");
  882. // alert("946 form.method = " + form.method)
  883. // alert("946 form.action = " + form.action)
  884. form.submit()
  885. } else
  886. document.location.href = this.href;
  887. return false
  888. };
  889. return false
  890. };
  891. dhtmlXMenuItemObject.prototype._onmouseoverY = function(e) {
  892. var that = this.parentPanel.topMenu;
  893. if ((!that.ieWinMode) || (that.ieWinModeState))
  894. this.parentPanel.topMenu._onItemOver(this, this.subMenu);
  895. else {
  896. if ((that.lastSelectedItem) && (that.lastSelectedItem != this))
  897. this.parentPanel.topMenu._unMarkItem(that.lastSelectedItem);
  898. this.parentPanel.topMenu._markItem(this)
  899. }
  900. };
  901. dhtmlXMenuItemObject.prototype._onmouseoutY = function(e) {
  902. this.parentPanel.topMenu._onItemOut(this, this.subMenu)
  903. };
  904. dhtmlXMenuBarObject.prototype.dropTimers = function(panel) {
  905. if (!panel)
  906. return;
  907. z = panel.topNod.timeoutop;
  908. if (z)
  909. clearTimeout(z);
  910. if (!panel.parentPanel)
  911. return;
  912. var z = panel.parentPanel.topNod.timeoutop;
  913. if (z)
  914. clearTimeout(z);
  915. var z = panel.parentItem.topNod.timeoutop;
  916. if (z)
  917. clearTimeout(z)
  918. };
  919. dhtmlXMenuBarObject.prototype._onmouseoverZ = function(e) {
  920. if (!e)
  921. e = event;
  922. e.cancelBubble = true;
  923. that = this.panel.topMenu;
  924. if (this.timeoutop)
  925. clearTimeout(this.timeoutop);
  926. that.dropTimers(this.panel);
  927. that._onItemOver(0, this.panel)
  928. };
  929. dhtmlXMenuBarObject.prototype._onmouseoutZ = function(e) {
  930. if (!e)
  931. e = event;
  932. e.cancelBubble = true;
  933. that = this.panel.topMenu;
  934. if (this.timeoutop)
  935. clearTimeout(this.timeoutop);
  936. if ((!that.ieWinMode)) {
  937. this.timeoutop = setTimeout(new that._delayedTimerCall(
  938. this.panel.topMenu, "_onItemOut", 0, this.panel), 200)
  939. }
  940. };
  941. dhtmlXMenuBarObject.prototype._delayedTimerCall = function(object,
  942. functionName, a, b, time) {
  943. this.callFunc = function() {
  944. var ax = a;
  945. var bx = b;
  946. object[functionName](ax, bx)
  947. };
  948. return this.callFunc
  949. };
  950. dhtmlXMenuBarObject.prototype._onItemOut = function(item, panel) {
  951. if (!panel) {
  952. if ((item) && (!item.subMenu))
  953. this._unMarkItem(item);
  954. return
  955. };
  956. if (this.ieWinMode)
  957. if ((panel.topMenu == panel) || ((item) && (this.ieWinModeState == 1)))
  958. return;
  959. if (item)
  960. this._unMarkItem(item);
  961. this._closePanel(panel)
  962. };
  963. dhtmlXMenuBarObject.prototype._onItemOver = function(item, panel) {
  964. if (item) {
  965. if ((this.lastSelectedItem) && (this.lastSelectedItem != item)) {
  966. if ((!this.lastSelectedItem.subMenu)
  967. || (this.lastSelectedItem.subMenu != item.parentPanel))
  968. this._unMarkItem(this.lastSelectedItem)
  969. };
  970. this.lastSelectedItem = item;
  971. if (this.ieWinMode) {
  972. this._markItem(item, "down")
  973. } else {
  974. this._markItem(item)
  975. };
  976. var zp = item.parentPanel;
  977. if ((zp._lastSelectedItem) && (zp._lastSelectedItem != item))
  978. if (zp._lastSelectedItem.subMenu)
  979. this._closePanel(zp._lastSelectedItem.subMenu);
  980. item.parentPanel._lastSelectedItem = item
  981. };
  982. if (panel)
  983. this._openPanel(panel);
  984. if (item.submenu) {
  985. var a_that = item;
  986. var a_top = this;
  987. this.loadXMLFor(item.submenu, item.id, function() {
  988. a_that.submenu = null;
  989. a_top._onItemOver(a_that, a_that.subMenu)
  990. });
  991. a_that.submenu = null;
  992. return
  993. }
  994. };
  995. dhtmlXMenuBarObject.prototype._openPanel = function(panel) {
  996. if ((this.lastOpenedPanel) && (this.lastOpenedPanel != panel)
  997. && (this.lastOpenedPanel.parentPanel != panel)
  998. && (this.lastOpenedPanel != panel.parentPanel)) {
  999. this._closePanel(this.lastOpenedPanel)
  1000. };
  1001. var z = panel.topNod.timeoutop;
  1002. if (z)
  1003. clearTimeout(z);
  1004. if (panel.topNod.style.display == "")
  1005. return;
  1006. if (this.lastOpenedPanel != panel) {
  1007. this.lastOpenedPanel = panel;
  1008. switch (this.modeValue) {
  1009. case "classic" :
  1010. if (panel.topMenu != panel.parentPanel) {
  1011. panel.topNod.style.left = getAbsoluteLeft(panel.parentItem.topNod)
  1012. * 1
  1013. + panel.parentItem.topNod.offsetWidth
  1014. * 1
  1015. + "px";
  1016. panel.topNod.style.top = getAbsoluteTop(panel.parentItem.topNod)
  1017. + "px"
  1018. } else {
  1019. panel.topNod.style.left = getAbsoluteLeft(panel.parentItem.topNod)
  1020. + "px";
  1021. panel.topNod.style.top = getAbsoluteTop(panel.parentItem.topNod)
  1022. * 1
  1023. + panel.parentItem.topNod.offsetHeight
  1024. * 1
  1025. - 1
  1026. + "px"
  1027. }
  1028. ;
  1029. break;
  1030. case "popup" :
  1031. panel.topNod.style.left = getAbsoluteLeft(panel.parentItem.topNod)
  1032. * 1 + panel.parentItem.topNod.offsetWidth * 1 + "px";
  1033. panel.topNod.style.top = getAbsoluteTop(panel.parentItem.topNod)
  1034. + "px";
  1035. break;
  1036. case "betta" :
  1037. if (panel.topMenu != panel.parentPanel) {
  1038. panel.topNod.style.left = getAbsoluteLeft(panel.parentItem.topNod)
  1039. * 1 + "px";
  1040. panel.topNod.style.top = getAbsoluteTop(panel.parentItem.topNod)
  1041. + panel.parentItem.topNod.offsetHeight
  1042. * 1
  1043. - 1
  1044. + "px"
  1045. } else {
  1046. panel.topNod.style.left = getAbsoluteLeft(panel.parentItem.topNod)
  1047. * 1
  1048. + panel.parentItem.topNod.offsetWidth
  1049. * 1
  1050. + "px";
  1051. panel.topNod.style.top = getAbsoluteTop(panel.parentItem.topNod)
  1052. + "px"
  1053. }
  1054. ;
  1055. break;
  1056. case "alfa" :
  1057. panel.topNod.style.top = getAbsoluteTop(panel.parentItem.topNod)
  1058. * 1
  1059. + panel.parentItem.topNod.offsetHeight
  1060. * 1
  1061. - 1
  1062. + "px";
  1063. panel.topNod.style.left = getAbsoluteLeft(panel.parentItem.topNod)
  1064. + "px";
  1065. break
  1066. };
  1067. if (panel.topNod.parentNode.style.position == "absolute") {
  1068. panel.topNod.style.top = parseInt(panel.topNod.style.top)
  1069. - getAbsoluteTop(panel.topNod.parentNode) + "px";
  1070. panel.topNod.style.left = parseInt(panel.topNod.style.left)
  1071. - getAbsoluteLeft(panel.topNod.parentNode) + "px"
  1072. };
  1073. panel.topNod.style.display = "";
  1074. if (panel.topNod.ieFix) {
  1075. panel.topNod.ieFix.style.top = panel.topNod.style.top;
  1076. panel.topNod.ieFix.style.left = panel.topNod.style.left;
  1077. panel.topNod.ieFix.style.width = panel.topNod.offsetWidth + "px";
  1078. panel.topNod.ieFix.style.height = panel.topNod.offsetHeight + "px";
  1079. panel.topNod.ieFix.style.display = ""
  1080. }
  1081. };
  1082. if (!this._skipAPP)
  1083. this._fixPanelPosition(panel)
  1084. };
  1085. dhtmlXMenuBarObject.prototype._fixPanelPosition = function(panel, mode) {
  1086. var uf = 0;
  1087. if (panel.parentPanel) {
  1088. var xs = document.body.offsetWidth - 15 + document.body.scrollLeft;
  1089. var ys = document.body.offsetHeight - 15 + document.body.scrollTop;
  1090. if ((panel.topNod.offsetWidth + parseInt(panel.topNod.style.left)) > xs) {
  1091. if (!panel.parentPanel.extraMode) {
  1092. var z = xs - panel.topNod.offsetWidth;
  1093. if (z < 0)
  1094. z = 0;
  1095. panel.topNod.style.left = z + "px";
  1096. if (panel.topNod.ieFix)
  1097. panel.topNod.ieFix.style.left = z + "px"
  1098. } else {
  1099. var z = parseInt(panel.topNod.style.left)
  1100. - panel.topNod.offsetWidth
  1101. - panel.parentItem.topNod.offsetWidth;
  1102. if (z < 0) {
  1103. var z2 = parseInt(panel.topNod.style.top)
  1104. + panel.parentItem.topNod.offsetHeight;
  1105. panel.topNod.style.top = z2 + "px";
  1106. if (panel.topNod.ieFix)
  1107. panel.topNod.ieFix.style.top = z2 + "px";
  1108. z = xs - panel.topNod.offsetWidth;
  1109. if (z < 0)
  1110. z = 0
  1111. };
  1112. panel.topNod.style.left = z + "px";
  1113. if (panel.topNod.ieFix)
  1114. panel.topNod.ieFix.style.left = z + "px"
  1115. }
  1116. };
  1117. if ((panel.topNod.offsetHeight + parseInt(panel.topNod.style.top)) > ys) {
  1118. if (panel.parentPanel.extraMode) {
  1119. var z = ys - panel.topNod.offsetHeight;
  1120. if (z < 0)
  1121. z = 0;
  1122. panel.topNod.style.top = z + "px";
  1123. if (panel.topNod.ieFix)
  1124. panel.topNod.ieFix.style.top = z + "px"
  1125. } else {
  1126. var z = parseInt(panel.topNod.style.top)
  1127. - panel.topNod.offsetHeight
  1128. - panel.parentItem.topNod.offsetHeight;
  1129. if (z < 0) {
  1130. var z2 = parseInt(panel.topNod.style.left)
  1131. + panel.parentItem.topNod.offsetWidth;
  1132. panel.topNod.style.left = z2 + "px";
  1133. if (panel.topNod.ieFix)
  1134. panel.topNod.ieFix.style.left = z2 + "px";
  1135. uf = 1;
  1136. z = ys - panel.topNod.offsetHeight;
  1137. if (z < 0)
  1138. z = 0
  1139. };
  1140. panel.topNod.style.top = z + "px";
  1141. if (panel.topNod.ieFix)
  1142. panel.topNod.ieFix.style.top = z + "px"
  1143. }
  1144. }
  1145. };
  1146. if ((uf) && (!mode))
  1147. this._fixPanelPosition(panel, 1)
  1148. };
  1149. dhtmlXMenuBarObject.prototype._closePanel = function(panel) {
  1150. if (!panel)
  1151. return;
  1152. if ((this.lastSelectedItem) && (this.lastSelectedItem.parentPanel == panel))
  1153. this._unMarkItem(this.lastSelectedItem);
  1154. this._closeBottomPanels(panel);
  1155. this._closeTopPanels(panel);
  1156. this.lastOpenedPanel = ""
  1157. };
  1158. dhtmlXMenuBarObject.prototype._closeTopPanels = function(panel) {
  1159. if ((this.lastSelectedItem) && (this.lastSelectedItem.parentPanel == panel))
  1160. this._unMarkItem(this.lastSelectedItem);
  1161. for (var i = 0; i < panel.itemsCount; i++) {
  1162. var zi = panel.items[i];
  1163. if ((zi.subMenu) && (zi.subMenu.topNod.style.display != "none")) {
  1164. zi.subMenu.topNod.style.display = "none";
  1165. this._unMarkItem(zi.subMenu.parentItem);
  1166. if (zi.subMenu.topNod.ieFix)
  1167. zi.subMenu.topNod.ieFix.style.display = "none"
  1168. this._closeTopPanels(zi.subMenu);
  1169. return
  1170. }
  1171. }
  1172. };
  1173. dhtmlXMenuBarObject.prototype._closeBottomPanels = function(panel, ieWinMode) {
  1174. if (panel.parentPanel) {
  1175. if ((!this.lastSelectedItem)
  1176. || (this.lastSelectedItem.parentPanel != panel.parentPanel)) {
  1177. this._closeBottomPanels(panel.parentPanel)
  1178. } else
  1179. this.lastOpenedPanel = panel;
  1180. panel.topNod.style.display = "none";
  1181. this._unMarkItem(panel.parentItem);
  1182. if (panel.topNod.ieFix)
  1183. panel.topNod.ieFix.style.display = "none"
  1184. }
  1185. };
  1186. dhtmlXMenuBarObject.prototype._unMarkItem = function(item) {
  1187. item.CSSTag.className = item.className;
  1188. if (item.CSSImageTag)
  1189. item.CSSImageTag.className = "";
  1190. if ((item.childMenuTag.src != "") && (this.topMenu.echsw)
  1191. && (this.topMenu.echsw2))
  1192. item.childMenuTag.src = this.topMenu.sysGfxPath + "btn_rt1.gif"
  1193. };
  1194. dhtmlXMenuBarObject.prototype._markItem = function(item, over) {
  1195. over = over || "over";
  1196. item.CSSTag.className = item.className + over;
  1197. if (item.CSSImageTag)
  1198. item.CSSImageTag.className = item.className + over + "img";
  1199. if ((item.childMenuTag.src != "") && (this.topMenu.echsw)
  1200. && (this.topMenu.echsw2))
  1201. item.childMenuTag.src = this.topMenu.sysGfxPath + "btn_rt2.gif"
  1202. };
  1203. dhtmlXMenuBarObject.prototype.setMenuMode = function(modeValue) {
  1204. this.modeValue = modeValue;
  1205. switch (modeValue) {
  1206. case "classic" :
  1207. this.addFirstLevel = this._addItem;
  1208. this.addSecondLevel = this.addItem_vertical;
  1209. break;
  1210. case "alfa" :
  1211. this.addFirstLevel = this._addItem;
  1212. this.addSecondLevel = this._addItem;
  1213. break;
  1214. case "popup" :
  1215. this.addFirstLevel = this.addItem_vertical;
  1216. this.addSecondLevel = this.addItem_vertical;
  1217. break;
  1218. case "betta" :
  1219. this.addFirstLevel = this.addItem_vertical;
  1220. this.addSecondLevel = this._addItem;
  1221. break
  1222. }
  1223. };
  1224. function dhtmlXMenuDividerYObject(id) {
  1225. this.topNod = 0;
  1226. if (id)
  1227. this.id = id;
  1228. else
  1229. this.id = 0;
  1230. td = document.createElement("td");
  1231. this.topNod = td;
  1232. td.align = "center";
  1233. td.style.padding = "2px 2px 1px 2px";
  1234. td.innerHTML = "<div class='menuDividerY'>&nbsp;</div>";
  1235. if (!document.all)
  1236. td.childNodes[0].style.height = "0px";
  1237. return this
  1238. };
  1239. dhtmlXMenuDividerYObject.prototype = new dhtmlXButtonPrototypeObject;
  1240. function dhtmlXMenuDividerXObject(id) {
  1241. this.topNod = 0;
  1242. if (id)
  1243. this.id = id;
  1244. else
  1245. this.id = 0;
  1246. td = document.createElement("td");
  1247. this.topNod = td;
  1248. td.align = "center";
  1249. td.style.paddingRight = "2px";
  1250. td.style.paddingLeft = "2px";
  1251. td.width = "4px";
  1252. td.innerHTML = "<div class='menuDivider'></div>";
  1253. if (!document.all) {
  1254. td.childNodes[0].style.width = "0px";
  1255. td.style.padding = "0px 0px 0px 0px";
  1256. td.style.margin = "0px 0px 0px 0px"
  1257. };
  1258. return this
  1259. };
  1260. dhtmlXMenuDividerXObject.prototype = new dhtmlXButtonPrototypeObject;
  1261. /*
  1262. * Copyright DHTMLX LTD. http://www.dhtmlx.com You allowed to use this component
  1263. * or parts of it under GPL terms To use it on other terms or get Professional
  1264. * edition of the component please contact us at sales@dhtmlx.com
  1265. */