//*****************************************************************************************
//* 	Global Variables:					define global variables
//*****************************************************************************************

  var i           = 0;
  var timed       = 0;
  var scrollGo    = false;
  var delay       = 120;
  var space       = 120;
  var aryLimit    = 20;
  var aryHeader   = new Array(aryLimit);
  var aryDetail   = new Array(aryLimit);
  var myVisits    = 0;
  var msg;

//*****************************************************************************************
//* Function:			getMainLine
//* Passed Values:		none
//* Returned Value:		none
//* Purpose:			On loading form, perform setup and init functions
//*****************************************************************************************
function getMainLine() {

  setWindowDefaultMsg("Welcome to MAWA. Please review the Announcements Page...");

  document.all.txtLogonId.focus();

  putDefaultValues();
  scroll_start();

  document.all.txtLogonId.value           = ""; 
  document.all.txtLogonPassword.value     = ""; 
  document.all.txtLogonIdHide.value       = ""; 
  document.all.txtLogonPasswordHide.value = ""; 

}
//*****************************************************************************************
function getEditCheck(formObj) {
	if (formObj.txtLogonId.value=="") {
	    alert("You must enter a Login Id in order to access the MAWAonline services.\n\nIf you want to create a new PROFILE and JOIN the MAWAOnline.org to access special services,\nthen enter a USER ID and PASSWORD to process your NEW account information.\nYour will be requested to reenter your USER ID and PASSWORD when creating a NEW ACCOUNT.");
	    formObj.txtLogonId.focus();
	    return false;
	}

	if (formObj.txtLogonPassword.value=="") {
	    alert("You must enter a Login password in order to access the MAWAonline services");
	    formObj.txtLogonPassword.focus();
	    return false;
	}
	return true;
}
//*****************************************************************************************
function getMyVisits() {
  document.write(document.all.txtMyVisits.value);
  return document.all.txtMyVisits.value;
}
//*****************************************************************************************
function scroll_start()   {

   var i=0;

   msg="Welcome to MAWAonline! Look for more in 2000 and 2001....watch for school schedules, tournaments and special events.";
   for (i=0;i<space;i++)
	msg=" "+msg;
   scrollGo=true;
   timerid=window.setTimeout("scrollmsg(0)",delay);
}
//*****************************************************************************************
function scrollmsg(pos) {

   var out = "";
   scrollGo=false;

   if (pos < msg.length)
       self.status = msg.substring(pos, msg.length);
   else
       pos=-1;
       ++pos;
   scrollGo=true;
   timerid=window.setTimeout("scrollmsg("+pos+")",delay);
}
//*****************************************************************************************
function putHighLite(i) {
   document.all.txtHeader.value=aryHeader[i];document.all.txtDetail.value=aryDetail[i];
}
//*****************************************************************************************
//* Function:			PutCookieVisits
//* Passed Values:		none
//* Returned Value:		none
//* Purpose:			Given cookie, return visit attributes
//*****************************************************************************************
function PutCookieVisits(name)  {
   var expdate = new Date();
   var visits;
   expdate.setTime(expdate.getTime() +  (48 * 60 * 60 * 1000 * 365));

   if(!(visits = GetCookie(name)))
        visits = 0;
   visits++;

   SetCookie(name, visits, expdate, "/", null, false);
   document.write("Your Visits:&nbsp;"+visits+" ");
}
//*****************************************************************************************
//* Function:			PutCookieMenuOption
//* Passed Values:		DirPath, MenuItem
//* Returned Value:		none
//* Purpose:			Given cookie, return visit attributes
//*****************************************************************************************
function PutCookieMenuOption(DirPath, MenuItem)  {
   var DirPathName;
   var MenuOption;
   var expdate = new Date();
   expdate.setTime(expdate.getTime() +  (48 * 60 * 60 * 1000 * 365));

   if(!(MenuOption = GetCookie("MenuOption")))
	{MenuItemAgain = "whatMenuItem";}

   SetCookie("MenuOption", MenuItem, expdate, "/", null, false);

   if(!(DirPathName = GetCookie("DirPathName")))
	{DirPathAgain = "whatPathDir";}

   SetCookie("DirPathName", DirPath, expdate, "/", null, false);

}
//*****************************************************************************************
//* Function:			GetCookie
//* Passed Values:		userName
//* Returned Value:		none
//* Purpose:			Gets cooie and its attributes
//*****************************************************************************************
function GetCookie (name) {
   var arg  = name + "=";
   var alen = arg.length;
   var clen = document.cookie.length;
   var i    = 0;

   while (i < clen)
    {
      var j = i + alen;
      if (document.cookie.substring(i, j) == arg)
          return GetCookieVal (j);
      i = document.cookie.indexOf(" ", i) + 1;
      if (i == 0)
          break;
    }
   return null;
}
//*****************************************************************************************
//* Function:			SetCookie
//* Passed Values:		userName, escape value
//* Returned Value:		none
//* Purpose:			Sets cookie attributes
//*****************************************************************************************
function SetCookie (name, value)  {
   var argv    = SetCookie.arguments;
   var argc    = SetCookie.arguments.length;

   var expires = (2 < argc) ? argv[2] : null;
   var path    = (3 < argc) ? argv[3] : null;
   var domain  = (4 < argc) ? argv[4] : null;
   var secure  = (5 < argc) ? argv[5] : false;

   document.cookie = name + "=" + escape (value) +
     ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
     ((path    == null) ? "" : ("; path=" + path)) +
     ((domain  == null) ? "" : ("; domain=" + domain)) +
     ((secure  == true) ? "; secure" : "");
}
//*****************************************************************************************
//* Function:			GetCookieVal
//* Passed Values:		Starting ocation of cookie attribute
//* Returned Value:		attribute value
//* Purpose:			Sets an returns attribute value
//*****************************************************************************************
function GetCookieVal (offset)  {
   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == -1)
       endstr = document.cookie.length;
   return unescape(document.cookie.substring(offset, endstr));
}
//*****************************************************************************************
//* Function:			GetTime
//* Passed Values:		none
//* Returned Value:		none
//* Purpose:			Show Nailed Bug
//*****************************************************************************************
function GetCurrTime()  {
   today = new Date();

   if(today.getMinutes() < 10)
     {pad = "0"}
   else
      pad = "";

   document.write(today);
}
//*****************************************************************************************
function setLogonId() {
  document.all.txtLogonIdHide.value       = document.all.txtLogonId.value; 
  document.all.txtLogonPasswordHide.value = document.all.txtLogonPasswordHide.value; 
}