function getexpirydate(nodays){
	var UTCstring;
	Today = new Date();
	nomilli=Date.parse(Today);
	Today.setTime(nomilli+nodays*24*60*60*1000);
	UTCstring = Today.toUTCString();
	return UTCstring;
}
function getcookie(cookiename) {
	 var cookiestring=""+document.cookie;
	 var index1=cookiestring.indexOf(cookiename);
	 if (index1==-1 || cookiename=="") return ""; 
	 var index2=cookiestring.indexOf(';',index1);
	 if (index2==-1) index2=cookiestring.length; 
	 return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
}
function setcookie(name,value){
	cookiestring=name+"="+escape(value)+";EXPIRES="+ getexpirydate(365)+";PATH=/";
	document.cookie=cookiestring;
}
function toggleEntry(cat) {
	var catEntry = "cat_"+cat;
	var collapseLink = cat;

	if (document.getElementById(catEntry).style.display == 'block') {
		document.getElementById(catEntry).style.display = "none";
		document.getElementById(collapseLink).className = "cat_plus";
		setcookie(catEntry, "0");	
	} else {
		document.getElementById(catEntry).style.display = "block";
		document.getElementById(collapseLink).className = "cat_min";
		setcookie(catEntry, "1");	
	}
}
