// 
//	TYGR Productions Interactive Statistics
//	
//	This file contains JavaScript support functions for TYGR Productions' Interactive Statistics.  The code contained herein
//  is NOT in the public domain.  This file is provided for download to personal computers and is only authorized for personal 
//  use in conjuction with TYGR Productions' Interactive Statistics.  Copying or reposting this file in whole or in part on 
//  any web server or other network server, or reusing any portion of the code is not allowed without express written consent 
//  of the author.  Any commercial use is strictly prohibited.
//	
//	Copyright (c) 2005 by Jon T. Camp.  All rights reserved.
// 
function getCookieData(cName) 
{
	var cookieData = document.cookie;
	var cNameValuePair;
	var cValue;
	var nEq;
	var nSemi = 0;
	var nStart = 0;
	var nLength = cookieData.length;

	while (nStart < nLength) 
	{
		if ((nSemi = cookieData.indexOf(";", nStart)) == -1) nSemi = nLength;
		cNameValuePair = (cookieData.substr(nStart, nSemi - nStart)).replace(/ /g, "");

		if ((nEq = cNameValuePair.indexOf("=")) > 0) 
		{
			if ((cNameValuePair.substr(0, nEq)).replace(/ /g, "") == cName) 
			{ 
				return (cNameValuePair.substr(nEq + 1, nSemi)).replace(/ /g, "");
			}
		}
		
		nStart = nSemi + 1;
	}
	
	return "";
}

function setCookieData(cName, cData) 
{
	var expires = new Date();
	expires.setTime(expires.getTime() + (5*365*24*60*60*1000));
	var cData = cName + "=" + cData + "; expires=" + expires.toGMTString();
	document.cookie = cData;
}
