<!-- 
// How many days shall the cookie live on your user's 
//    computer?

DaysToLive = 365;

// This function looks for a cookie with a specific name on the visitor's hard drive.
function GetCookie(name) {

// Start by assuming no cookie exists.
var cookiecontent = '0';
// The browser's cookies can hold data we're not interested in, all in one 
//     long string of characters. Thus, we need to find out where our specific
//     cookie begins and ends (provided the one we want actually exists).
//
// If any cookies are available ...
if(document.cookie.length > 0) {
	// Determine begin position of the cookie with the specified name.
	var cookiename = name + '=';
	var cookiebegin = document.cookie.indexOf(cookiename);
	// Initialize the end position at zero.
	var cookieend = 0;
	// If a cookie with the specified name is actually available ...
	if(cookiebegin > -1) {
		// Offset the begin position of the cookie by the lengh of the cookie name.
		cookiebegin += cookiename.length;
		// Determine the end position of the cookie.
		cookieend = document.cookie.indexOf(";",cookiebegin);
		if(cookieend < cookiebegin) { cookieend = document.cookie.length; }
		// Put the cookie into our own variable "cookiecontent".
		cookiecontent = document.cookie.substring(cookiebegin,cookieend);
		
		var value = parseInt(cookiecontent);
	}
	//If a cookie with the specified name is NOT available
	//The 2 'var value = 0' lines below were 'var value = 1', changed on Sept 27, 05.
	//The logic of the above comment is that the value should be set to false if the cookie doesn't exist.
	else {
		var value = 0;
		PutCookie(name,value);
	}
}
else {

	var value = 0;
	PutCookie(name,value);
}
	
// Return the value to the calling line of code.
return value;
}


//This function puts the cookie and reloads the webpage
function PutCookieReload(n,v){

//alert("Reloading Cookie");
PutCookie(n,v);
document.location.reload();
}



// This function puts the cookie on the visitor's hard drive.
function PutCookie(n,v) {

// Begin by assuming no expiration date is applicable.
var exp = '';
// If an expiration date is applicable, determine the future date 
//      and store the date in variable "exp" in the correct format.
if(DaysToLive > 0) {
	var now = new Date();
	then = now.getTime() + (DaysToLive * 24 * 60 * 60 * 1000);
	now.setTime(then);
	exp = '; expires=' + now.toGMTString();
}
// Put the cookie on the user's hard drive with path set to root 
//     and with any applicable expiration date.
document.cookie = n + '=' + v + '; domain=.rit.edu' + '; path=/' + exp;

//alert("cookie sent: " + n + "=" + v + '; domain=rit.edu' + '; path=/' + exp);
//alert(document.cookie);
  
}