function getCookie(cookieName)
{
  var results = document.cookie.match ( '(^|;) ?' + cookieName + '=([^;]*)(;|$)' );
  if (results) return ( unescape ( results[2] ) );
  else return null;
}

function setCookie (name, value, expY, expM, expD, path, domain, secure) {
  var cookieString = name + "=" + escape ( value );
  if (expY) {
    var expires = new Date ( expY, expM, expD );
    cookieString += "; expires=" + expires.toGMTString();
  }
  if(path) cookieString += "; path=" + escape (path);
  if(domain) cookieString += "; domain=" + escape (domain);
  if(secure) cookieString += "; secure";
  document.cookie = cookieString;
}

function makeToc() {
	// Constructs table of contents by looking for h3 and h4 tags,
	// listing their contents and linking to an anchor inserted at
	// the start of each
	var tocHtml='<div id="toc">In This Entry<ul>';
	var hElements=$("#article h3,#article h4");
	if (hElements.length>3) {

		for (i=0; i<hElements.length; i++) {
			heading=hElements.eq(i);
			if (heading.is('h3')) liClass='toc3'; else liClass='toc4';
			tocHtml+='<li class="'+liClass+'">';
			tocHtml+='<a href="#heading'+i+'">'+heading.html()+'</a>';
			heading.prepend('<a name="heading'+i+'"></a>');
		}
		tocHtml+='</ul></div>';

		$("div#articleStartExtras").html(tocHtml);
		//$("div.entryDate").css("display","block");
		$("div#articleStartExtras").css("visibility","visible");
		//$("div#articleStartExtras").show('slow');
	}
	return;
}