
function writecookie() {

	if (window.navigator.cookieEnabled) {
		if (document.cookie.indexOf("RedditchIDRan=")==-1){

		var the_cookie = "RedditchIDRan=" + Math.round(Math.random()*999999999999999999);
		var expiry_date = new Date("December 31, 2050");
		var mod_date = expiry_date.toGMTString();
		the_cookie = the_cookie + ";expires=" + mod_date + ";path=/";
		document.cookie = the_cookie;
		}
	}
}

function readcookie() {

	if (window.navigator.cookieEnabled) {
		var the_cookie = document.cookie; 

		if (the_cookie != "") {
			var pos = the_cookie.indexOf("RedditchIDRan="); 
			if(pos != -1) {
				var start = pos + 9; 
				var end = the_cookie.indexOf(";", start); 
				if(end == -1) { end = the_cookie.length; }
				var Redditch_cookie_value = the_cookie.substring (start, end); 
			}
			return (Redditch_cookie_value); 
		}
	}
	else {
		return (0);
	}
}
