var TM_image_path = '//www.medialauncher.com/mp32/muse/ProjectNavigator/images/';
function TM_doHideItems()
{
var atm = document.getElementById('TMh123');
if (atm == null) return;
if (atm.length == null) {
var a = new Array();
a[0] = atm;
atm = a;
}
for (var i=0; i< atm.length; i++) {
var obj = document.getElementById(atm[i].getAttribute("sMenuID"));
obj.origHeight = obj.clientHeight;
if (!TM_getTaskMenuState(atm[i].getAttribute("sMenuID"))) {
TM_doHideShow(atm[i].getAttribute("sMenuID"), -1000, 0);
atm[i].children(0).children(0).src = TM_image_path + 'arrow_collapsed.gif';
}
}
}
function TM_taskmenu_isVisible()
{
var obj = document.getElementById('div_taskmenu_section');
if (obj == null) return false;
return (obj.style.display != 'none');
}
function TM_taskmenu_toggle()
{
if (document.getElementById('div_taskmenu_section') == null) return;
TM_showTaskMenuSection(document.getElementById('div_taskmenu_section').style.display == 'none');
}
function TM_showTaskMenuSection(doShow)
{
var obj = document.getElementById('div_taskmenu_section');
if (obj == null) return;
obj.style.display = (doShow ? 'block':'none');
if (obj.style.display == 'none') {
document.getElementById('img_taskmenu_section').src = TM_image_path + 'arrow_collapsed_lr.gif';
MP_setSetting('tmIsCollapsed', 'true')
}
else {
document.getElementById('img_taskmenu_section').src = TM_image_path + 'arrow_expanded_lr.gif';
MP_setSetting('tmIsCollapsed', 'false')
}
}
function _TM_getWorkerFrame() { return document.getElementById('TM_workerFrame'); }
function _TM_openWorker(sUrl)
{
if (typeof(TM_openWorker) == 'function') {
if (TM_openWorker(sUrl)) return;
}
var obj = _TM_getWorkerFrame();
if (obj != null) obj.src = sUrl;
}
function _TM_setWorkerHtml(html)
{
var doc = document.frames['TM_workerFrame'].document;
doc.open();
doc.write(html);
doc.close();
return doc;
}
function _TM_getPageOffsetLeft(el)
{
var x = el.offsetLeft;
if (el.offsetParent != null)
x += _TM_getPageOffsetLeft(el.offsetParent);
return x;
}
function _TM_getPageOffsetTop(el)
{
var y = el.offsetTop - el.scrollTop;
if (el.offsetParent != null)
y += _TM_getPageOffsetTop(el.offsetParent);
return y;
}
function _TM_getPageOffsetBottom(el)
{
var y = el.offsetTop;
if (el.offsetParent != null)
y += _TM_getPageOffsetTop(el.offsetParent);
return y + el.offsetHeight;
}
function TM_removeTaskMenuItem(sMenu,sItemID)
{
var tbl = document.getElementById('tbl' + sMenu);
if (tbl == null) { alert("The menu '" + sMenu + "' does not exist, so an item can not be removed from it."); return false; }
for (var i=0; i< tbl.rows.length; i++) {
if (tbl.rows[i].id == 'hmRow' + sItemID) {
tbl.deleteRow(i);
return true;
}
}
alert("The item '" + sItemID + "' does not exist on the menu '" + sMenu + "' so can not be removed.");
return false;
}
function TM_addTaskMenuItem(sMenu,sItemID,sText,sImage)
{
if (sImage == null) sImage = '';
if (sImage.length < 1) sImage = TM_image_path + 'spacer.gif';
var html =
'
' +
' ' +
' ';
if (sText.length > 0) {
html +=
'';
}
else {
html += ' '
}
html +=
' | ' +
' | ' +
'
' +
'
';
var tbl = document.getElementById('tbl' + sMenu);
if (!document.all) return; // WHAT TO DO HERE?????
var r = tbl.insertRow(-1);
r.id = 'hmRow' + sItemID;
var c = r.insertCell(0);
c.className = 'hmItem';
c.innerHTML = html;
}
function TM_doHideShow(objName, dy, endHeight)
{
var o = document.getElementById(objName);
var h = parseInt(o.clientHeight);
h += dy;
if (h <= 0) {
o.style.display = 'none';
TM_storeTaskMenuState(objName, false);
return;
}
if (h >= o.origHeight) {
o.style.height = '';
TM_storeTaskMenuState(objName, true);
return;
}
o.style.height = h + 'px';
var s = "TM_doHideShow('" + objName + "'," + (dy) + "," + (endHeight) + ")";
setTimeout(s, 50);
}
function TM_doHideShow_EasterEgg(sMenuID, done)
{
var div = document.getElementById('divEasterEggBomb');
var menu = document.getElementById(sMenuID);
if (done) {
div.children(0).src = TM_image_path + 'spacer.gif';
div.style.visibility = 'hidden';
TM_doHideShow(sMenuID, -1000, 0);
return;
}
var y = _TM_getPageOffsetTop(menu);
div.style.top = (y - 20) + 'px';
div.children(0).src = TM_image_path + 'dynamite2.gif';
div.style.visibility = 'visible';
setTimeout("TM_doHideShow_EasterEgg('" + sMenuID + "', true)", 2500);
}
function TM_storeTaskMenuState(sMenuID, state)
{
if (typeof(MP_setSetting) == 'function') MP_setSetting('tm' + sMenuID, '' + state);
}
function TM_getTaskMenuState(sMenuID)
{
if (typeof(MP_getSetting) == 'function') return (MP_getSetting('tm' + sMenuID) != 'false');
return true;
}
function TM_hideshow_onclick(objClicked, sMenuID, evt)
{
if(evt==null)
evt=window.event;
var obj = document.getElementById(sMenuID);
if (obj.style.display == 'none') {
obj.style.height = '1px';
obj.style.display = 'block';
TM_doHideShow(sMenuID, 15, obj.origHeight);
objClicked.children(0).src = TM_image_path + 'arrow_expanded.gif';
}
else {
objClicked.children(0).src = TM_image_path + 'arrow_collapsed.gif';
obj.origHeight = obj.clientHeight;
if (evt.ctrlKey == true) {
TM_doHideShow_EasterEgg(sMenuID);
return;
}
TM_doHideShow(sMenuID, -15, 0);
}
}
function _TM_submenu_hide(obj, sSubmenuName)
{
if (typeof(TM_submenu_hide) == 'function')
if (TM_submenu_hide(obj, sSubmenuName)) return;
var objMenu = document.getElementById(sSubmenuName);
if (objMenu == null) return;
objMenu.style.visibility = 'hidden';
}
function _TM_submenu_show(objOffset, sSubmenuName, offset, isBelow)
{
if (typeof(TM_submenu_show) == 'function')
if (TM_submenu_show(objOffset, sSubmenuName, offset)) return;
if (!offset) offset = 16;
_TM_hide_menus();
var objMenu = document.getElementById(sSubmenuName);
if (objMenu == null) return;
var x = _TM_getPageOffsetLeft(objOffset) + (isBelow ? 0:objOffset.offsetWidth);
var y = _TM_getPageOffsetTop(objOffset) + (isBelow ? objOffset.offsetHeight:0);
objMenu.style.left = x + 'px';
objMenu.style.top = y + 'px';
objMenu.style.visibility = 'visible';
}
function _TM_strip_space(s)
{
var a = s.split(' ');
var sResult = '';
for (var i=0; i< a.length; i++)
sResult += a[i];
return sResult;
}
function _TM_item_onclick(obj, sItemID, evt)
{
var cm = document.getElementById('menuContext');
if (cm) cm.style.visibility = 'hidden';
if (typeof(TM_item_onclick) == 'function')
if (TM_item_onclick(obj, sItemID)) return;
var sFunction = 'On' + _TM_strip_space(sItemID);
if (eval('typeof(' + sFunction + ')') == 'function')
eval(sFunction)(obj, sItemID, evt);
else
alert('No TM_item_onclick handler for: ' + sItemID);
}
function TM_show_item(sItemID, doShow)
{
if (doShow == null) doShow = true;
var obj = document.getElementById('hmRow' + sItemID);
if (obj == null) return;
if (document.all)
obj.style.display = (doShow ? (document.all ? 'block':'table-row'):'none');
}
var g_TM_menus = new Array();
function TM_register_menu(sMenuName, forceOpen)
{
for (var i=0; i< g_TM_menus.length; i++) {
if (g_TM_menus[i].name == sMenuName) {
g_TM_menus[i].forceOpen = forceOpen;
return;
}
}
var n = g_TM_menus.length;
g_TM_menus[n] = new Object();
g_TM_menus[n].name = sMenuName;
g_TM_menus[n].forceOpen = forceOpen;
}
function _TM_hide_menus()
{
if (typeof(TM_hide_menus) == 'function') TM_hide_menus();
for (var i=0; i< g_TM_menus.length; i++) {
if (!g_TM_menus[i].forceOpen) _TM_submenu_hide(null, g_TM_menus[i].name);
}
}
function TM_set_udf(sItemID, sHtml)
{
if (document.all)
document.getElementById('hmUdf' + sItemID).innerHTML = sHtml;
}
function _TM_substitute_link(sUrl)
{
sUrl = sUrl.replace("?PN?/", MP_getProjectNavigatorPath());
sUrl = sUrl.replace("?TOOLS?/", MP_getToolsPath());
sUrl = sUrl.replace("?AM?/", MP_getAssetManagerPath());
sUrl = sUrl.replace("?MUSE?/", MP_getMusePath());
return sUrl;
}
function _TM_substituteUrl(s, sPath, sReplace)
{
var n = s.toUpperCase().indexOf(sPath.toUpperCase());
if (n < 0) return s;
return (sReplace + s.substr(n + sPath.length));
}
function _TM_localizeUrl(s)
{
// Only substitute for AssetManager if not in the assets folder --- assets may be on
// specific app servers.
if (s.toUpperCase().indexOf("/ASSETMANAGER/ASSETS") >= 0) return s;
s = _TM_substituteUrl(s, "/mp32/AssetManager", "?AM?");
s = _TM_substituteUrl(s, "/ProjectNavigator", "?PN?");
s = _TM_substituteUrl(s, "/tools_v2", "?TOOLS?");
s = _TM_substituteUrl(s, "/muse", "?MUSE?");
return s;
}
function OnscLink(obj, sItemID)
{
var sUrl = _TM_substitute_link(obj.getAttribute("url"));
var w = "";
var h = "";
var op = "";
var isModal = (obj.type == "popup");
if (obj.width) {
if (isNaN(obj.width)) {
w = (isModal ? ";dialogWidth:770px":",width=770px");
}
else {
w = (isModal ? ";dialogWidth:" + obj.width + "px":",width=" + obj.width + "px");
}
}
if (obj.height) {
if (isNaN(obj.height)) {
h = (isModal ? ";dialogHeight:500px":",height=500px");
}
else {
h = (isModal ? ";dialogHeight:" + obj.height + "px":",height=" + obj.height + "px");
}
}
// If there are options on this quicklink, set them now
if (obj.options) {
if (obj.options != "*") {
op = (isModal ? ";":",") + obj.options;
}
}
if (!op) op = (isModal ? ";":",") + "resizable=yes";
// If modal flag is set, open in a modal window
// else if width & height are set, open in a new regular window
// else open in the current window
if (obj.type == "popup") {
var res = MP_showModalDialog(sUrl, obj, "status:no" + w + h + op, "MediaPlatform - " + obj.sName);
}
else if (obj.type == "window") {
window.open(sUrl, "_blank", w + h + op);
}
else if (obj.type == "wizard") {
if (MP_openWizard(sUrl, obj.width, obj.height))
document.location.href = MP_getProjectNavigatorPath() + "default.jsp";
}
else {
window.location.href = sUrl;
}
}
var g_tabCount;
var lastObj = 'A';
function doSelectTab(obj, nTab)
{
var isIE4up = ((document.all)? true : false);
var i;
if (!isIE4up) return;
if (obj == lastObj) return;
// Deselect old tab
if (lastObj != 'A') lastObj.className = 'mpTabItem';
// If tab being sleected is -1, show all tabs now
if (nTab == -1) {
for (i=0; document.getElementById('Tab' + i); i++)
document.getElementById('Tab' + i).style.display = '';
lastObj = 'A';
return;
}
obj.className = 'mpTabItemSelected';
lastObj = obj;
// Hide all tabs that are not the one being selected
for (i=0; document.getElementById('Tab' + i); i++) {
if (nTab != i)
document.getElementById('Tab' + i).style.display = 'none';
}
// Show the selected tab
if(document.getElementById('Tab' + nTab)!=null)
document.getElementById('Tab' + nTab).style.display = '';
}
function OnscMyWorkspace() { document.location.href = MP_getProjectNavigatorPath() + 'myWorkspace.jsp'; }
function OnscTaskCenter() { document.location.href = MP_getProjectNavigatorPath() + 'myTaskcenter.jsp'; }
function OnscAssetManager() { document.location.href = '/mp32/AssetManager/default.jsp'; }
function OnscDeploymentEnvironments() { document.location.href = MP_getProjectNavigatorPath() + 'mp_DeploymentEnvironment_Editor.jsp'; }
function OnscRegistrationManager() { document.location.href = MP_getProjectNavigatorPath() + 'mp_Registration_Editor.jsp'; }
function OnscManageShortcuts()
{
if (MP_showModalDialog(MP_getProjectNavigatorPath() + "mp_QuickLink_Editor.jsp", null, "dialogWidth:720px;dialogHeight:400px;status:no", "My Quick Links") == null)
return;
// Force a reload with no caching
document.location.reload(true);
}
function _TM_button_onmouseover(obj)
{
if (obj.className.indexOf('Disabled') >= 0) return;
if (obj.restricted == true) return;
if (obj.isSelected) return;
obj.className = "pnButtonIconHover";
obj.style.borderStyle = "outset";
}
function _TM_button_onmouseout(obj)
{
if (obj.className.indexOf('Disabled') >= 0) return;
if (obj.restricted == true) return;
if (obj.isSelected) return;
obj.style.borderStyle = "solid";
obj.className = "pnButtonIcon";
}
function _TM_button_onmousedown(obj)
{
if (obj.isSelected) return;
obj.style.borderStyle = "inset";
}
function _TM_button_onmouseup(obj)
{
if (obj.isSelected) return;
obj.style.borderStyle = "outset";
}
function _TM_taskmenu_section_ondblclick()
{
if (typeof(TM_taskmenu_section_ondblclick) == 'function') {
if (TM_taskmenu_section_ondblclick()) return;
}
}
function _TM_getStylesheetStyleObject(sClassName)
{
sClassName = "." + sClassName.toUpperCase();
for (var i=0; i< document.styleSheets.length; i++) {
var sheet = document.styleSheets[i];
var rules = (sheet.rules || sheet.cssRules);
for (var j=0; j< rules.length; j++) {
var rule = rules[j];
if (rule.selectorText.toUpperCase() == sClassName) {
return rule.style;
}
}
}
return new Object();
}
function _TM_dropdownSelect_onmouseover(obj) { obj.className = "mpDropdownHighlighted"; }
function _TM_dropdownSelect_onmouseout(obj) { obj.className = ""; }
function _TM_dropdownSelectItem(sItemID)
{
sItemID = "dsr" + sItemID;
var obj = document.getElementById(sItemID);
if (!obj) return;
if (!obj.parentElement) return;
var tbl = obj.parentElement.parentElement;
if (!tbl) return;
for (var i=0; i< tbl.rows.length; i++) {
var r = tbl.rows[i];
if (!r.id) continue;
// if (r.cells.length < 2) continue;
r.cells(0).innerHTML = (r.id == sItemID ? "·":" ");
}
}
var g_objQuicklink = null;
function TM_setQuicklinkInfo(sUrl, sImgUrl, sType, width, height, sName, sDescription, callback, sOptions)
{
g_objQuicklink = new Object();
g_objQuicklink.sUrl = sUrl;
g_objQuicklink.sImgUrl = sImgUrl;
g_objQuicklink.sType = sType;
g_objQuicklink.width = width;
g_objQuicklink.height = height;
g_objQuicklink.sName = sName;
g_objQuicklink.sDescription = sDescription;
g_objQuicklink.sOptions = (sOptions ? sOptions:"");
var didSetCallback = false;
if (callback) {
if (callback.length > 0) {
g_objQuicklink.callback = callback;
didSetCallback = true;
}
}
if (!didSetCallback) g_objQuicklink.callback = "parent.TM_quicklinkSaveComplete()";
document.getElementById("idMakeQuicklink").style.visibility = "visible";
}
function TM_quicklinkSaveComplete()
{
// Do nothing ... next time page is loaded, new quicklink will be there
}
function _TM_make_quicklink_onclick()
{
if (!g_objQuicklink) return;
var msg = "Are you sure you want to add a quicklink to '%1' to your quicklinks menu?".replace("%1", g_objQuicklink.sName);
if (!confirm(msg)) return;
// If an even handler exists, call that event handler, otherwise perform default.
if (typeof(TM_make_quicklink_onclick) == 'function') {
if (TM_make_quicklink_onclick())
return true;
}
// Create XML for this quicklink and add it now
var xml =
"\r\n" +
"\r\n" +
"";
var url =
MP_getProjectNavigatorPath() +
"mp_QuickLink_Save.jsp" +
"?xmlUserNew=" + escape(xml) +
"&reseller_id=0" +
"&acct_id=0" +
"&user_id=current" +
"&callback=" + escape(g_objQuicklink.callback);
var obj = MP_getWorkerFrame();
obj.src = url;
}
function TM_showContextMenu(contextTasks)
{
var menu = document.getElementById("menuContext");
if (menu == null) return;
var html = "";
var needDivider = false;
for (var i=0; i< contextTasks.length; i++) {
if (contextTasks[i] == "-") {
needDivider = true;
continue;
}
var oi = document.getElementById('hmRow' + contextTasks[i]);
if (oi == null) continue;
if (oi.style.display != 'none') {
if (needDivider) {
html += "
|
";
needDivider = false;
}
// html += "" + oi.innerHTML + "
";
html += oi.outerHTML;
}
}
html += "
";
menu.innerHTML = html;
menu.style.left = event.clientX;
menu.style.top = event.clientY - 10;
menu.style.visibility = "visible";
}
function _TM_onmouseover()
{
var menu = document.getElementById("menuContext");
if (menu == null) return;
menu.style.visibility = 'hidden';
}