a1portalcore.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  1. var A1PORTAL_COL_DELIMITER = String.fromCharCode(16);
  2. var A1PORTAL_ROW_DELIMITER = String.fromCharCode(15);
  3. var __a1portal_m_bPageLoaded = false;
  4. window.onload = __a1portal_Page_OnLoad;
  5. function __a1portal_ClientAPIEnabled() {
  6. return typeof(a1portal) != 'undefined';
  7. }
  8. function __a1portal_Page_OnLoad() {
  9. if (__a1portal_ClientAPIEnabled()) {
  10. var sLoadHandlers = a1portal.getVar('__a1portal_pageload');
  11. if (sLoadHandlers != null) eval(sLoadHandlers);
  12. a1portal.dom.attachEvent(window, 'onscroll', __a1portal_bodyscroll);
  13. }
  14. __a1portal_m_bPageLoaded = true;
  15. }
  16. function __a1portal_KeyDown(iKeyCode, sFunc, e) {
  17. if (e == null) e = window.event;
  18. if (e.keyCode == iKeyCode) {
  19. eval(unescape(sFunc));
  20. return false;
  21. }
  22. }
  23. function __a1portal_bodyscroll() {
  24. var oF = document.forms['Form'];
  25. if (__a1portal_ClientAPIEnabled() && __a1portal_m_bPageLoaded) oF.ScrollTop.value = document.documentElement.scrollTop ? document.documentElement.scrollTop: a1portal.dom.getByTagName("body")[0].scrollTop;
  26. }
  27. function __a1portal_setScrollTop(iTop) {
  28. if (__a1portal_ClientAPIEnabled()) {
  29. if (iTop == null) iTop = document.forms['Form'].ScrollTop.value;
  30. var sID = a1portal.getVar('ScrollToControl');
  31. if (sID != null && sID.length > 0) {
  32. var oCtl = a1portal.dom.getById(sID);
  33. if (oCtl != null) {
  34. iTop = a1portal.dom.positioning.elementTop(oCtl);
  35. a1portal.setVar('ScrollToControl', '');
  36. }
  37. }
  38. window.scrollTo(0, iTop);
  39. }
  40. }
  41. function __a1portal_SetInitialFocus(sID) {
  42. var oCtl = a1portal.dom.getById(sID);
  43. if (oCtl != null && __a1portal_CanReceiveFocus(oCtl)) oCtl.focus();
  44. }
  45. function __a1portal_CanReceiveFocus(e) {
  46. if (e.style.display != 'none' && e.tabIndex > -1 && e.disabled == false && e.style.visible != 'hidden') {
  47. var eParent = e.parentElement;
  48. while (eParent != null && eParent.tagName != 'BODY') {
  49. if (eParent.style.display == 'none' || eParent.disabled || eParent.style.visible == 'hidden') return false;
  50. eParent = eParent.parentElement;
  51. }
  52. return true;
  53. } else return false;
  54. }
  55. function __a1portal_ContainerMaxMin_OnClick(oLnk, sContentID) {
  56. var oContent = a1portal.dom.getById(sContentID);
  57. if (oContent != null) {
  58. var oBtn = oLnk.childNodes[0];
  59. var sContainerID = oLnk.getAttribute('containerid');
  60. var sCookieID = oLnk.getAttribute('cookieid');
  61. var sCurrentFile = oBtn.src.toLowerCase().substr(oBtn.src.lastIndexOf('/'));
  62. var sMaxFile;
  63. var sMaxIcon;
  64. var sMinIcon;
  65. if (a1portal.getVar('min_icon_' + sContainerID)) sMinIcon = a1portal.getVar('min_icon_' + sContainerID);
  66. else sMinIcon = a1portal.getVar('min_icon');
  67. if (a1portal.getVar('max_icon_' + sContainerID)) sMaxIcon = a1portal.getVar('max_icon_' + sContainerID);
  68. else sMaxIcon = a1portal.getVar('max_icon');
  69. sMaxFile = sMaxIcon.toLowerCase().substr(sMaxIcon.lastIndexOf('/'));
  70. var iNum = 5;
  71. if (oLnk.getAttribute('animf') != null) iNum = new Number(oLnk.getAttribute('animf'));
  72. if (sCurrentFile == sMaxFile) {
  73. oBtn.src = sMinIcon;
  74. a1portal.dom.expandElement(oContent, iNum);
  75. oBtn.title = a1portal.getVar('min_text');
  76. if (sCookieID != null) {
  77. if (a1portal.getVar('__a1portal_' + sContainerID + ':defminimized') == 'true') a1portal.dom.setCookie(sCookieID, 'true', 365);
  78. else a1portal.dom.deleteCookie(sCookieID);
  79. } else a1portal.setVar('__a1portal_' + sContainerID + '_Visible', 'true');
  80. } else {
  81. oBtn.src = sMaxIcon;
  82. a1portal.dom.collapseElement(oContent, iNum);
  83. oBtn.title = a1portal.getVar('max_text');
  84. if (sCookieID != null) {
  85. if (a1portal.getVar('__a1portal_' + sContainerID + ':defminimized') == 'true') a1portal.dom.deleteCookie(sCookieID);
  86. else a1portal.dom.setCookie(sCookieID, 'false', 365);
  87. } else a1portal.setVar('__a1portal_' + sContainerID + '_Visible', 'false');
  88. }
  89. return true;
  90. }
  91. return false;
  92. }
  93. function __a1portal_Help_OnClick(sHelpID) {
  94. var oHelp = a1portal.dom.getById(sHelpID);
  95. if (oHelp != null) {
  96. if (oHelp.style.display == 'none') oHelp.style.display = '';
  97. else oHelp.style.display = 'none';
  98. return true;
  99. }
  100. return false;
  101. }
  102. function __a1portal_SectionMaxMin(oBtn, sContentID) {
  103. var oContent = a1portal.dom.getById(sContentID);
  104. if (oContent != null) {
  105. var sMaxIcon = oBtn.getAttribute('max_icon');
  106. var sMinIcon = oBtn.getAttribute('min_icon');
  107. var bCallback = oBtn.getAttribute('userctr') != null;
  108. var sVal;
  109. if (oContent.style.display == 'none') {
  110. oBtn.src = sMinIcon;
  111. oContent.style.display = '';
  112. if (bCallback) sVal = 'True';
  113. else a1portal.setVar(oBtn.id + ':exp', 1);
  114. } else {
  115. oBtn.src = sMaxIcon;
  116. oContent.style.display = 'none';
  117. if (bCallback) sVal = 'False';
  118. else a1portal.setVar(oBtn.id + ':exp', 0);
  119. }
  120. if (bCallback) a1portalcore.setUserProp(oBtn.getAttribute('userctr'), oBtn.getAttribute('userkey'), sVal, null);
  121. return true;
  122. }
  123. return false;
  124. }
  125. function __a1portal_enableDragDrop() {
  126. var aryConts = a1portal.getVar('__a1portal_dragDrop').split(";");
  127. var aryTitles;
  128. a1portal.dom.positioning.disableSelectText();
  129. var aryContsLength = aryConts.length;
  130. for (var i = 0; i < aryContsLength; i++) {
  131. aryTitles = aryConts[i].split(" ");
  132. if (aryTitles[0].length > 0) {
  133. var oCtr = a1portal.dom.getById(aryTitles[0]);
  134. var oTitle = a1portal.dom.getById(aryTitles[1]);
  135. //laputa move block
  136. if(oTitle.modulePaneId == 'undefined' || oTitle.modulePaneId==null)
  137. {
  138. oTitle.modulePaneId = aryTitles[3];
  139. }
  140. if(oTitle.moveBlockId == 'undefined' || oTitle.moveBlockId==null)
  141. {
  142. oTitle.moveBlockId = aryTitles[4];
  143. }
  144. if(oTitle.pagePaneId == 'undefined' || oTitle.pagePaneId==null)
  145. {
  146. oTitle.pagePaneId = aryTitles[5];
  147. }
  148. if (oCtr != null && oTitle != null) {
  149. //oCtr.setAttribute('moduleid', aryTitles[2]);
  150. a1portal.dom.positioning.enableDragAndDrop(oCtr, oTitle);
  151. }
  152. }
  153. }
  154. }
  155. var __a1portal_oPrevSelPane = null;
  156. var __a1portal_oPrevSelModule = null;
  157. var __a1portal_dragPlaceholderId = 'a1portal_drag_placeholder';
  158. var __a1portal_oPrevIIndex = null;
  159. var __a1portal_dragPlaceholder = null;
  160. function __a1portal_dragOver() {
  161. var oCont = a1portal.dom.positioning.dragCont;
  162. var oPane = __a1portal_getMostSelectedPane();
  163. if (oPane != null) {
  164. var iIndex = __a1portal_getPaneControlIndex(oCont, oPane);
  165. //var iIndex = __a1portal_getPaneControlIndex2(oCont, oPane);
  166. //__a1portal_getPaneControlIndex2(oCont, oPane);
  167. if (__a1portal_oPrevSelPane != null) {
  168. if (__a1portal_oPrevSelPane.id != oPane.id) {
  169. __a1portal_oPrevSelPane.pane.style.border = __a1portal_oPrevSelPane.origBorder;
  170. } else if (__a1portal_oPrevIIndex == iIndex && __a1portal_oPrevSelModule != null) {
  171. return;
  172. }
  173. }
  174. a1portal.dom.positioning.removePlaceholder(__a1portal_dragPlaceholder, __a1portal_dragPlaceholderId);
  175. if (__a1portal_oPrevSelPane != null) {
  176. __a1portal_RecalculatePaneControlDims(__a1portal_oPrevSelPane);
  177. }
  178. __a1portal_RecalculatePaneControlDims(oPane);
  179. oPane.pane.style.outline = '1px dotted ' + A1PORTAL_HIGHLIGHT_COLOR;
  180. var oPrevCtl;
  181. var oNextCtl;
  182. var selNode;
  183. var dragPlaceholder;
  184. var oPaneControlsLength = oPane.controls.length;
  185. for (var i = 0; i < oPaneControlsLength; i++) {
  186. var oPaneControlsId = oPane.controls[i].id;
  187. var oPaneControls = oPane.controls[i];
  188. var oContId = oCont.id;
  189. if (iIndex > i && oPaneControlsId != oContId) oPrevCtl = oPaneControls;
  190. if (iIndex <= i && oPaneControlsId != oContId) {
  191. oNextCtl = oPaneControls;
  192. break;
  193. }
  194. }
  195. if (__a1portal_dragPlaceholder == null) {
  196. __a1portal_dragPlaceholder = document.createElement("div");
  197. __a1portal_dragPlaceholder.setAttribute("id", __a1portal_dragPlaceholderId);
  198. __a1portal_dragPlaceholder.setAttribute("class", "moduleMovePlaceholder");
  199. __a1portal_dragPlaceholder.style.border = '1px dotted red';
  200. __a1portal_dragPlaceholder.style.margin = '4px 0px 4px 0px';
  201. }
  202. var paneElementWidth = a1portal.dom.positioning.elementWidth(oPane.pane);
  203. if (paneElementWidth != null) {
  204. if (paneElementWidth <= oCont.elementWidth) {
  205. if (oNextCtl != null) {
  206. paneElementWidth = document.id(oNextCtl.control).getSize().x;
  207. } else if (oPrevCtl != null) {
  208. paneElementWidth = document.id(oPrevCtl.control).getSize().x;
  209. }
  210. __a1portal_dragPlaceholder.style.width = (paneElementWidth - 2) + 'px';
  211. } else {
  212. __a1portal_dragPlaceholder.style.width = "";
  213. }
  214. }
  215. //__a1portal_dragPlaceholder.style.height = parseInt(oCont.elementWidth * oCont.elementHeight / paneElementWidth) + 'px';
  216. __a1portal_dragPlaceholder.style.height = '50px';
  217. if (oNextCtl != null) {
  218. __a1portal_oPrevSelModule = oNextCtl;
  219. selNode = a1portal.dom.getNonTextNode(oNextCtl.control);
  220. selNode.parentNode.insertBefore(__a1portal_dragPlaceholder, selNode);
  221. } else if (oPrevCtl != null) {
  222. __a1portal_oPrevSelModule = oPrevCtl;
  223. selNode = a1portal.dom.getNonTextNode(oPrevCtl.control);
  224. a1portal.dom.insertAfter(__a1portal_dragPlaceholder, selNode);
  225. } else {
  226. selNode = a1portal.dom.getById(oPane.id);
  227. a1portal.dom.appendChild(selNode, __a1portal_dragPlaceholder);
  228. }
  229. //__a1portal_oPrevSelPane = oPane;
  230. __a1portal_oPrevIIndex = iIndex;
  231. __a1portal_RecalculatePaneDims();
  232. }
  233. }
  234. function __a1portal_dragComplete() {
  235. var oCont = a1portal.dom.positioning.dragCont;
  236. var sModuleID = oCont.getAttribute('moduleid');
  237. var sModuleIdentifier = oCont.getAttribute('moduleidentifier');
  238. var oPane = __a1portal_getMostSelectedPane();
  239. var iIndex;
  240. if (oPane == null) {
  241. var oPanes = __a1portal_Panes();
  242. var oPanesLength = oPanes.length
  243. for (var i = 0; i < oPanesLength; i++) {
  244. if (oPanes[i].id == oCont.parentNode.id) oPane = oPanes[i];
  245. }
  246. }
  247. if (oPane != null) {
  248. iIndex = __a1portal_getPaneControlIndex(oCont, oPane);
  249. //iIndex = __a1portal_getPaneControlIndex2(oCont, oPane);
  250. __a1portal_MoveToPane(oPane, oCont, iIndex);
  251. a1portal.dom.positioning.destroyDragEvent();
  252. showPageLoader('');
  253. a1portal.callPostBack('MoveToPane', 'moduleid=' + sModuleID,'moduleidentifier=' + sModuleIdentifier, 'pane=' + oPane.paneName, 'order=' + iIndex * 2);
  254. }
  255. }
  256. function __a1portal_MoveToPane(oPane, oCont, iIndex) {
  257. if (oPane != null) {
  258. var aryCtls = new Array();
  259. var oPaneControlsLength = oPane.controls.length;
  260. for (var i = iIndex; i < oPaneControlsLength; i++) {
  261. if (oPane.controls[i].control.id != oCont.id) aryCtls[aryCtls.length] = oPane.controls[i].control;
  262. a1portal.dom.removeChild(oPane.controls[i].control);
  263. }
  264. a1portal.dom.appendChild(oPane.pane, oCont);
  265. oCont.style.top = 0;
  266. oCont.style.left = 0;
  267. oCont.style.position = 'relative';
  268. var aryCtlsLength = aryCtls.length;
  269. for (var i = 0; i < aryCtlsLength; i++) {
  270. a1portal.dom.appendChild(oPane.pane, aryCtls[i]);
  271. }
  272. __a1portal_RefreshPanes();
  273. } else {
  274. oCont.style.top = 0;
  275. oCont.style.left = 0;
  276. oCont.style.position = 'relative';
  277. }
  278. }
  279. function __a1portal_RefreshPanes() {
  280. var aryPanes = a1portal.getVar('__a1portal_Panes').split(';');
  281. var aryPaneNames = a1portal.getVar('__a1portal_PaneNames').split(';');
  282. __a1portal_m_aryPanes = new Array();
  283. var aryPanesLength = aryPanes.length;
  284. for (var i = 0; i < aryPanesLength; i++) {
  285. if (aryPanes[i].length > 0) __a1portal_m_aryPanes[__a1portal_m_aryPanes.length] = new __a1portal_Pane(a1portal.dom.getById(aryPanes[i]), aryPaneNames[i]);
  286. }
  287. }
  288. var __a1portal_m_aryPanes;
  289. var __a1portal_m_aryModules;
  290. function __a1portal_Panes() {
  291. if (__a1portal_m_aryPanes == null) {
  292. __a1portal_m_aryPanes = new Array();
  293. __a1portal_RefreshPanes();
  294. }
  295. return __a1portal_m_aryPanes;
  296. }
  297. function __a1portal_RecalculatePaneDims(){
  298. var oPanes = __a1portal_Panes();
  299. var a1portalPanesLength = oPanes.length
  300. for (var i = 0; i < a1portalPanesLength; i++) {
  301. var oPane = oPanes[i];
  302. oPane.dims = a1portal.dom.positioning.dims2(oPane.pane);
  303. }
  304. }
  305. function __a1portal_RecalculatePaneControlDims(oPane){
  306. if(oPane != null){
  307. var oPaneControls = oPane.controls;
  308. var oPaneControlsLength = oPaneControls.length;
  309. var oCont = null;
  310. for (var i = 0; i < oPaneControlsLength; i++) {
  311. oCont = oPaneControls[i];
  312. oCont.dims = a1portal.dom.positioning.dims2(oCont.control);
  313. }
  314. }
  315. }
  316. function __a1portal_Modules(sModuleID) {
  317. if (__a1portal_m_aryModules == null) __a1portal_RefreshPanes();
  318. return __a1portal_m_aryModules[sModuleID];
  319. }
  320. function __a1portal_getMostSelectedPane() {
  321. //laputa modify:sectionPane support
  322. var oTopPane = new Array();
  323. var ev = a1portal.dom.event.object;
  324. var de = document.documentElement;
  325. var b = document.body;
  326. var cursor_x = ev.pageX || (ev.clientX + (de.scrollLeft || b.scrollLeft));
  327. var cursor_y = ev.pageY || (ev.clientY + (de.scrollTop || b.scrollTop));
  328. if (__a1portal_oPrevSelPane != null) {
  329. var oPDims = __a1portal_oPrevSelPane.dims;
  330. if ((cursor_x > oPDims.l) && (cursor_y > oPDims.t) && (cursor_x < (oPDims.l + oPDims.w)) && (cursor_y < (oPDims.t + oPDims.h))) {
  331. oTopPane[0] = __a1portal_oPrevSelPane;
  332. }
  333. }
  334. if(oTopPane.length == 0){
  335. var oPanes = __a1portal_Panes();
  336. var a1portalPanesLength = oPanes.length
  337. for (var i = 0; i < a1portalPanesLength; i++) {
  338. var oPane = oPanes[i];
  339. var oPDims = oPane.dims;
  340. if ((cursor_x > oPDims.l) && (cursor_y > oPDims.t) && (cursor_x < (oPDims.l + oPDims.w)) && (cursor_y < (oPDims.t + oPDims.h))) {
  341. oTopPane[oTopPane.length+1] = oPane;
  342. }
  343. }
  344. }
  345. return oTopPane[oTopPane.length-1];
  346. }
  347. function __a1portal_getPaneControlIndex(oContent, oPane) {
  348. if (oPane == null) return;
  349. var y = oContent.getOffsets().y
  350. //alert(oContent.id+'______'+y);
  351. var oCont;
  352. if (oPane.controls.length == 0) return 0;
  353. var oPaneControlsLength = oPane.controls.length;
  354. for (var i = 0; i < oPaneControlsLength; i++) {
  355. oCont = oPane.controls[i];
  356. var oIDims = oCont.dims;
  357. //alert(y +'<'+oIDims.t)
  358. //laputa modify best move to top
  359. if (oCont.control != oContent && y < oIDims.t+50){ return oCont.index;}
  360. }
  361. if (oCont != null) return oCont.index + 1;
  362. else return 0;
  363. }
  364. function __a1portal_getPaneControlIndex2(oContent, oPane) {
  365. if (oPane == null) return;
  366. var y = oContent.getOffsets().y
  367. var oCont;
  368. var oPaneControlsLength = oPane.controls.length;
  369. if (oPaneControlsLength == 0) return 0;
  370. var i = 0;
  371. for (i; i < oPaneControlsLength; i++) {
  372. oCont = oPane.controls[i];
  373. if (oCont.control == oContent) break;
  374. }
  375. var oPreCont = null;
  376. var oNextCont = null;
  377. if(i == 0){
  378. if(oPaneControlsLength > 1){
  379. oNextCont = oPane.controls[1];
  380. }else{
  381. //return oPane.controls[i].index;
  382. return 0;
  383. }
  384. }else if(i == oPaneControlsLength -1){
  385. oPreCont = oPane.controls[i-1];
  386. }else{
  387. oPreCont = oPane.controls[i-1];
  388. oNextCont = oPane.controls[i+1];
  389. }
  390. if(oPreCont != null && y < oPreCont.dims.t) return oPreCont.index;
  391. if(oNextCont != null && y > oNextCont.dims.t) return oNextCont.index;
  392. }
  393. function __a1portal_Pane(ctl, sPaneName) {
  394. this.pane = ctl;
  395. this.id = ctl.id;
  396. this.controls = new Array();
  397. this.origBorder = ctl.style.border;
  398. this.paneName = sPaneName;
  399. var iIndex = 0;
  400. var strModuleOrder = '';
  401. var ctlChildNodesLength = ctl.childNodes.length;
  402. for (var i = 0; i < ctlChildNodesLength; i++) {
  403. var oNode = ctl.childNodes[i];
  404. if (a1portal.dom.isNonTextNode(oNode)) {
  405. if (__a1portal_m_aryModules == null) __a1portal_m_aryModules = new Array();
  406. var sModuleID = oNode.getAttribute('moduleid');
  407. if (sModuleID != null && sModuleID.length > 0) {
  408. strModuleOrder += sModuleID + '~';
  409. this.controls[this.controls.length] = new __a1portal_PaneControl(oNode, iIndex);
  410. __a1portal_m_aryModules[sModuleID] = oNode.id;
  411. iIndex += 1;
  412. }
  413. }
  414. }
  415. this.moduleOrder = strModuleOrder;
  416. this.dims = a1portal.dom.positioning.dims2(this.pane);
  417. }
  418. function __a1portal_PaneControl(ctl, iIndex) {
  419. this.control = ctl;
  420. this.id = ctl.id;
  421. this.index = iIndex;
  422. this.origBorder = ctl.style.border;
  423. this.dims = a1portal.dom.positioning.dims2(this.control);
  424. }
  425. function __a1portalcore() {
  426. this.GetUserVal = 0;
  427. this.SetUserVal = 1;
  428. }
  429. __a1portalcore.prototype = {
  430. getUserProp: function(sNameCtr, sKey, pFunc) {
  431. this._doUserCallBack(a1portalcore.GetUserVal, sNameCtr, sKey, null, new a1portalcore.UserPropArgs(sNameCtr, sKey, pFunc));
  432. },
  433. setUserProp: function(sNameCtr, sKey, sVal, pFunc) {
  434. this._doUserCallBack(a1portalcore.SetUserVal, sNameCtr, sKey, sVal, new a1portalcore.UserPropArgs(sNameCtr, sKey, pFunc));
  435. },
  436. _doUserCallBack: function(iType, sNameCtr, sKey, sVal, pFunc) {
  437. if (a1portal && a1portal.xmlhttp) {
  438. var sPack = iType + COL_DELIMITER + sNameCtr + COL_DELIMITER + sKey + COL_DELIMITER + sVal;
  439. a1portal.xmlhttp.doCallBack('__Page', sPack, a1portalcore._callBackSuccess, pFunc, a1portalcore._callBackFail, null, true, null, 0);
  440. } else alert('Client Personalization not enabled');
  441. },
  442. _callBackSuccess: function(result, ctx, req) {
  443. if (ctx.pFunc) ctx.pFunc(ctx.namingCtr, ctx.key, result);
  444. },
  445. _callBackFail: function(result, ctx) {
  446. window.status = result;
  447. }
  448. }
  449. __a1portalcore.prototype.UserPropArgs = function(sNameCtr, sKey, pFunc) {
  450. this.namingCtr = sNameCtr;
  451. this.key = sKey;
  452. this.pFunc = pFunc;
  453. }
  454. var a1portalcore = new __a1portalcore();
  455. function __a1portal_GetRelatedTarget(e)
  456. {
  457. if (!e) {
  458. return null;
  459. }
  460. return e.relatedTarget || (e.type == "mouseout" ? e.toElement: e.fromElement);
  461. }
  462. function __a1portal_IsChildOf(container, element) {
  463. if (element == container) {
  464. return false;
  465. }
  466. while (element && (element != document.body)) {
  467. if (element == container) {
  468. return true;
  469. }
  470. try {
  471. element = element.parentNode;
  472. } catch(e) {
  473. return false;
  474. }
  475. }
  476. return false;
  477. }
  478. function __a1portal_isElementOver(element, evt){
  479. var oRelatedTarget = __a1portal_GetRelatedTarget(evt);
  480. if (__a1portal_IsChildOf(element, oRelatedTarget) || element == oRelatedTarget) {
  481. return true;
  482. }
  483. return false;
  484. }
  485. function __a1portal_isElementOut(element, evt){
  486. var oRelatedTarget = __a1portal_GetRelatedTarget(evt);
  487. if (oRelatedTarget && (__a1portal_IsChildOf(element, oRelatedTarget) || element == oRelatedTarget)) {
  488. return true;
  489. }
  490. return false;
  491. }
  492. function toggleDiv(element){
  493. if(document.getElementById(element).style.display == 'none')
  494. {
  495. document.getElementById(element).style.display = 'block';
  496. }
  497. else if(document.getElementById(element).style.display == 'block')
  498. {
  499. document.getElementById(element).style.display = 'none';
  500. }
  501. }