<!--
///JavaScript Developed by Burton Technology - http://www.burton-technology.com
///February 2008

//Pad nuber with leading zero
function PadDigits(n, totalDigits) 
{ 
	n = n.toString(); 
	var pd = ''; 
	if (totalDigits > n.length) 
	{ 
		for (i=0; i < (totalDigits-n.length); i++) 
		{ 
			pd += '0'; 
		} 
	} 
	return pd + n.toString(); 
 }
 
//Parse Querystring
function getArgs() { 
	var args = new Object(); 
	var query = location.search.substring(1); 
	var pairs = query.split("&"); 
	for(var i = 0; i < pairs.length; i++) { 
		var pos = pairs[i].indexOf('='); 
		if (pos == -1) continue; 
		var argname = pairs[i].substring(0,pos); 
		var value = pairs[i].substring(pos+1); 
		args[argname] = unescape(value); 
	} 
	return args; 
}

//Get UTC time and date
function getUTC() {
	var strDate = new Object();
	var lsDate = new Date();
	strDate = lsDate.getUTCFullYear()+'-'+PadDigits(lsDate.getUTCMonth()+1,2)+'-'+PadDigits(lsDate.getUTCDate(),2)+'/'+PadDigits(lsDate.getUTCHours(),2)+':'+PadDigits(lsDate.getUTCMinutes(),2)+':'+PadDigits(lsDate.getUTCSeconds(),2);
	return strDate;
}

// utility function to retrieve an expiration date in proper
// format; pass three integer parameters for the number of days, hours,
// and minutes from now you want the cookie to expire (or negative
// values for a past date); all three parameters are required,
// so use zeros where appropriate
function getExpDate(days, hours, minutes) {
    var expDate = new Date( );
    if (typeof days == "number" && typeof hours == "number" && 
        typeof hours == "number") {
        expDate.setDate(expDate.getDate( ) + parseInt(days));
        expDate.setHours(expDate.getHours( ) + parseInt(hours));
        expDate.setMinutes(expDate.getMinutes( ) + parseInt(minutes));
        return expDate.toGMTString( );
    }
}
   
// utility function called by getCookie( )
function getCookieVal(offset) {
    var endstr = document.cookie.indexOf (";", offset);
    if (endstr == -1) {
        endstr = document.cookie.length;
    }
    return unescape(document.cookie.substring(offset, endstr));
}
   
// primary function to retrieve cookie by name
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 "";
}
   
// store cookie value with optional details as needed
function setCookie(name, value, expires, path, domain, secure) {
    document.cookie = name + "=" + escape (value) +
        ((expires) ? "; expires=" + expires : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

//Form entry functions
function doEntry() {
	var args = getArgs(); 
	var entryDate = getCookie("entryDate");
	var siteID = getCookie("siteID");

	//Set Cookie
	if (args.siteID != '' && args.siteID != null) {
		if (args.siteID != siteID) {
			siteID = args.siteID;
			entryDate = getUTC();
			setCookie("siteID",args.siteID,getExpDate(730,0,0));
			setCookie("entryDate",entryDate,getExpDate(730,0,0));
		}	
	}
	
	//Set form values
	document.getElementById('siteID').value = siteID;
	document.getElementById('entryDate').value = entryDate;
}

//Home Page Functions
function doLanding() {
	var args = getArgs(); 
	var entryDate = getCookie("entryDate");
	var siteID = getCookie("siteID");

	//Set Cookie
	if (args.siteID != '' && args.siteID != null) {
		if (args.siteID != siteID) {
			siteID = args.siteID;
			entryDate = getUTC();
			setCookie("siteID",args.siteID,getExpDate(730,0,0));
			setCookie("entryDate",entryDate,getExpDate(730,0,0));
		}	
	}
}
//-->