function createCookie(name,value,days) {
	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) {
	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;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function get_random(num)
{
    var ranNum= Math.floor(Math.random()*num);
    return ranNum;
}


// Note these two functions are not my code
// They are from http://www.websemantics.co.uk/tutorials/accessible_forms/scripts/forms.js
// Amazingly helpful, I hope the author won't mind

// help clicked therefore show help.
function showHelp(id){
	if (!document.getElementsByTagName) return
	if (document.getElementById(id).style.display=='block'){
		document.getElementById(id).style.display='none'
	}
	else{
		document.getElementById(id).style.display='block'
	}
	//  focus is moved by the href of the link to the start of the help
}


function hideHelp(id){
	if (document.getElementById) {document.getElementById(id).style.display='none'}
}

// Alias for showHelp
function showText(id){ showHelp(id) }