var w = '';

function OpenPopUp(Centered, URL, Name, Height, Width, Options)
/****************************************************************************************
/                                                                                       /
/ Purpose: This function pops up a browser window with the specified attributes         /
/                                                                                       /
/ Parameters:                                                                           /
/             URL = the url of the page to load into the window                         /
/             Name = the name of the window                                             /
/             Height = the height of the window                                         /
/             Width  = the width of the window                                          /
/             Options = any other options like a status bar                             /
/                                                                                       /
/ Returns: nothing but the window opens                                                 /
/                                                                                       /
****************************************************************************************/
{
  var opts = "height=" + Height + ",width=" + Width + "," + Options;
  var w = window.open(URL, Name, opts);
  if(Centered == 1)
  {
    var x = (screen.availWidth - Width)/2;
    var y = (screen.availHeight - Height)/2;
    w = window.open(URL, Name, opts);
    w.moveTo(x,y);    
  }
} //end OpenPopUp

function ClosePopUp()
/****************************************************************************************
/                                                                                       /
/ Purpose: This function closes the window opened by OpenPopUp                          /
/                                                                                       /
/ Parameters:                                                                           /
/                                                                                       /
/ Returns: nothing but the window closes                                                /
/                                                                                       /
****************************************************************************************/
{
    w.close();
} //end ClosePopUp

function CheckEmailAddress(address)
/****************************************************************************************
/                                                                                       /
/ Purpose: This function verifies an email address as formatted correctly               /
/                                                                                       /
/ Parameters:                                                                           /
/             address = the email address to check                                      /
/                                                                                       / 
/ Returns: true if the address is correct and false if it is not                        /
/                                                                                       /
****************************************************************************************/
{
  var pattern = /(\w+)@(\w+).(\w+)/i;
  return pattern.match(address);
} //end CheckEmailAddress

function CheckLength(variable, minimum, maximum)
/****************************************************************************************
/                                                                                       /
/ Purpose: This function verifies the length of a variable                              /
/                                                                                       /
/ Parameters:                                                                           /
/              variable = the variable to check                                         /
/              minimum  = the minimum length of the variable (0 for none)               /
/              maximum  = the maximum length of the variable (0 for none)               /
/                                                                                       /
/ Returns: true if the variable is within the parameters false if it is not             /
/                                                                                       /
****************************************************************************************/
{
  var retval = true;
  if(minimum > 0 && variable.length < minimum)
    {return false;}
  if(maximum > 0 && variable.length > maximum)
    {return false;}

 return true;
} //end CheckLength

function Redirect(URL, Win)
/****************************************************************************************
/                                                                                       /
/ Purpose: This function redirects the browser to the url provided                      /
/                                                                                       /
/ Parameters:                                                                           /
/             URL = the url of the document to load in Window                           /
/             Win = the name of the window to redirect                                  / 
/                                                                                       / 
/ Returns: nothing but it will load the document specified by URL into Window           /
/                                                                                       /
****************************************************************************************/
{
  if(Win != "_SELF") {Win.document.location = URL;}
  else {document.location = URL;}
} //end Redirect

function StatusTime()
{
  var tod = ' AM';
  var Now = new Date();
  var Months = new Array ('Jan','Feb','Mar','Apr','May','June','July','Aug','Sep','Oct','Nov','Dec');
  var Time = ((Now.getHours() > 11) ? (Now.getHours() - 11) : Now.getHours());
  if(Now.getHours() > 11) {tod = ' PM';}
  Time = ((Now.getHours() > 12) ? (Now.getHours() - 12) : Now.getHours()); 
  Time += ((Now.getMinutes() < 10) ? ":0" : ":") + Now.getMinutes(); 
  Time += ((Now.getSeconds() < 10) ? ":0" : ":") + Now.getSeconds() + tod;
  var Today = Months[Now.getMonth()] + ". " + Now.getDay() + ", " + Now.getFullYear();
  self.status = Today + "      " + Time;
  setTimeout("StatusTime()",1000);
  return true;
}

function PrintBrowserInfo()
{
  document.write("appCodeName = " + navigator.appCodeName + "<br>\nappName = " + navigator.appName + "<br>\nappVersion = " + navigator.appVersion);
  document.write("<br>\nuserAgent" + navigator.userAgent);
}

function IsOldBrowser()
{
  AV = parseFloat(navigator.appVersion);
  if(navigator.appName == "Netscape" && AV < 5.0) {return 1;}
  else {return 0;}
}
