﻿function read_Cookie(cookieName)
{
	var name = cookieName + "=";
	var arrCookies = document.cookie.split(';');
	for(var i=0;i < arrCookies.length;i++)
	{
		var c = arrCookies[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(name) == 0) return unescape(c.substring(name.length,c.length));
	}
	return null;
}
	var time=new Date();
time.setTime(time.getTime()+365*24*60*60*1000);
document.cookie = "test=none; expires="+time.toGMTString()+ "; path=/; domain=" + document.domain;	
// if Get_Cookie succeeds, cookies are enabled, since the cookie was successfully created.
if ( read_Cookie('test') )
{
	//alert( 'cookies are currently enabled.' );
	// remove the test cookie
	document.cookie = "test=; path=/; domain=" + + document.domain + "; expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
// if the Read Cookie test fails, cookies are not enabled for this session.
else
{
	alert( 'Cookies are not currently enabled for ' + document.domain );
	window.location.href = "/globalhome/ErrorPages/cookieserror.html";
}

