var rc = SetCookie('testcookie','enabled');
var testcookie = GetCookie('testcookie');

if (testcookie == null || testcookie == '') 
{
	//var returnValue = confirm("Apparently, cookies are either turned off or not supported by your browser. HSB requires that you have a cookie-enabled browser to function. Would you like more information?");
	alert("Apparently, cookies are either turned off or not supported by your browser. \nHSB requires that you have a cookie-enabled browser to function. \nPress OK to see more information\n\nPlease close your browser and try to login to HSB again.");	
	//if (returnValue) 
	//{
		parent.location.href = 'cookies.asp';
	//}
}

function SetCookie (name, value) 
{
	//alert("We're initializing the cookie! hip hip horray!")
	document.cookie = name + "=" + escape(value) ;
	document.cookie.path = "/"
}

function GetCookie (name) 
{
	var result = "";

	try {		
			var myCookie = " " + document.cookie + ";";
			var searchName = " " + name + "=";
			var startOfCookie = myCookie.indexOf(searchName);
			var endOfCookie;
			
			if (startOfCookie != -1) 
			{
				startOfCookie += searchName.length;
				endOfCookie = myCookie.indexOf(";", startOfCookie);
				result = unescape(myCookie.substring(startOfCookie, endOfCookie));
			}	
		}
		
	catch (ex) 
		{	
			alert('Inside the Exception Handling Block');
			alert(ex.name);
			alert(ex.message);
		} 
		
	if (result != 'enabled')
	{
		//alert("cookie value=" + result);
		//alert("Please close your browser and try to login to HSB - Client Connection again.");
	}
	
	return result;
}
