var a1portal_col_delimiter = string.fromcharcode(16); var a1portal_row_delimiter = string.fromcharcode(15); var __a1portal_m_bpageloaded = false; window.onload = __a1portal_page_onload; function __a1portal_clientapienabled() { return typeof(a1portal) != 'undefined'; } function __a1portal_page_onload() { if (__a1portal_clientapienabled()) { var sloadhandlers = a1portal.getvar('__a1portal_pageload'); if (sloadhandlers != null) eval(sloadhandlers); a1portal.dom.attachevent(window, 'onscroll', __a1portal_bodyscroll); } __a1portal_m_bpageloaded = true; } function __a1portal_keydown(ikeycode, sfunc, e) { if (e == null) e = window.event; if (e.keycode == ikeycode) { eval(unescape(sfunc)); return false; } } function __a1portal_bodyscroll() { var of = document.forms['form']; if (__a1portal_clientapienabled() && __a1portal_m_bpageloaded) of.scrolltop.value = document.documentelement.scrolltop ? document.documentelement.scrolltop: a1portal.dom.getbytagname("body")[0].scrolltop; } function __a1portal_setscrolltop(itop) { if (__a1portal_clientapienabled()) { if (itop == null) itop = document.forms['form'].scrolltop.value; var sid = a1portal.getvar('scrolltocontrol'); if (sid != null && sid.length > 0) { var octl = a1portal.dom.getbyid(sid); if (octl != null) { itop = a1portal.dom.positioning.elementtop(octl); a1portal.setvar('scrolltocontrol', ''); } } window.scrollto(0, itop); } } function __a1portal_setinitialfocus(sid) { var octl = a1portal.dom.getbyid(sid); if (octl != null && __a1portal_canreceivefocus(octl)) octl.focus(); } function __a1portal_canreceivefocus(e) { if (e.style.display != 'none' && e.tabindex > -1 && e.disabled == false && e.style.visible != 'hidden') { var eparent = e.parentelement; while (eparent != null && eparent.tagname != 'body') { if (eparent.style.display == 'none' || eparent.disabled || eparent.style.visible == 'hidden') return false; eparent = eparent.parentelement; } return true; } else return false; } function __a1portal_containermaxmin_onclick(olnk, scontentid) { var ocontent = a1portal.dom.getbyid(scontentid); if (ocontent != null) { var obtn = olnk.childnodes[0]; var scontainerid = olnk.getattribute('containerid'); var scookieid = olnk.getattribute('cookieid'); var scurrentfile = obtn.src.tolowercase().substr(obtn.src.lastindexof('/')); var smaxfile; var smaxicon; var sminicon; if (a1portal.getvar('min_icon_' + scontainerid)) sminicon = a1portal.getvar('min_icon_' + scontainerid); else sminicon = a1portal.getvar('min_icon'); if (a1portal.getvar('max_icon_' + scontainerid)) smaxicon = a1portal.getvar('max_icon_' + scontainerid); else smaxicon = a1portal.getvar('max_icon'); smaxfile = smaxicon.tolowercase().substr(smaxicon.lastindexof('/')); var inum = 5; if (olnk.getattribute('animf') != null) inum = new number(olnk.getattribute('animf')); if (scurrentfile == smaxfile) { obtn.src = sminicon; a1portal.dom.expandelement(ocontent, inum); obtn.title = a1portal.getvar('min_text'); if (scookieid != null) { if (a1portal.getvar('__a1portal_' + scontainerid + ':defminimized') == 'true') a1portal.dom.setcookie(scookieid, 'true', 365); else a1portal.dom.deletecookie(scookieid); } else a1portal.setvar('__a1portal_' + scontainerid + '_visible', 'true'); } else { obtn.src = smaxicon; a1portal.dom.collapseelement(ocontent, inum); obtn.title = a1portal.getvar('max_text'); if (scookieid != null) { if (a1portal.getvar('__a1portal_' + scontainerid + ':defminimized') == 'true') a1portal.dom.deletecookie(scookieid); else a1portal.dom.setcookie(scookieid, 'false', 365); } else a1portal.setvar('__a1portal_' + scontainerid + '_visible', 'false'); } return true; } return false; } function __a1portal_help_onclick(shelpid) { var ohelp = a1portal.dom.getbyid(shelpid); if (ohelp != null) { if (ohelp.style.display == 'none') ohelp.style.display = ''; else ohelp.style.display = 'none'; return true; } return false; } function __a1portal_sectionmaxmin(obtn, scontentid) { var ocontent = a1portal.dom.getbyid(scontentid); if (ocontent != null) { var smaxicon = obtn.getattribute('max_icon'); var sminicon = obtn.getattribute('min_icon'); var bcallback = obtn.getattribute('userctr') != null; var sval; if (ocontent.style.display == 'none') { obtn.src = sminicon; ocontent.style.display = ''; if (bcallback) sval = 'true'; else a1portal.setvar(obtn.id + ':exp', 1); } else { obtn.src = smaxicon; ocontent.style.display = 'none'; if (bcallback) sval = 'false'; else a1portal.setvar(obtn.id + ':exp', 0); } if (bcallback) a1portalcore.setuserprop(obtn.getattribute('userctr'), obtn.getattribute('userkey'), sval, null); return true; } return false; } function __a1portal_enabledragdrop() { var aryconts = a1portal.getvar('__a1portal_dragdrop').split(";"); var arytitles; a1portal.dom.positioning.disableselecttext(); var arycontslength = aryconts.length; for (var i = 0; i < arycontslength; i++) { arytitles = aryconts[i].split(" "); if (arytitles[0].length > 0) { var octr = a1portal.dom.getbyid(arytitles[0]); var otitle = a1portal.dom.getbyid(arytitles[1]); //laputa move block if(otitle.modulepaneid == 'undefined' || otitle.modulepaneid==null) { otitle.modulepaneid = arytitles[3]; } if(otitle.moveblockid == 'undefined' || otitle.moveblockid==null) { otitle.moveblockid = arytitles[4]; } if(otitle.pagepaneid == 'undefined' || otitle.pagepaneid==null) { otitle.pagepaneid = arytitles[5]; } if (octr != null && otitle != null) { //octr.setattribute('moduleid', arytitles[2]); a1portal.dom.positioning.enabledraganddrop(octr, otitle); } } } } var __a1portal_oprevselpane = null; var __a1portal_oprevselmodule = null; var __a1portal_dragplaceholderid = 'a1portal_drag_placeholder'; var __a1portal_opreviindex = null; var __a1portal_dragplaceholder = null; function __a1portal_dragover() { var ocont = a1portal.dom.positioning.dragcont; var opane = __a1portal_getmostselectedpane(); if (opane != null) { var iindex = __a1portal_getpanecontrolindex(ocont, opane); //var iindex = __a1portal_getpanecontrolindex2(ocont, opane); //__a1portal_getpanecontrolindex2(ocont, opane); if (__a1portal_oprevselpane != null) { if (__a1portal_oprevselpane.id != opane.id) { __a1portal_oprevselpane.pane.style.border = __a1portal_oprevselpane.origborder; } else if (__a1portal_opreviindex == iindex && __a1portal_oprevselmodule != null) { return; } } a1portal.dom.positioning.removeplaceholder(__a1portal_dragplaceholder, __a1portal_dragplaceholderid); if (__a1portal_oprevselpane != null) { __a1portal_recalculatepanecontroldims(__a1portal_oprevselpane); } __a1portal_recalculatepanecontroldims(opane); opane.pane.style.outline = '1px dotted ' + a1portal_highlight_color; var oprevctl; var onextctl; var selnode; var dragplaceholder; var opanecontrolslength = opane.controls.length; for (var i = 0; i < opanecontrolslength; i++) { var opanecontrolsid = opane.controls[i].id; var opanecontrols = opane.controls[i]; var ocontid = ocont.id; if (iindex > i && opanecontrolsid != ocontid) oprevctl = opanecontrols; if (iindex <= i && opanecontrolsid != ocontid) { onextctl = opanecontrols; break; } } if (__a1portal_dragplaceholder == null) { __a1portal_dragplaceholder = document.createelement("div"); __a1portal_dragplaceholder.setattribute("id", __a1portal_dragplaceholderid); __a1portal_dragplaceholder.setattribute("class", "modulemoveplaceholder"); __a1portal_dragplaceholder.style.border = '1px dotted red'; __a1portal_dragplaceholder.style.margin = '4px 0px 4px 0px'; } var paneelementwidth = a1portal.dom.positioning.elementwidth(opane.pane); if (paneelementwidth != null) { if (paneelementwidth <= ocont.elementwidth) { if (onextctl != null) { paneelementwidth = document.id(onextctl.control).getsize().x; } else if (oprevctl != null) { paneelementwidth = document.id(oprevctl.control).getsize().x; } __a1portal_dragplaceholder.style.width = (paneelementwidth - 2) + 'px'; } else { __a1portal_dragplaceholder.style.width = ""; } } //__a1portal_dragplaceholder.style.height = parseint(ocont.elementwidth * ocont.elementheight / paneelementwidth) + 'px'; __a1portal_dragplaceholder.style.height = '50px'; if (onextctl != null) { __a1portal_oprevselmodule = onextctl; selnode = a1portal.dom.getnontextnode(onextctl.control); selnode.parentnode.insertbefore(__a1portal_dragplaceholder, selnode); } else if (oprevctl != null) { __a1portal_oprevselmodule = oprevctl; selnode = a1portal.dom.getnontextnode(oprevctl.control); a1portal.dom.insertafter(__a1portal_dragplaceholder, selnode); } else { selnode = a1portal.dom.getbyid(opane.id); a1portal.dom.appendchild(selnode, __a1portal_dragplaceholder); } //__a1portal_oprevselpane = opane; __a1portal_opreviindex = iindex; __a1portal_recalculatepanedims(); } } function __a1portal_dragcomplete() { var ocont = a1portal.dom.positioning.dragcont; var smoduleid = ocont.getattribute('moduleid'); var smoduleidentifier = ocont.getattribute('moduleidentifier'); var opane = __a1portal_getmostselectedpane(); var iindex; if (opane == null) { var opanes = __a1portal_panes(); var opaneslength = opanes.length for (var i = 0; i < opaneslength; i++) { if (opanes[i].id == ocont.parentnode.id) opane = opanes[i]; } } if (opane != null) { iindex = __a1portal_getpanecontrolindex(ocont, opane); //iindex = __a1portal_getpanecontrolindex2(ocont, opane); __a1portal_movetopane(opane, ocont, iindex); a1portal.dom.positioning.destroydragevent(); showpageloader(''); a1portal.callpostback('movetopane', 'moduleid=' + smoduleid,'moduleidentifier=' + smoduleidentifier, 'pane=' + opane.panename, 'order=' + iindex * 2); } } function __a1portal_movetopane(opane, ocont, iindex) { if (opane != null) { var aryctls = new array(); var opanecontrolslength = opane.controls.length; for (var i = iindex; i < opanecontrolslength; i++) { if (opane.controls[i].control.id != ocont.id) aryctls[aryctls.length] = opane.controls[i].control; a1portal.dom.removechild(opane.controls[i].control); } a1portal.dom.appendchild(opane.pane, ocont); ocont.style.top = 0; ocont.style.left = 0; ocont.style.position = 'relative'; var aryctlslength = aryctls.length; for (var i = 0; i < aryctlslength; i++) { a1portal.dom.appendchild(opane.pane, aryctls[i]); } __a1portal_refreshpanes(); } else { ocont.style.top = 0; ocont.style.left = 0; ocont.style.position = 'relative'; } } function __a1portal_refreshpanes() { var arypanes = a1portal.getvar('__a1portal_panes').split(';'); var arypanenames = a1portal.getvar('__a1portal_panenames').split(';'); __a1portal_m_arypanes = new array(); var arypaneslength = arypanes.length; for (var i = 0; i < arypaneslength; i++) { if (arypanes[i].length > 0) __a1portal_m_arypanes[__a1portal_m_arypanes.length] = new __a1portal_pane(a1portal.dom.getbyid(arypanes[i]), arypanenames[i]); } } var __a1portal_m_arypanes; var __a1portal_m_arymodules; function __a1portal_panes() { if (__a1portal_m_arypanes == null) { __a1portal_m_arypanes = new array(); __a1portal_refreshpanes(); } return __a1portal_m_arypanes; } function __a1portal_recalculatepanedims(){ var opanes = __a1portal_panes(); var a1portalpaneslength = opanes.length for (var i = 0; i < a1portalpaneslength; i++) { var opane = opanes[i]; opane.dims = a1portal.dom.positioning.dims2(opane.pane); } } function __a1portal_recalculatepanecontroldims(opane){ if(opane != null){ var opanecontrols = opane.controls; var opanecontrolslength = opanecontrols.length; var ocont = null; for (var i = 0; i < opanecontrolslength; i++) { ocont = opanecontrols[i]; ocont.dims = a1portal.dom.positioning.dims2(ocont.control); } } } function __a1portal_modules(smoduleid) { if (__a1portal_m_arymodules == null) __a1portal_refreshpanes(); return __a1portal_m_arymodules[smoduleid]; } function __a1portal_getmostselectedpane() { //laputa modify:sectionpane support var otoppane = new array(); var ev = a1portal.dom.event.object; var de = document.documentelement; var b = document.body; var cursor_x = ev.pagex || (ev.clientx + (de.scrollleft || b.scrollleft)); var cursor_y = ev.pagey || (ev.clienty + (de.scrolltop || b.scrolltop)); if (__a1portal_oprevselpane != null) { var opdims = __a1portal_oprevselpane.dims; if ((cursor_x > opdims.l) && (cursor_y > opdims.t) && (cursor_x < (opdims.l + opdims.w)) && (cursor_y < (opdims.t + opdims.h))) { otoppane[0] = __a1portal_oprevselpane; } } if(otoppane.length == 0){ var opanes = __a1portal_panes(); var a1portalpaneslength = opanes.length for (var i = 0; i < a1portalpaneslength; i++) { var opane = opanes[i]; var opdims = opane.dims; if ((cursor_x > opdims.l) && (cursor_y > opdims.t) && (cursor_x < (opdims.l + opdims.w)) && (cursor_y < (opdims.t + opdims.h))) { otoppane[otoppane.length+1] = opane; } } } return otoppane[otoppane.length-1]; } function __a1portal_getpanecontrolindex(ocontent, opane) { if (opane == null) return; var y = ocontent.getoffsets().y //alert(ocontent.id+'______'+y); var ocont; if (opane.controls.length == 0) return 0; var opanecontrolslength = opane.controls.length; for (var i = 0; i < opanecontrolslength; i++) { ocont = opane.controls[i]; var oidims = ocont.dims; //alert(y +'<'+oidims.t) //laputa modify best move to top if (ocont.control != ocontent && y < oidims.t+50){ return ocont.index;} } if (ocont != null) return ocont.index + 1; else return 0; } function __a1portal_getpanecontrolindex2(ocontent, opane) { if (opane == null) return; var y = ocontent.getoffsets().y var ocont; var opanecontrolslength = opane.controls.length; if (opanecontrolslength == 0) return 0; var i = 0; for (i; i < opanecontrolslength; i++) { ocont = opane.controls[i]; if (ocont.control == ocontent) break; } var oprecont = null; var onextcont = null; if(i == 0){ if(opanecontrolslength > 1){ onextcont = opane.controls[1]; }else{ //return opane.controls[i].index; return 0; } }else if(i == opanecontrolslength -1){ oprecont = opane.controls[i-1]; }else{ oprecont = opane.controls[i-1]; onextcont = opane.controls[i+1]; } if(oprecont != null && y < oprecont.dims.t) return oprecont.index; if(onextcont != null && y > onextcont.dims.t) return onextcont.index; } function __a1portal_pane(ctl, spanename) { this.pane = ctl; this.id = ctl.id; this.controls = new array(); this.origborder = ctl.style.border; this.panename = spanename; var iindex = 0; var strmoduleorder = ''; var ctlchildnodeslength = ctl.childnodes.length; for (var i = 0; i < ctlchildnodeslength; i++) { var onode = ctl.childnodes[i]; if (a1portal.dom.isnontextnode(onode)) { if (__a1portal_m_arymodules == null) __a1portal_m_arymodules = new array(); var smoduleid = onode.getattribute('moduleid'); if (smoduleid != null && smoduleid.length > 0) { strmoduleorder += smoduleid + '~'; this.controls[this.controls.length] = new __a1portal_panecontrol(onode, iindex); __a1portal_m_arymodules[smoduleid] = onode.id; iindex += 1; } } } this.moduleorder = strmoduleorder; this.dims = a1portal.dom.positioning.dims2(this.pane); } function __a1portal_panecontrol(ctl, iindex) { this.control = ctl; this.id = ctl.id; this.index = iindex; this.origborder = ctl.style.border; this.dims = a1portal.dom.positioning.dims2(this.control); } function __a1portalcore() { this.getuserval = 0; this.setuserval = 1; } __a1portalcore.prototype = { getuserprop: function(snamectr, skey, pfunc) { this._dousercallback(a1portalcore.getuserval, snamectr, skey, null, new a1portalcore.userpropargs(snamectr, skey, pfunc)); }, setuserprop: function(snamectr, skey, sval, pfunc) { this._dousercallback(a1portalcore.setuserval, snamectr, skey, sval, new a1portalcore.userpropargs(snamectr, skey, pfunc)); }, _dousercallback: function(itype, snamectr, skey, sval, pfunc) { if (a1portal && a1portal.xmlhttp) { var spack = itype + col_delimiter + snamectr + col_delimiter + skey + col_delimiter + sval; a1portal.xmlhttp.docallback('__page', spack, a1portalcore._callbacksuccess, pfunc, a1portalcore._callbackfail, null, true, null, 0); } else alert('client personalization not enabled'); }, _callbacksuccess: function(result, ctx, req) { if (ctx.pfunc) ctx.pfunc(ctx.namingctr, ctx.key, result); }, _callbackfail: function(result, ctx) { window.status = result; } } __a1portalcore.prototype.userpropargs = function(snamectr, skey, pfunc) { this.namingctr = snamectr; this.key = skey; this.pfunc = pfunc; } var a1portalcore = new __a1portalcore(); function __a1portal_getrelatedtarget(e) { if (!e) { return null; } return e.relatedtarget || (e.type == "mouseout" ? e.toelement: e.fromelement); } function __a1portal_ischildof(container, element) { if (element == container) { return false; } while (element && (element != document.body)) { if (element == container) { return true; } try { element = element.parentnode; } catch(e) { return false; } } return false; } function __a1portal_iselementover(element, evt){ var orelatedtarget = __a1portal_getrelatedtarget(evt); if (__a1portal_ischildof(element, orelatedtarget) || element == orelatedtarget) { return true; } return false; } function __a1portal_iselementout(element, evt){ var orelatedtarget = __a1portal_getrelatedtarget(evt); if (orelatedtarget && (__a1portal_ischildof(element, orelatedtarget) || element == orelatedtarget)) { return true; } return false; } function togglediv(element){ if(document.getelementbyid(element).style.display == 'none') { document.getelementbyid(element).style.display = 'block'; } else if(document.getelementbyid(element).style.display == 'block') { document.getelementbyid(element).style.display = 'none'; } }