var _U = "undefined";
var oPopup = window.createPopup();
function contextMenu( dataID )
{
var oNodeListActions = document.getElementById( dataID ).XMLDocument.selectNodes("actions/action");
var numNodes = oNodeListActions.length;
var divTagStyle = "STYLE='white-space:nowrap; background:#cccccc; border:1px solid black; border-top:1px solid white; border-left:1px solid white; height:20px; color:black; font-family:verdana; font-weight:bold; padding:2px; padding-left:10px; font-size:8pt; cursor:hand' ";
var divTagActions = "onmouseover='this.style.background=\"#ffffff\"' onmouseout='this.style.background=\"#cccccc\"'";
var menu = "";
for( n = 0; n < numNodes; n++ )
{
var oNodeAction = oNodeListActions.item( n );
menu = menu + "
";
menu = menu + oNodeAction.xml;
menu = menu + "
";
}
oPopup.document.body.innerHTML = menu;
var popupBody = oPopup.document.body;
// The following popup object is used only to detect what height the
// displayed popup object should be using the scrollHeight property.
// This is important because the size of the popup object varies
// depending on the length of the definition text. This first
// popup object is not seen by the user.
oPopup.show(0, 0, 100, 0);
var realHeight = popupBody.scrollHeight;
var realWidth = popupBody.scrollWidth + 10;
// Hides the dimension detector popup object.
oPopup.hide();
// Shows the actual popup object with correct height.
oPopup.show(0, 15, realWidth, realHeight, event.srcElement);
}
function fnCheckKey()
{
try
{
if (event.ctrlKey && event.shiftKey)
{
switch (event.keyCode)
{
// F5
case 116:
fnToggle();
break;
default:
break;
}
}
}
catch(e)
{
fnLog(e, "fnCheckKey", this.name);
}
}
function fnToggle()
{
try
{
if (document.location.href.search(/SSContributor=true/) >= 0) // disable
{
var str = window.location.href.replace(/.SSContributor=true/gi,"");
window.location.replace(str);
}
else // enable
{
if(window.location.href.search(/\?/) >= 0)
{
window.location = window.location.href + "&SSContributor=true";
}
else
{
window.location = window.location.href + "?SSContributor=true";
}
}
}
catch(e)
{
fnLog(e, "fnToggle", this.name);
}
}
function fnLaunchContributorClient()
{
try
{
var app = document.getElementById("ssContributor");
if (typeof app != _U && app != null)
{
app.EditContributorFile(document);
}
}
catch(e)
{
fnLog(e, "fnLaunchContributorClient", this.name);
}
}
function fnSwitchContributionRegionFile(strSiteId, strNodeId, strRegionId, bUseSecondary)
{
try
{
var app = document.getElementById("ssContributor");
if (typeof app != _U && app != null)
{
app.SwitchContributorFile(document, strSiteId, strNodeId, strRegionId, bUseSecondary);
}
}
catch(e)
{
fnLog(e, "fnSwitchContributionRegionFile", this.name);
}
}
function fnContributorImageToggle()
{
try
{
var o = event.srcElement;
if (typeof o != _U && o != null
&& typeof o.src != _U && o.src != null)
{
if (o.src.search(/StellentDot_edit.gif/gi) >= 0)
{
o.src = o.src.replace(/StellentDot_edit.gif/gi, "StellentDot_edit_over.gif");
}
else if (o.src.search(/StellentDot_edit_over.gif/gi) >= 0)
{
o.src = o.src.replace(/StellentDot_edit_over.gif/gi, "StellentDot_edit.gif");
}
else if (o.src.search(/StellentDot_locked.gif/gi) >= 0)
{
o.src = o.src.replace(/StellentDot_locked.gif/gi, "StellentDot_locked_over.gif");
}
else if (o.src.search(/StellentDot_locked_over.gif/gi) >= 0)
{
o.src = o.src.replace(/StellentDot_locked_over.gif/gi, "StellentDot_locked.gif");
}
else if (o.src.search(/StellentDot_workflow.gif/gi) >= 0)
{
o.src = o.src.replace(/StellentDot_workflow.gif/gi, "StellentDot_workflow_over.gif");
}
else if (o.src.search(/StellentDot_workflow_over.gif/gi) >= 0)
{
o.src = o.src.replace(/StellentDot_workflow_over.gif/gi, "StellentDot_workflow.gif");
}
}
}
catch(e)
{
fnLog(e, "fnContributorImageToggle", this.name);
}
}
function fnInit()
{
try
{
if (typeof document.body != _U && document.body != null)
{
document.body.attachEvent('onkeydown', fnCheckKey);
if ( SSContributor )
{
var oDiv = document.createElement("span");
oDiv.style.height = 20;
oDiv.style.width = 200;
oDiv.style.backgroundColor = "white";
oDiv.style.font = "normal 10pt courier";
oDiv.style.border = "solid black 1px";
oDiv.style.padding = 10;
oDiv.style.position = "absolute";
oDiv.style.top = 15;
oDiv.textAlign = "center";
oDiv.innerHTML = "
";
document.body.insertBefore(oDiv);
oDiv.style.setExpression("left", "document.body.clientWidth - 225");
document.recalc(true);
}
}
}
catch(e)
{
fnLog(e, "fnInit", this.name);
}
}
function fnLog( e, fn, f )
{
alert(f + "\n" + fn + "\n" + e.name + "\n" + e.description + "\n" );
}
window.onload = fnInit;