// JScript File
String.prototype.br2nl =
  function() {
    return this.replace(/<br\s*\/?>/mg,"\n");
  };
function OffMsg(whichstatus) {

    CloseTip = "Close";


    if (whichstatus == 80) {
		TheTitle = "Not Logged In<br /><br />";
		MsgPlus = 'This feature cannot be accessed because you are not logged in or registered.  Please login/register to continue.';
    }
    MsgBody = "<span style='color: #FFFFFF; font-family: Verdana, Helvetica, sans-serif; font-weight: bold; font-size: 16px;'>" + TheTitle + "</span><table border=0 cellpadding=0 cellspacing=0 style='color: #FFFFFF' width=100%>" +
              "<tr><td style=\"padding: 0px; padding-bottom: 0px\"><span style='color: #FFFFFF; font-family: Verdana, Helvetica, sans-serif; font-size: 12px;'>" + MsgPlus + "</span></td></tr>" +
              "</table><br>";
   	  alert(TheTitle.br2nl() + MsgPlus.br2nl());
    //divAlert(null,MsgBody,'Close this message','closeAlert()',null,null,true,true);
}

function divAlert(titleStr,msgStr,button1Text,button1Action,button2Text,button2Action,isDimmed,isGradient,hasOwnStyle)
{
 var alertStr = "";
 var backgroundclass = "noTitle";
 if (!isGradient) backgroundclass = "yesTitle";
 if (typeof(titleStr) !== "string") titleStr = "";
 var hasButton1 = typeof(button1Text) == "string" && typeof(button1Action) == "string";
 var hasButton2 = typeof(button2Text) == "string" && typeof(button2Action) == "string";

    alertStr = '<table border=0 class='+backgroundclass+'><tr><td class=alertTitle>'+titleStr+'</td><td class="x" valign="top"><a href=\'javascript:closeAlert()\'><img src="imgs/x-notif.jpg" border="0"></a></td></tr>';

 if (titleStr == "") alertStr += '<tr><td></td></tr><tr><td colspan=2 class=alertText>'+msgStr+'</td></tr>';
 else alertStr += '<tr><td class=alertSpace></td></tr><tr><td colspan=2 class=alertText>'+msgStr+'</td></tr>';

 if (hasButton1)
 {
        alertStr += '<tr><td colspan=2 class=alertButton>';

     if (hasButton1)  
        alertStr += '<input type=button class="mcLoginButton" value=\''+button1Text+'\' onClick=\''+button1Action+'\' />';

     if (hasButton2) 
        alertStr += '&nbsp;<input type=button class="mcLoginButton" value=\''+button2Text+'\' onClick=\''+button2Action+'\' />';

        alertStr += '</td></tr>';
 }
 
 alertStr += '<tr><td class=alertSpace></td></tr></table>';
 
 if (hasOwnStyle) {
     alertStr = msgStr;
 }


 if (!document.getElementById("divAlertID"))
 {
    newDiv = document.createElement("div");
    newDiv.id = "divAlertID";
    document.body.appendChild(newDiv);
 }

 document.getElementById("divAlertID").innerHTML = alertStr;
 var fromTop = document.documentElement.scrollTop;
 cWidth = document.body.clientWidth; cHeight = document.body.clientHeight;
 document.getElementById("divAlertID").style.top = document.documentElement.scrollTop + 100;
 document.getElementById("divAlertID").style.left = (cWidth / 2) - 260;
 document.getElementById("divAlertID").style.display = "block";

    if (isDimmed)
        Dimmer();
}

function closeAlert()
{
    if (document.getElementById("divAlertID"))
        document.getElementById("divAlertID").style.display = "none";
    if (document.getElementById("dimmerDiv"))
        document.getElementById("dimmerDiv").style.display = "none";
        
    var selCount=document.getElementsByTagName("select")
    for (i=0; i<selCount.length; i++)
        selCount[i].style.visibility="visible";     
}

function Dimmer()
{
    if (!document.getElementById("dimmerDiv"))
    {
        newDiv2 = document.createElement("div");
        newDiv2.id = "dimmerDiv";
        document.body.appendChild(newDiv2);
    }
    if (document.body.scrollHeight > document.body.offsetHeight) { 
        document.getElementById("dimmerDiv").style.height = document.body.scrollHeight + 'px';
    }
	else {
		document.getElementById("dimmerDiv").style.height = document.body.offsetHeight + 'px';
	}
    document.getElementById("dimmerDiv").style.width = document.body.scrollWidth + 'px';
    // if (is_ie5 || is_ie6) {hideSelects()};
    document.getElementById("dimmerDiv").style.display = "block";
    var selCount = document.getElementsByTagName("select");
    for (i=0; i<selCount.length; i++)
        selCount[i].style.visibility = "hidden";  
}

