var oLimeyExistingOnLoad = []; // Save any existing onload function, and set to ours storeExistingOnload(); /** * The Limey onload function */ function LimeyInit() { // If there was another onload already defined then run it first for (var i in oLimeyExistingOnLoad) { if (oLimeyExistingOnLoad[i]) { oLimeyExistingOnLoad[i](); } } // Initialise the errorBox LimeyErrorBoxInit(); // Initialise the AJAX functionality if it exists if (typeof LimeyAjaxInit == 'function') LimeyAjaxInit(); // Run page initialisation if it exists if (typeof pageInit == 'function') pageInit(); } function storeExistingOnload() { storeExistingOnload(null); } function storeExistingOnload() { // See if the onload function has been changed if ((window.onload) && window.onload != LimeyInit) { // Save any existing onload oLimeyExistingOnLoad.push(window.onload); } // Set to LimeyInit if needed if ((!window.onload) || window.onload != LimeyInit) { window.onload = LimeyInit; } } function addOnload(sOnLoad) { if (sOnLoad) oLimeyExistingOnLoad.push(sOnLoad); } function LimeyErrorBoxInit() { oErrorBoxHide = document.getElementById('LimeyErrorBoxHide'); oErrorBoxShow = document.getElementById('LimeyErrorBoxShow'); if (oErrorBoxHide && oErrorBoxShow) { oErrorBoxHide.style.display = 'inline'; oErrorBoxHide.onclick = LimeyErrorBoxHide; oErrorBoxShow.onclick = LimeyErrorBoxShow; } } function LimeyErrorBoxHide() { oErrorBox = document.getElementById('LimeyErrorBox'); oErrorBoxShow = document.getElementById('LimeyErrorBoxShow'); if (oErrorBox && oErrorBoxShow) { oErrorBox.style.visibility = 'hidden'; oErrorBoxShow.style.visibility = 'visible'; } } function LimeyErrorBoxShow() { oErrorBox = document.getElementById('LimeyErrorBox'); oErrorBoxShow = document.getElementById('LimeyErrorBoxShow'); if (oErrorBox && oErrorBoxShow) { oErrorBox.style.visibility = 'visible'; oErrorBoxShow.style.visibility = 'hidden'; } } function findPos(obj) { var curleft = 0; var curtop = 0; var sObjects = ""; if (obj.offsetParent) { while(1) { curleft += obj.offsetLeft; curtop += obj.offsetTop; if (!obj.offsetParent) break; obj = obj.offsetParent; } } else if (obj.x && obj.y) { curleft += obj.x; curtop += obj.y; } return [curleft,curtop]; } //////////////////////////////////////// // Thanks quirksmode.org.... function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function eraseCookie(name) { createCookie(name,"",-1); } // //////////////////////////////////////// /* * @name getBaseUrl * @desc Return the path by the site 'base' tag. * @return string The path, emtpy if none. */ function getBaseUrl() { basehref = ''; if( document.getElementsByTagName && document.getElementsByTagName('base') && document.getElementsByTagName('base')[0] && document.getElementsByTagName('base')[0].getAttribute('href') ) { basehref = document.getElementsByTagName('base')[0].getAttribute('href'); i = basehref.indexOf(document.location.host) if (i > 0) { basehref = basehref.substr(i+document.location.host.length) } } else { basehref = ''; } if (basehref[basehref.length-1] == "/") basehref = basehref.substring(0, basehref.length -1) return basehref } /* * @name getUrlPath * @desc Return the web path to the current page (from the web base) * @return string The path, empty if none. */ function getUrlPath(sUrl) { // If no URL was passed, use the current one if (!sUrl || sUrl.length == 0) sUrl = window.location.toString() // Find the first dot (should be near the end of the domain) i = sUrl.indexOf('.') // Find the end of the host name i = sUrl.indexOf('/', i) sPath = ''; if (i > 0) { i2 = sUrl.indexOf('.', i) if (i2 > i) { i2 = sUrl.lastIndexOf('/') sPath = sUrl.substring(i, i2); } else { sPath = sUrl.substr(i) } } if (sPath[sPath.length-1] != "/") sPath = sPath + "/" /* baseUrl = getBaseUrl() if (baseUrl.length > 0) { k = sPath.indexOf(baseUrl) if (k >= 0) sPath = sPath.substr(baseUrl.length) } */ if (sPath[0] != "/") sPath = "/" + sPath sPath = "//" + document.location.host + sPath return sPath }