<!--
/* Javascript code to generate a random ID number for tracking purposes. Will create a cookie on initial visit; will update the cookie only when cookie is due to expire in 30 days */
var cookieNumVisitID = 'This_NumVisits';
var cookieThisID 	 = 'This_ID';
var cookieThisExp	 = 'This_Exp';

// Change 'This_LastVisit' and 'This_NumVisits'
// to something unique for
// the current page, or else it
// won't work correctly if others use this script!
	var ThisDate = new Date();
	var gExp;
	var gNumVisits;		var gID;
	var day = 24 * 60 * 60 * 1000;
	var year = 365 * day;

SetLastVisit();	// Execute when loading page

function GetLastVisit ()
{
	if ( gNumVisits == "")
	{
	return "Welcome to This Buildings!";
	}
	else 
	{
	return 	"Welcome back, your cookie expires on " + gExp +".<BR>You have been here " 
+ gNumVisits + " time" +(gNumVisits>1 ? "s" :"") 
+" before."
	}
}	// End of GetLastVisit

function SetLastVisit (name, value)
{
var newVisitDate = new Date();
var expDate = new Date(); 
var numVisits = 0;
// The expDate is the date when the cookie should
// expire, we will keep it for a year
expDate.setTime( expDate.getTime() + year ); 
// Info about last visit

if (GetCookie (cookieNumVisitID) != null)
	gNumVisits = GetCookie (cookieNumVisitID);	
	else
gNumVisits = 0;

if (GetCookie (cookieThisExp) != null)
	gExp = GetCookie (cookieThisExp);	
else
	gExp = 0;
		
if (GetCookie (cookieThisID) != null)
	gID = GetCookie (cookieThisID);	
else // Generate a random large # for the ID
{
ThisDate = new Date();
var NumSec = ThisDate.getSeconds();
	if (NumSec == 0) 
	{ 
	ThisDate = new Date();
	NumSec = ThisDate.getSeconds();
	}
var NumMin = ThisDate.getMinutes();
	if (NumMin == 0) 
	{
	ThisDate = new Date();
	NumMin = ThisDate.Min() + 2;
	}
var NumTime = ThisDate.getTime();
	if (NumTime == 0) NumTime = NumSec + NumMin;
var bigNumber = NumSec * NumTime * Math.sqrt(NumMin);
gID = Math.floor(bigNumber/49500);
// For now, make it a much smaller number.
gID = NumSec * NumMin * NumSec;
}	// End of Random Number Generator.

// Use eval() to convert a string to a number
	numVisits = eval(gNumVisits) +1;	

// Store info about this visit
	var CookiePath = "/";
	if (gNumVisits == 0)
	{ // This is a first visit; write the cookie
	SetCookie( cookieNumVisitID, numVisits, expDate, CookiePath); 
	SetCookie( cookieThisID, 	gID, expDate, CookiePath); 
	SetCookie( cookieThisExp, 	expDate, expDate, CookiePath); 
	}

// If cookie is due to expire, re-write the cookie
var diff = Math.floor((Date.parse(gExp) - Date.parse(ThisDate))/day);
if (diff < 31) 
{
	SetCookie( cookieNumVisitID, numVisits, expDate, CookiePath); 
	SetCookie( cookieThisID, 	gID, expDate, CookiePath); 
	SetCookie( cookieThisExp, 	expDate, expDate, CookiePath); 
}

}	// End SetLastVisit


function getCookieVal (offset) 
{
    var endstr = document.cookie.indexOf (";", offset);
    if (endstr == -1)
       endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
}	// End getCookieVal

//
//  Function to return the value of the cookie specified by "name".
//    name - String object containing the cookie name.
//    returns - String object containing the cookie value, or null if the cookie does not exist.
//
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;
}	// End GetCookie

//
//  Function to create or update a cookie.
function SetCookie (name, value) 
{
 var argv = SetCookie.arguments;
 var argc = SetCookie.arguments.length;
 var expires = (argc > 2) ? argv[2] : null;
 var path = (argc > 3) ? argv[3] : null;
 var domain = (argc > 4) ? argv[4] : null;
 var secure = (argc > 5) ? argv[5] : false;
   document.cookie = name + "=" + escape (value) +
   ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
   ((path == null) ? "" : ("; path=" + path)) +
   ((domain == null) ? "" : ("; domain=" + domain)) +
   ((secure == true) ? "; secure" : "");
} // End SetCookie

//  Function to delete a cookie. (Sets expiration date to current date/time)
//    name - String object containing the cookie name
//
function DeleteCookie (name) 
{
  var exp = new Date();
  exp.setTime (exp.getTime() - 1);  // This cookie is history
  var cval = GetCookie (name);
  document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}	// End Delete Cookie

/* 
Cookies Demo
By Jerry Aman, Optima System, July 28, 1996.
Cookie Functions written by Bill Dortch, hIdaho Design.

Part of the PageSpinner distribution.

We will not be held responsible for any unwanted 
effects due to the usage of this script or any derivative.  
	No warrantees for usability for any specific application are given or implied.

You are free to use and modify this script,
	if credits are kept in the source code
*/
/* Original code modified by WebMaker-NW.com 2/24/02
*/

// -->