<!--
/* This code is Copyright (c) 1996 Nick Heinle and Athenia Associates, 
 * all rights reserved. In order to receive the right to license this 
 * code for use on your site the original code must be copied from the
 * Web site webreference.com/javascript/. License is granted to user to 
 * reuse this code on their own Web site if and only if this entire copyright
 * notice is included. Code written by Nick Heinle of webreference.com.
 */

function getCookie (name) {
var dcookie = document.cookie; 
var cname = name + "=";
var clen = dcookie.length;
var cbegin = 0;
        while (cbegin < clen) {
        var vbegin = cbegin + cname.length;
                if (dcookie.substring(cbegin, vbegin) == cname) { 
                var vend = dcookie.indexOf (";", vbegin);
                        if (vend == -1) vend = clen;
                return unescape(dcookie.substring(vbegin, vend));
                }
        cbegin = dcookie.indexOf(" ", cbegin) + 1;
                if (cbegin == 0) break;
        }
return null;
}

//---------------------------------------------------------------
// SetCookieEZ - Quickly sets a cookie which will last until the
//               user shuts down his browser
//---------------------------------------------------------------
function setCookieEZ(name, value) {
document.cookie = name + "=" + escape(value);
}

//---------------------------------------------------------------
// setCookie - sets a persistent cookie 
//---------------------------------------------------------------
function setCookie (name, value, expires) {
        if (!expires) expires = new Date();
document.cookie = name + "=" + escape (value) + 
"; expires=" + expires.toGMTString() +  "; path=/";
}

function delCookie (name) {
var expireNow = new Date();
document.cookie = name + "=" +
"; expires=Thu, 01-Jan-70 00:00:01 GMT" +  "; path=/";
}

function getTC() {
var qstring=window.location.search;
var qindex=0;
var gamenum=1;
var startindex;
var endindex;
startindex=qstring.indexOf("tc=");
if (startindex != -1)
  {
    endindex=qstring.indexOf("&",startindex+3);
	if (endindex == -1)
	{
	  endindex = qstring.length-startindex+1;
	}
    tc=qstring.substring(startindex+3,endindex);
	return tc;
  }
  return null;
}
// -->

