/*
Constructor for the Beachhead MessageBox
*/
BeachheadUI.Alert = function(pMessage)
{
BeachheadUI.MessageBox.show("Beachhead Alert",pMessage.replace(/\n/g, '
'),"messageBoxBorder","messageBoxAlertContent");
}
BeachheadUI.ErrorMessage = function(pMessage)
{
BeachheadUI.MessageBox.show(BeachheadUI.language["error"],pMessage.replace(/\n/g, '
'),"messageBoxBorder","messageBoxAlertContent");
}
BeachheadUI.Confirm = function (pMessage, pCallback, pCancelCallback) {
BeachheadUI.MessageBox.close();
var buttons = [[BeachheadUI.language["ok"], pCallback], [BeachheadUI.language["cancel"], function () { if (pCancelCallback) pCancelCallback(); BeachheadUI.MessageBox.close(); } ]];
BeachheadUI.MessageBox.show(BeachheadUI.language["confirmation"], pMessage.replace(/\n/g, '
'), "messageBoxBorder", "messageBoxAlertContent", buttons);
}
BeachheadUI.ClearConfirm = function()
{
BeachheadUI.MessageBox.close();
}
//BeachheadUI.MessageBox = function(pId, pTitle, pMessage, pTableCSS, pContentCSS, pButtonArray, pOuterBorderCSS)
//{
// this._messageBoxDiv = pId;
// this._title = pTitle;
// this._message = pMessage;
// if(pTableCSS)
// this._tableCSS = pTableCSS;
// else
// this._tableCSS = BeachheadUI.MessageBox.defaultTableCSS;
// if(pContentCSS)
// this._contentCSS = pContentCSS;
// else
// this._contentCSS = BeachheadUI.MessageBox.defaultContentCSS;
// if(pButtonArray)
// this._messageBoxButtons = pButtonArray;
// else
// this._messageBoxButtons = new Array();
// if (pOuterBorderCSS)
// {
// this._borderColorClass = pOuterBorderCSS;
// this._contentBorderColorClass = pOuterBorderCSS;
// }
//};
//Default CSS classes for the messagebox
BeachheadUI.MessageBox.defaultTableCSS = "messageBoxBorder";
BeachheadUI.MessageBox.defaultContentCSS = "messageBoxContent";
BeachheadUI.MessageBox.prototype = new BeachheadUI;
BeachheadUI.MessageBox.prototype._title = "";
BeachheadUI.MessageBox.prototype._titleObj;
BeachheadUI.MessageBox.prototype._message = "";
BeachheadUI.MessageBox.prototype._padding = "5px";
BeachheadUI.MessageBox.prototype._paddingSides = "35px";
BeachheadUI.MessageBox.prototype._borderColorClass = "messageBoxOuterBorder";
BeachheadUI.MessageBox.prototype._borderColor = "#CE7118";
BeachheadUI.MessageBox.prototype._borderWidth = "1px";
BeachheadUI.MessageBox.prototype._borderStyle = "solid";
BeachheadUI.MessageBox.prototype._contentBorderColorClass = "messageBoxOuterBorder";
BeachheadUI.MessageBox.prototype._contentBorderColor = "#CE7118";
BeachheadUI.MessageBox.prototype._contentBorderWidth = "1px";
BeachheadUI.MessageBox.prototype._contentBorderStyle = "solid";
BeachheadUI.MessageBox.prototype._tableCSS = "";
BeachheadUI.MessageBox.prototype._contentCSS = "";
BeachheadUI.MessageBox.prototype._buttonCSS = "";
BeachheadUI.MessageBox.prototype._messageBoxDiv = "";
BeachheadUI.MessageBox.prototype._messageBoxButtons = null;
BeachheadUI.MessageBox.prototype._messageBoxButtonObjs = new Array();
BeachheadUI.MessageBox.prototype._contentObj = null;
BeachheadUI.MessageBox.prototype._mainObj = null;
BeachheadUI.MessageBox.prototype._allowMessageBox = true;
BeachheadUI.MessageBox.prototype._modal = false;
BeachheadUI.MessageBox.prototype._isWidget = false;
/*
This method will get the content object
*/
//if this function is provided a parameter N, it will disable the Nth button in the
//messagebox. However, if there are buttons in the content of the messagebox,
//those must be included when calculating N. If parameter N is not passed in, all
//buttons will be disabled.
BeachheadUI.MessageBox.disableModalButtons = function(index)
{
var buttonArray = BeachheadUI.MessageBox._modalDialog._messageBoxButtonObjs;
if(index)
buttonArray[index].setAttribute("disabled", "disabled");
else
for(var i = 0; i < buttonArray.length; i++)
buttonArray[i].setAttribute("disabled", "disabled");
};
BeachheadUI.MessageBox.enableModalButtons = function()
{
var modalObj = BeachheadUI.MessageBox.getContentObject().parentNode.parentNode;
var modalInputs = modalObj.getElementsByTagName("input");
for(var i = 0; i < modalInputs.length; i++)
if(modalInputs[i].type == "button")
modalInputs[i].disabled = false;
};
BeachheadUI.MessageBox.prototype.getContentObject = function()
{
return this._contentObj;
};
/*
This method will set the content object
*/
BeachheadUI.MessageBox.prototype.setContent = function(pMessage)
{
this._message = pMessage;
if(this._contentObj)
{
this._contentObj.innerHTML = "
" + pMessage + "
";
}
};
/*
This method will set the title
*/
BeachheadUI.MessageBox.prototype.setTitle = function(pTitle)
{
this._title = pTitle;
if(this._titleObj)
this._titleObj.innerHTML = pTitle;
};
/*
This method will allow the buttons to be set
*/
BeachheadUI.MessageBox.prototype.setButtons = function(pButtonArray)
{
this._messageBoxButtons = pButtonArray;
if (this._contentObj) {
this.renderButtons();
}
};
BeachheadUI.MessageBox.prototype.renderButtons = function () {
var x = this._messageBoxButtonObjs.length - 1;
if (this._messageBoxButtons.length > x)
x = this._messageBoxButtons.length - 1;
for (; x >= 0; x--) {
if (x > (this._messageBoxButtons.length - 1)) {
this._messageBoxButtonObjs[x].style.display = "none";
continue;
}
var bud;
if (x >= this._messageBoxButtonObjs.length) {
bud = document.createElement("div");
if (this._title && this._title == BeachheadUI.language["deleteresponder"]) {
if (this._messageBoxButtons[x][BeachheadUI.MessageBox._NAME_INDEX] == "Cancel") {
bud.className = "u1203_div";
bud.style.top = "115px";
bud.style.left = "280px";
bud.style.height = "30px";
bud.style.paddingTop = "6px";
bud.style.textAlign = "center";
}
else {
bud.className = "u1202_div";
bud.style.top = "115px";
bud.style.left = "115px";
bud.style.width = "150px";
bud.style.height = "25px";
bud.style.paddingTop = "8px";
bud.style.textAlign = "center";
}
}
else {
bud.className = "button";
bud.removeAttribute("style");
}
}
else {
if (this._messageBoxButtonObjs[x]) {
bud = this._messageBoxButtonObjs[x];
if (this._title && this._title == BeachheadUI.language["deleteresponder"]) {
if (this._messageBoxButtons[x][BeachheadUI.MessageBox._NAME_INDEX] == "Cancel") {
bud.className = "u1203_div";
bud.style.top = "115px";
bud.style.left = "280px";
bud.style.height = "30px";
bud.style.paddingTop = "6px";
bud.style.textAlign = "center";
}
else {
bud.className = "u1202_div";
bud.style.top = "115px";
bud.style.left = "115px";
bud.style.width = "150px";
bud.style.height = "25px";
bud.style.paddingTop = "8px";
bud.style.textAlign = "center";
}
}
else {
bud.className = "button";
bud.removeAttribute("style");
}
}
else {
bud = document.createElement("div");
if (this._title && this._title == BeachheadUI.language["deleteresponder"]) {
if (this._messageBoxButtons[x][BeachheadUI.MessageBox._NAME_INDEX] == "Cancel") {
bud.className = "u1203_div";
bud.style.top = "115px";
bud.style.left = "280px";
bud.style.height = "30px";
bud.style.paddingTop = "6px";
bud.style.textAlign = "center";
}
else {
bud.className = "u1202_div";
bud.style.top = "115px";
bud.style.left = "115px";
bud.style.width = "150px";
bud.style.height = "25px";
bud.style.paddingTop = "8px";
bud.style.textAlign = "center";
}
}
else {
bud.className = "button";
bud.removeAttribute("style");
}
}
}
while (bud.childNodes.length > 0)
bud.removeChild(bud.childNodes[0]);
var bsz = bud.appendChild(document.createElement("div"));
bsz.className = "buttonWidth";
bsz.style.height = "0px";
if (this._messageBoxButtons[x].length > BeachheadUI.MessageBox._WIDTH_INDEX) {
var mwd = bud.appendChild(document.createElement("div"));
mwd.style.height = "0px";
mwd.style.width = this._messageBoxButtons[x][BeachheadUI.MessageBox._WIDTH_INDEX];
}
bud.appendChild(document.createElement("span")).appendChild(document.createTextNode(this._messageBoxButtons[x][BeachheadUI.MessageBox._NAME_INDEX]));
bud.onclick = function (pX, pId, pObj) {
return function (event) {
pObj._onClick(event, pId, pX);
}
}(x, this._messageBoxDiv, this);
this._messageBoxButtonObjs[0].parentNode.appendChild(bud);
if (this._title && this._title == BeachheadUI.language["deleteresponder"])
this._messageBoxButtonObjs[0].parentNode.style.height = "30px";
this._messageBoxButtonObjs[x] = bud;
this._messageBoxButtonObjs[x].style.display = "";
this._messageBoxButtonObjs[x].removeAttribute("disabled");
}
};
/*
This method will render and show the message box.
*/
BeachheadUI.MessageBox.prototype.show = function (pDoNotCenter, pDoNotShow, pDoNotCreate) {
// We may need this if we want to override this behavior. We may allow show without calling close.
if (!this._allowMessageBox)
return false;
else
this._allowMessageBox = false;
BeachheadUI.MessageBox.CurrentMBObj = this;//
var obj = document.getElementById(this._messageBoxDiv);
var parentObj = document.getElementById(this._messageBoxDiv + "parent");
var slipFrame;
if (!obj) {
var oobj = document.createElement("div");
oobj.style.position = "absolute";
oobj.style.top = oobj.style.left = "0px";
oobj.style.zIndex = 999;
obj = oobj.appendChild(document.createElement("div"));
obj.id = this._messageBoxDiv;
obj.style.display = "none";
obj.style.position = "absolute";
obj.className = this._tableCSS;
parentObj = document.createElement("div");
parentObj.style.height = "100%";
parentObj.style.width = "100%";
parentObj.style.position = "absolute";
parentObj.id = this._messageBoxDiv + "parent";
parentObj.style.top = 0;
parentObj.style.left = 0;
parentObj.appendChild(oobj);
document.body.appendChild(oobj);
document.body.appendChild(parentObj);
}
if (!pDoNotCreate) {
slipFrame = parentObj.getElementsByTagName("iframe");
if (slipFrame.length > 0)
slipFrame = slipFrame[0];
else
slipFrame = document.createElement("iframe");
slipFrame.id = this._messageBoxDiv + "slipFrame";
slipFrame.style.width = "100%";
slipFrame.style.height = "100%";
slipFrame.style.position = "absolute";
slipFrame.border = 0;
slipFrame.style.zIndex = 997;
slipFrame.style.display = "none"; //ADDED 3/10/08 for support for swf in header
slipFrame.src = "empty.htm"; //previously messagebox would make swf disappear
parentObj.appendChild(slipFrame);
if (this._contentObj) {
{
this._contentObj.className = "content " + this._contentCSS;
if (this._titleObj && this._titleObj.innerHTML != this._title)
this._titleObj.innerHTML = this._title;
if (this._contentObj.innerHTML != this._message)
this._contentObj.innerHTML = this._message;
this.renderButtons();
}
}
else {
this._create(obj);
}
}
if (!pDoNotShow) {
parentObj.style.display = "";
obj.style.display = "";
if (parentObj.clientHeight < document.body.clientHeight) {
parentObj.style.height = document.body.clientHeight + "px";
parentObj.style.width = document.body.clientWidth + "px";
slipFrame.style.height = parentObj.style.height;
slipFrame.style.width = parentObj.style.width;
}
if (this._modal) {
eval("parentObj.onmousedown = function(event){BeachheadUI.MessageBox._onMouseDownModal(event,'" + this._messageBoxDiv + "');};");
eval("document.onkeydown = function(event){BeachheadUI.MessageBox._onKeyDownModal(event, '" + this._messageBoxDiv + "');};");
parentObj.style.backgroundColor = "white";
parentObj.style.filter = "alpha(opacity=1)";
parentObj.style.opacity = 0.01;
slipFrame.style.filter = "alpha(opacity=1)";
slipFrame.style.opacity = 0.01;
parentObj.style.zIndex = 998;
obj.style.zIndex = 999;
}
else {
parentObj.style.backgroundColor = "";
parentObj.style.filter = "";
parentObj.style.opacity = "";
slipFrame.style.filter = "";
slipFrame.style.opacity = "";
parentObj.style.zIndex = 996;
obj.style.zIndex = 997;
}
// if(BeachheadUI.IE)
// {
// slipFrame.style.height = obj.clientHeight + "px";
// slipFrame.style.width = obj.clientWidth + "px";
// }
// else
// {
// slipFrame.style.height = (obj.clientHeight - 5) + "px";
// slipFrame.style.width = (obj.clientWidth - 5) + "px";
// }
if (!pDoNotCenter) {
document.body.style.display = "none";
document.body.style.display = "";
//changed code which calculates obj.style.top 10/17/07
//was calculating parseInt((document.body.clientHeight / 2)) (ie page)
//instead of the current parseInt((document.documentElement.clientHeight / 2))
//(ie window)
var cTop = (parseInt(document.body.parentNode.scrollTop) + parseInt((document.documentElement.clientHeight / 2)) - (obj.clientHeight / 2));
var cLeft = parseInt((parentObj.clientWidth / 2) - (obj.clientWidth / 2));
if (!cLeft)
cLeft = parseInt((parentObj.clientWidth / 2));
if (cTop < 0)
cTop = 0;
if (cLeft < 0)
cLeft = 0;
obj.style.display = "none";
obj.style.top = cTop + "px";
obj.style.left = cLeft + "px";
obj.style.display = "block";
}
else if (pDoNotCenter.x) {
obj.style.top = pDoNotCenter.y + "px";
obj.style.left = pDoNotCenter.x + "px";
}
}
if (window.navigator.userAgent.indexOf("Edge") > -1)
window.scrollTo(0, 0);
window[this._messageBoxDiv] = this;
setTimeout("BeachheadUI.MessageBox.focus('" + this._messageBoxDiv + "');", 100);
try { this._messageBoxButtonObjs[0].focus(); } catch (ex) { }
return true;
};
BeachheadUI.MessageBox.focus = function (pMess) {
if (window[pMess]._messageBoxButtonObj)
try { window[pMess]._messageBoxButtonObjs[0].focus(); } catch (ex) { }
}
/*
This will hide the messagebox.
*/
BeachheadUI.MessageBox.prototype.close = function()
{
this._allowMessageBox = true;
document.getElementById(this._messageBoxDiv).style.display = "none";
var parentObj = document.getElementById(this._messageBoxDiv + "parent");
parentObj.style.display = "none";
parentObj.style.backgroundColor = "";
if(this._modal)
document.onkeydown = "";
};
BeachheadUI.MessageBox._ID = "BeachheadUI.MessageBox";
BeachheadUI.MessageBox._NAME_INDEX = 0;
BeachheadUI.MessageBox._FUNCTION_INDEX = 1;
BeachheadUI.MessageBox._WIDTH_INDEX = 2;
BeachheadUI.MessageBox._modalDialog = new BeachheadUI.MessageBox(BeachheadUI.MessageBox._ID);
BeachheadUI.MessageBox._tx = -1;
BeachheadUI.MessageBox._ty = -1;
BeachheadUI.MessageBox._x = -1;
BeachheadUI.MessageBox._y = -1;
BeachheadUI.MessageBox.show = function(pTitle, pMessage, pTableCSS, pContentCSS, pButtonArray, pOuterBorderCSS)
{
if(pTitle)
BeachheadUI.MessageBox._modalDialog._title = pTitle;
if(pMessage)
BeachheadUI.MessageBox._modalDialog._message = pMessage;
if(pTableCSS)
BeachheadUI.MessageBox._modalDialog._tableCSS = pTableCSS;
else
BeachheadUI.MessageBox._modalDialog._tableCSS = BeachheadUI.MessageBox.defaultTableCSS;
if(pContentCSS)
BeachheadUI.MessageBox._modalDialog._contentCSS = pContentCSS;
else
BeachheadUI.MessageBox._modalDialog._contentCSS = BeachheadUI.MessageBox.defaultContentCSS;
/* Modification by Patrick - Sept 26 */
/* Modified Oct 4, 07-added ability to set the buttons with 4th arg-Justin */
/* if 4th arg is array, it takes label and function, if it is a string, it performs your function */
/* Modified 2-10-2010 - added ability to set borderStyle - dave */
if((pButtonArray)&&((pButtonArray instanceof Array)||(pButtonArray.length)))
BeachheadUI.MessageBox._modalDialog.setButtons(pButtonArray);
else if(pButtonArray)
BeachheadUI.MessageBox._modalDialog.setButtons([[BeachheadUI.language["ok"],pButtonArray]]);
else
BeachheadUI.MessageBox._modalDialog.setButtons([[BeachheadUI.language["ok"],"BeachheadUI.MessageBox._close"]]);
if (pOuterBorderCSS)
{
BeachheadUI.MessageBox._modalDialog._borderColorClass = pOuterBorderCSS;
BeachheadUI.MessageBox._modalDialog._contentBorderColorClass = pOuterBorderCSS;
}
/* End Mod */
BeachheadUI.MessageBox._modalDialog._modal = true;
BeachheadUI.MessageBox._isWidget = (pTitle == BeachheadUI.language["account_selection"]) ? true : false;
if(BeachheadUI.MessageBox._modalDialog.show())
{
return true;
}
else
return false;
}
BeachheadUI.MessageBox.close = function()
{
if(document.getElementById(BeachheadUI.MessageBox._modalDialog._messageBoxDiv))
BeachheadUI.MessageBox._modalDialog.close();
}
/*
This function will set the title
*/
BeachheadUI.MessageBox.setTitle = function(pTitle)
{
BeachheadUI.MessageBox._modalDialog._title = pTitle;
if(BeachheadUI.MessageBox._modalDialog._titleObj)
BeachheadUI.MessageBox._modalDialog._titleObj.innerHTML = pTitle;
};
/*
This function will return the content object of the modal dialog box
*/
BeachheadUI.MessageBox.getContentObject = function()
{
return BeachheadUI.MessageBox._modalDialog._contentObj;
};
/*
This function will set the content of the static modal dialog
*/
BeachheadUI.MessageBox.setContent = function(pContent)
{
BeachheadUI.MessageBox._modalDialog.setContent(pContent);
};
/*
This function will set the buttons of the static modal dialog
*/
BeachheadUI.MessageBox.setButtons = function(pButtons)
{
BeachheadUI.MessageBox._modalDialog.setButtons(pButtons);
};
/*
This is the function that will generate the message box
*/
BeachheadUI.MessageBox.prototype._create = function (pMD) {
var tl, tm, tr, rs, ls, bl, bm, bs;
var cd = function () { return pMD.appendChild(document.createElement("div")); };
cd().className = "topleft";
cd().className = "topmiddle";
cd().className = "topright";
cd().className = "sideright";
cd().className = "sideleft";
cd().className = "botleft";
cd().className = "botmiddle";
cd().className = "botright";
cd().className = "innertopmiddle";
cd().className = "innerbotmiddle";
var mc = cd();
mc.style.position = "relative";
mc.className = this._tableCSS;
//this._title
//this._messageBoxButtons = new Array();
// this._message = pMessage;
if (this._title) {
this._titleObj = mc.appendChild(document.createElement("div"));
this._titleObj.className = "title";
this._titleObj.innerHTML = this._title;
}
this._contentObj = mc.appendChild(document.createElement("div"));
if (this._messageBoxButtons.length > 0) {
//create buttons
var bd = mc.appendChild(document.createElement("div"));
bd.className = "buttons";
for (var x = this._messageBoxButtons.length - 1; x >= 0; x--) {
var bud = document.createElement("div");
bud.className = "button";
var bsz = bud.appendChild(document.createElement("div"));
bsz.className = "buttonWidth";
bsz.style.height = "0px";
if (this._title && this._title == BeachheadUI.language["deleteresponder"]) {
bd.style.height = "30px";
if (this._messageBoxButtons[x][BeachheadUI.MessageBox._NAME_INDEX] == "Cancel") {
bud.className = "u1203_div";
bud.style.top = "115px";
bud.style.left = "280px";
bud.style.height = "30px";
bud.style.paddingTop = "6px";
bud.style.textAlign = "center";
}
else {
bud.className = "u1202_div";
bud.style.top = "115px";
bud.style.left = "115px";
bud.style.width = "150px";
bud.style.height = "25px";
bud.style.paddingTop = "8px";
bud.style.textAlign = "center";
}
}
if (this._messageBoxButtons[x].length > BeachheadUI.MessageBox._WIDTH_INDEX) {
var mwd = bud.appendChild(document.createElement("div"));
mwd.style.height = "0px";
mwd.style.width = this._messageBoxButtons[x][BeachheadUI.MessageBox._WIDTH_INDEX];
}
bud.appendChild(document.createElement("span")).appendChild(document.createTextNode(this._messageBoxButtons[x][BeachheadUI.MessageBox._NAME_INDEX]));
window[this._messageBoxDiv] = this;
bud.onclick = function (pX, pObj) {
return function (event) {
pObj._onClick(event, pMD.id, pX);
}
}(x, this);
bd.appendChild(bud);
this._messageBoxButtonObjs[x] = bud;
}
}
this._contentObj.className = "content " + this._contentCSS;
this._contentObj.innerHTML = this._message;
this._mainObj = pMD;
this._mainObj.style.cursor = "move";
this._mainObj.onmousedown = function (event) {
var cobj;
if (!event)
event = window.event;
if (event.srcElement)
cobj = event.srcElement;
else if (event.target)
cobj = event.target;
if (cobj != pMD)
return;
BeachheadUI.MessageBox._onMouseDown(event, pMD.id);
};
return;
var tabObj = document.createElement("table");
tabObj.style.cursor = "default";
this._mainObj = tabObj;
tabObj.appendChild(document.createElement("tbody"));
tabObj.className = this._tableCSS;
if (this._borderColorClass)
tabObj.className += " " + this._borderColorClass;
else
tabObj.style.border = this._borderColor + " " + this._borderStyle + " " + this._borderWidth;
tabObj.style.borderCollapse = "collapse";
tabObj.style.whiteSpace = "nowrap";
tabObj.style.filter = "alpha(opacity=100)";
var tr = document.createElement("tr");
var td = document.createElement("td");
td.colSpan = 3;
td.style.padding = this._padding;
td.style.paddingLeft = this._paddingSides;
td.style.paddingRight = this._paddingSides;
td.style.cursor = "pointer";
eval("td.onmousedown = function(event){BeachheadUI.MessageBox._onMouseDown(event, '" + this._messageBoxDiv + "');}");
td.style.whiteSpace = "nowrap";
td.innerHTML = this._title;
this._titleObj = td;
tr.appendChild(td);
tabObj.tBodies[0].appendChild(tr);
tr = document.createElement("tr");
td = document.createElement("td");
td.style.width = this._padding;
td.innerHTML = " ";
tr.appendChild(td);
td = document.createElement("td");
td.innerHTML = "" + this._message + "
";
td.className = this._contentCSS;
td.style.overflow = "hidden";
td.style.whiteSpace = "nowrap";
if (this._contentBorderColorClass)
td.className += " " + this._contentBorderColorClass;
else
td.style.border = this._contentBorderColor + " " + this._contentBorderStyle + " " + this._contentBorderWidth;
this._contentObj = td;
tr.appendChild(td);
td = document.createElement("td");
td.style.width = this._padding;
td.innerHTML = " ";
tr.appendChild(td);
tabObj.tBodies[0].appendChild(tr);
tr = document.createElement("tr");
td = document.createElement("td");
td.style.padding = this._padding;
td.style.paddingLeft = this._paddingSides;
td.style.paddingRight = this._paddingSides;
td.colSpan = 3;
td.style.textAlign = "right";
for (var x = 0; x < this._messageBoxButtons.length; x++) {
if (x != 0) {
var spacer = document.createElement("span");
spacer.innerHTML = " ";
td.appendChild(spacer);
}
var input = document.createElement("input");
input.type = "button";
input.value = this._messageBoxButtons[x][BeachheadUI.MessageBox._NAME_INDEX];
window[this._messageBoxDiv] = this;
input.onclick = function (pId, pX, pObj) {
return function (event) {
pObj._onClick(event, pId, pX);
};
} (this._messageBoxDiv, x, this);
//eval("input.onclick = function(event){BeachheadUI.MessageBox._onClick(event, '" + this._messageBoxDiv + "', " + x + ");}");
td.appendChild(input);
this._messageBoxButtonObjs[x] = input;
}
if (td.childNodes.length == 0)
td.innerHTML = "";
tr.appendChild(td);
tabObj.tBodies[0].appendChild(tr);
return tabObj;
}
/*
Private function used to close the static message box.
*/
BeachheadUI.MessageBox._close = function()
{
return true;
}
BeachheadUI.MessageBox.prototype._onClick = function (pEvent, pNamespace, pActionIndex)
{
var obj = window[pNamespace];
if (typeof BeachheadUI.MessageBox._modalDialog._messageBoxButtonObjs[pActionIndex].attributes["disabled"] != 'undefined') {
if (BeachheadUI.MessageBox._modalDialog._messageBoxButtonObjs[pActionIndex].attributes["disabled"].value == "disabled") {
return true;
}
}
var func = obj._messageBoxButtons[pActionIndex][BeachheadUI.MessageBox._FUNCTION_INDEX];
if((typeof(func) == "object")||(typeof(func) == "function"))
{
if(func.call(this))
obj.close();
}
else if((typeof(func) == "string")&&(func.lastIndexOf(")") == (func.length -1)))
{
if(eval(func))
obj.close();
}
else if(typeof(func) == "string")
{
if(eval(func + "()"))
obj.close();
}
else
obj.close();
}
/*
This function will make the modal dialog box flash.
*/
BeachheadUI.MessageBox._onMouseDownModal = function(pEvent, pObjStr)
{
document.getElementById(pObjStr).style.display = "none";
setTimeout("document.getElementById('" + pObjStr + "').style.display = '';", 0);
}
/*
Private function used to prevent tabs from allowing access to items under the modal message box
*/
BeachheadUI.MessageBox._onKeyDownModal = function (pEvent, pObjStr) {
var flash = false;
var objInElement = false;
var msgBoxObj = document.getElementById(pObjStr);
if (BeachheadUI.IE) {
pEvent = window.event;
if (!msgBoxObj.contains(window.event.srcElement)) {
window.event.returnValue = false;
window.event.cancelBubble = true;
flash = true;
}
}
else {
var contained = false;
var obj = pEvent.target;
while ((obj.parentNode) && (!contained)) {
if (obj.parentNode == msgBoxObj)
contained = true;
obj = obj.parentNode;
}
if (!contained) {
pEvent.stopPropagation();
pEvent.preventDefault();
flash = true;
}
}
var inputs = msgBoxObj.getElementsByTagName("input");
// if(pEvent.keyCode == 13)
// {
// for(var x = 0; x < inputs.length; x++)
// {
// if(inputs[x].type == "button")
// {
// if(inputs[x].fireEvent)
// {
// if((flash)||(window.event.srcElement.tagName != "TEXTAREA"))
// {
// inputs[x].fireEvent("onclick");
// window.event.cancelBubble = true;
// window.event.returnValue = false;
// }
// }
// else if(inputs[x].dispatchEvent)
// {
// if((flash)||(pEvent.target.tagName != "TEXTAREA"))
// {
// var evt = document.createEvent("MouseEvents");
// evt.initMouseEvent("click", true, true, window,
// 0, 0, 0, 0, 0, false, false, false, false, 0, null);
// inputs[x].dispatchEvent(evt);
// pEvent.preventDefault();
// pEvent.stopPropagation();
// }
// }
// break;
// }
// }
// flash = false;
// }
if (pEvent.keyCode == 13) {
if (this._isWidget) {
if (document.getElementById("divSearchRst") != null)
document.getElementById("divSearchRst").style.display = "none";
return false;
}
else {
BeachheadUI.MessageBox.CurrentMBObj._messageBoxButtonObjs[0].onclick();
flash = false;
}
}
if ((flash) && (pEvent.keyCode == 9)) {
flash = false;
try { inputs[0].focus(); } catch (ex) { flash = true; }
}
if (flash) {
msgBoxObj.style.display = "none";
setTimeout("document.getElementById('" + pObjStr + "').style.display = '';", 100);
return false;
}
return true;
}
/*
Private function used to set up the dragging of the message box
*/
BeachheadUI.MessageBox._onMouseDown = function(pEvent, pObjStr) {
if (!pEvent)
pEvent = window.event;
var dobj = document.getElementById(pObjStr);
BeachheadUI.MessageBox._y = parseInt(dobj.style.top);
BeachheadUI.MessageBox._x = parseInt(dobj.style.left);
BeachheadUI.MessageBox._ty = pEvent.clientY - BeachheadUI.MessageBox._y;
BeachheadUI.MessageBox._tx = pEvent.clientX - BeachheadUI.MessageBox._x;
if (document.body.setCapture)
document.body.setCapture();
eval("document.onmousemove = function(event){BeachheadUI.MessageBox._onMouseMove(event, '" + pObjStr + "');}");
document.onmouseup = function() { document.onmousemove = ""; document.onmouseup = ""; if (document.body.releaseCapture) document.body.releaseCapture(); };
if (document.selection)
try { document.selection.empty(); } catch (ex) { }
else if (window.getSelection)
window.getSelection().removeAllRanges();
};
/*
Private function used to handle the dragging of the message box
*/
BeachheadUI.MessageBox._onMouseMove = function(pEvent, pObjStr)
{
var dobj = document.getElementById(pObjStr);
var pobj = document.getElementById(pObjStr + "parent");
if(!pEvent)
pEvent = window.event;
var left = (pEvent.clientX - BeachheadUI.MessageBox._tx);
var top = (pEvent.clientY - BeachheadUI.MessageBox._ty);
if(left < 0)
left = 0;
else if(left > (pobj.clientWidth - dobj.clientWidth))
left = pobj.clientWidth - dobj.clientWidth;
//Code added 10/17/07 to allow messagebox to drag to bottom-most
//part of page (previously, would only drag to bottom most part
//of top section of page) -Dan
var alto= 0;
if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
alto = document.body.clientHeight;
else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
alto = document.documentElement.clientHeight;
else if( typeof( window.innerWidth ) == 'number' )
alto = window.innerHeight;
if (pobj.clientHeight > alto)
alto = pobj.clientHeight;
if(top < 0)
top = 0;
else if(top > (alto + dobj.clientHeight))
top = alto + dobj.clientHeight;
dobj.style.left = left + "px";
dobj.style.top = top + "px";
if(document.selection)
try { document.selection.empty(); } catch (ex) { }
else if(window.getSelection)
window.getSelection().removeAllRanges();
};
window.onload = function (pOldOnLoad) {
return function (pEvent) {
var pl = new BeachheadUI.MessageBox("mbpl", "test", "message", null, null, ["OK"]);
pl.show({ x: -10000, y: -10000 });
pl.close();
if (pOldOnLoad)
pOldOnLoad(pEvent);
}
} (window.onload);