var popupWindow    = null;

function displayPopupMessage_old( mgs, title ) {
	if (!popupWindow) {
		try {
			var msgBoxIframe              = document.createElement("IFRAME");
			msgBoxIframe.id               = 'errBox';
			msgBoxIframe.name             = 'errBox';
			msgBoxIframe.className        = "error_div";

//			var msgBox              = document.createElement("DIV");
//			msgBox.id               = 'errBox_div';
//			msgBox.name             = 'errBox_div';
//			msgBox.className        = "error_div";
alert(1);
			var divBody  = '<div id="errBox_div" name="errBox_div" class="error_div"><table width="100%"><tr><td>';
			divBody += '<font size="3">' + mgs + '</font><br />';
//			divBody += '<font size="3"><table align="left"><tr><td colspan="2" align="left"><strong>Here is how to find your Public Profile name on Linked in.</strong></td></tr><tr><td>&nbsp;&nbsp;1.</td><td align="left">Login to LinkedIn</td></tr><tr><td>&nbsp;&nbsp;2.</td><td align="left">Click View My Profile link in the Left Navigation Menu</td></tr><tr><td>&nbsp;&nbsp;3.</td><td align="left">Click Edit Public Profile Settings link on Top Right of Profile</td></tr><tr><td>&nbsp;&nbsp;4.</td><td align="left">Find the Your Public Profile URL at the Top of the Page</td></tr><tr><td>&nbsp;&nbsp;5.</td><td align="left">Your Public Profile Name is after <a href="#">www.linedin.com/in/</a></td></tr><tr><td colspan="2" align="left">&nbsp;<img src="img/common/linkedin_help.gif"></td></tr></table></font><br />';
//			divBody += '</td></tr><tr align="center" valign="middle"><td align="right">';
//			divBody += '<input type="button" value="Close" onclick="CloseBox()\;">';
			divBody += '<a href=""  onclick="CloseBox()\; return false;">Close</a>&nbsp;';
			divBody += '</td></tr><table></div>';

//			msgBox.innerHTML = divBody;
alert(divBody);
			msgBoxIframe.innerHTML = divBody;
alert(2);
//			document.body.appendChild(msgBox);
			document.body.appendChild(msgBoxIframe);
//			msgBoxIframe.appendChild(msgBox);
alert(3);
//			popupWindow = msgBox;
			popupWindow = msgBoxIframe;
			centerDlg(popupWindow);
			popupWindow.focus();
		} catch (e) {
			alertErr(e, 'displayErrorMessage');
			return false;
		}
	}
}

function displayPopupMessage( mgs, title ) {
	if (!popupWindow) {
		try {
			if ((navigator.userAgent.indexOf("MSIE 6.0") != -1) && (navigator.userAgent.indexOf("Opera") == -1))
			{
				var msgBoxIframe              = document.createElement("IFRAME");
				msgBoxIframe.id               = 'errBoxIFrame';
				msgBoxIframe.name             = 'errBoxIFrame';
				msgBoxIframe.className        = "error_div_iframe";
				msgBoxIframe.src              = "";
				msgBoxIframe.height           = "222px";
			}

			var msgBox              = document.createElement("DIV");
			msgBox.id               = 'errBox_div';
			msgBox.name             = 'errBox_div';
			msgBox.className        = "error_div";
//alert(1);
			var divBody  = '<table width="100%"><tr><td>';
			divBody += '<font size="3">' + mgs + '</font><br />';
//			divBody += '<font size="3"><table align="left"><tr><td colspan="2" align="left"><strong>Here is how to find your Public Profile name on Linked in.</strong></td></tr><tr><td>&nbsp;&nbsp;1.</td><td align="left">Login to LinkedIn</td></tr><tr><td>&nbsp;&nbsp;2.</td><td align="left">Click View My Profile link in the Left Navigation Menu</td></tr><tr><td>&nbsp;&nbsp;3.</td><td align="left">Click Edit Public Profile Settings link on Top Right of Profile</td></tr><tr><td>&nbsp;&nbsp;4.</td><td align="left">Find the Your Public Profile URL at the Top of the Page</td></tr><tr><td>&nbsp;&nbsp;5.</td><td align="left">Your Public Profile Name is after <a href="#">www.linedin.com/in/</a></td></tr><tr><td colspan="2" align="left">&nbsp;<img src="img/common/linkedin_help.gif"></td></tr></table></font><br />';
//			divBody += '</td></tr><tr align="center" valign="middle"><td align="right">';
//			divBody += '<input type="button" value="Close" onclick="CloseBox()\;">';
			divBody += '<a href=""  onclick="CloseBox()\; return false;">Close</a>&nbsp;';
			divBody += '</td></tr><table>';

			msgBox.innerHTML = divBody;
			if ((navigator.userAgent.indexOf("MSIE 6.0") != -1) && (navigator.userAgent.indexOf("Opera") == -1))
			{
				document.body.appendChild(msgBoxIframe);
			}
			document.body.appendChild(msgBox);
//alert(3);
			popupWindow = msgBox;
//			popupWindow = msgBoxIframe;
			if ((navigator.userAgent.indexOf("MSIE 6.0") != -1) && (navigator.userAgent.indexOf("Opera") == -1))
			{
				centerDlg(msgBoxIframe);
			}
			centerDlg(popupWindow);
			popupWindow.focus();
		} catch (e) {
			alertErr(e, 'displayErrorMessage');
			return false;
		}
	}
}

function getBodyScrollTop()
{
  return self.pageYOffset ||
    (document.documentElement && document.documentElement.scrollTop) ||
    (document.body && document.body.scrollTop);
}

function getBodyScrollLeft()
{
  return self.pageXOffset ||
    (document.documentElement && document.documentElement.scrollLeft) ||
    (document.body && document.body.scrollLeft);
}

function centerDlg(dlg) {
	try {
		dlg_width  = dlg.offsetWidth;
		dlg_height = dlg.offsetHeight;

		elWidth2  = dlg_width / 2;
		elHeight2 = dlg_height;

		screenW2 = screen.width / 2;
		screenH2 = screen.height / 2;

		var hScroll = getBodyScrollLeft();
		var vScroll = getBodyScrollTop();

		posX = hScroll + screenW2 - elWidth2;
		posY = vScroll + screenH2 - elHeight2;

		dlg.style.left = posX + 'px';
		dlg.style.top  = posY + 'px';
	} catch (e) {
		alertErr(e, 'centerDlg');
		return false;
	}
}
function _getEvent(event) {
	if (!event)
	{
		var event = window.event;
	}
	return event;
}

var currentDrag = null;

var CloseBox = function(event) {
	event = _getEvent(event);
	document.body.removeChild(popupWindow);
	delete(el);
	popupWindow = null;
	if ((navigator.userAgent.indexOf("MSIE") != -1) && (navigator.userAgent.indexOf("Opera") == -1))
	{
		document.body.removeChild(document.getElementById('errBoxIFrame'));
	}
}
