var MyWin;
var MyHelpWin;

var sTempLocation = String(self.location);
sTempLocation = sTempLocation.toLowerCase();
if ((sTempLocation.indexOf("/masteradmin/") == -1) && (sTempLocation.indexOf("login.asp") == -1) && (sTempLocation.indexOf("relogin.asp") == -1) && (sTempLocation.indexOf("logout.asp") == -1) && (GetCookie("LoggedOut") == "Yes"))
  self.location.replace("/admin/relogin.asp");

// Retrieve the value of the cookie with the specified name.
function GetCookie(sName)
{
  // cookies are separated by semicolons
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++)
  {
    // a name/value pair (a crumb) is separated by an equal sign
    var aCrumb = aCookie[i].split("=");
    if (sName == aCrumb[0])
      return unescape(aCrumb[1]);
  }

  // a cookie with the requested name does not exist
  return null;
}

function placeFocus() {
   if (document.forms.length > 0) {
      var field = document.forms[0];
      for (var iCount = 0; iCount < field.length; iCount++) {
         var strType = field.elements[iCount].type.toString();

         if (strType == "text" || strType == "file" || strType == "textarea" ||     // #10228: need to consider checkbox & radio too
             strType == "checkbox" || strType == "radio" || strType.charAt(0) == "s") {
            try {
               document.forms[0].elements[iCount].focus();
            }
            catch(exception) {}
            break;
         }
      }
   }
}

function ShowWindow(MyHref,WindowName,WinWidth,WinHeight)
{
  var AvailWidth = screen.availWidth;
  var AvailHeight = screen.availHeight;
  if (WinWidth > AvailWidth - 40)
    WinWidth = AvailWidth - 40;
  if (WinHeight > AvailHeight - 100)
    WinHeight = AvailHeight - 100;

  var WinLeft = (screen.availWidth - WinWidth)/2;
  var WinTop = (screen.availHeight - WinHeight - 40)/2;

  if (WinWidth == 0 && WinHeight == 0)
  {
    WinLeft = screen.availWidth;
    WinTop = screen.availHeight;
    WinWidth = 100;
    WinHeight = 100;
  }
  if (!MyWin || MyWin.closed)
  {
    MyWin = window.open(MyHref, WindowName, 'left='+WinLeft+', top='+WinTop+', directories=no,resizable=yes,titlebar=no,toolbar=no,menubar=no,scrollbars=yes,width='+WinWidth+',height='+WinHeight);
  }
  else
  {
    MyWin.location = MyHref;
    MyWin.focus();
  }
}

//  End -->