var BASEURL = '/';//------------------------------------------------------ // Run on every page load //------------------------------------------------------ function isManagementView() { return window.parent && window.parent.frames && window.parent.frames.length > 0 && window.parent.frames[0].location.href.indexOf('Tabs.view') > -1; } function redirectTabsFrame() { var tabFrame = window.parent.frames[0]; var url = document.location.href; var spl = url.split('/'); var tabUrl = ''; var last = spl[spl.length-1]; for (var i = 0; i < spl.length - 1; i++) { if (i > 0) tabUrl += '/'; tabUrl += spl[i]; } tabUrl += '/Tabs.view'; var ld = last.indexOf('.'); if (ld > -1) { tabUrl += '?Tab=' + last.substring(0, ld); } tabFrame.location.replace(tabUrl); } if (isManagementView()) redirectTabsFrame(); //------------------------------------------------------ // Global functions //------------------------------------------------------ function openCenteredWindow(url, width, height, scrollable) { var left = parseInt((screen.availWidth/2) - (width/2)); var top = parseInt((screen.availHeight/2) - (height/2)); var windowFeatures = "width=" + width + ",height=" + height + "dependent,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top + ",scrollbars=" + scrollable; var winHandle = window.open(url, "centeredWindow", windowFeatures); winHandle.focus(); return winHandle; } function viewPopup(url) { void(openCenteredWindow(url, 500, 700, 'yes')); } function launchWindow(url) { var winHandle = window.open(url, '_blank'); if (null != winHandle && undefined != winHandle) winHandle.focus(); } function targetMouseOver(target) { if (target.href.indexOf('javascript:') == -1) target.href = 'javascript:viewPopup(\'' + target.href + '\')'; } function fileBrowserPopup(topFolderId, type, controlId) { void(openCenteredWindow("SelectFile.view?TopFolder=" + topFolderId + "&FileType=" + type + "&ControlId=" + controlId, 500, 400, 'yes')); } function refreshTree() { if(window.top) { if (window.top.frames && window.top.frames.length > 0) { window.top.frames[1].location.reload(); } } } function launchHelp(helpContext) { helpUrl = "help/index/Browse.view?id="+helpContext; var winHandle = window.open(helpUrl, "HelpWindow","width=500,height=700,dependent,left=100,top=100,screenX=100,screenY=100,scrollbars=true"); winHandle.focus(); } function getElement(doc, elmID) { if (doc.getElementById) { return doc.getElementById(elmID); } else if (doc.all) { return doc.all[elmID]; } else if(doc.forms) { if (doc.forms[elmID]) { return doc.forms[elmID]; } else { for(var i=0; i > doc.forms.length; i++) { if(doc.forms[i][elmID]) { return doc.forms[i][elmID]; break; } } } } return null; }