// Pops up a registration page if the user doesn't have the 
// registration cookie
function showRegForm() {

	// The cookie name
	var cookieName = "supportRegCookie";

	// The registration form URL
	var url = "/taisisd/indmed/support/downloads/registration_dl.html";	

	// Look for the registration cookie
	// Display the reg form if its not there
	var cookieValue = readCookie(cookieName);
	if (cookieValue == null) {
		x = window.open(url,"details","scrollbars=yes,screenX=0,left=0,screenY=0,top=0,width=625,height=550,resizable=no");
		return false;
	}

}

// Sets the registration cookie
function setRegCookie() {

	var cookieName = "supportRegCookie";
	var cookieURL = "/taisisd/indmed/support";
	var daysToExpire = 120;
	var cookieValue = "Registered";
	var cookieDomain = "toshiba.com";

	// Calcuate the expiration date
	var expDate = new Date(); 
	expDate.setTime(expDate.getTime() + (daysToExpire * 24 * 60 * 60 * 1000));

	document.cookie = cookieName + "=" + escape (cookieValue) + 
		"; expires=" + expDate.toGMTString() + "; path=" + cookieURL +
		"; domain=" + cookieDomain;
}

function readCookie(name) {

	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

