//-----------------------------------------------------------------------------
// global javascript
//-----------------------------------------------------------------------------
// Use of this code is governed in accordance with the terms and conditions of
// the agreement executed between the Client and Tag New Media. It is intended
// for use on the ISC site only.
//
// © Copyright Tag New Media 2007. All Rights Reserved. 
//-----------------------------------------------------------------------------


//-----------------------------------------------------------------------------
// cookies
//-----------------------------------------------------------------------------
function CreateCookie(name, value, days) {
	//create a client-side cookie
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	} else {
		var expires = "";
	}
	document.cookie = name+"="+value+expires+"; path=/";
}

function ReadCookie(name) {
	//get the value from a cookie
	var ca = document.cookie.split(';');
	var nameEQ = name + "=";
	for(var i=0; i < ca.length; i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1, c.length); //delete spaces
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
	}
	return null;
}

function EraseCookie(name) {
	//delete a cookie
	createCookie(name, "", -1);
}
