<!--
/* Simon Willison's addLoadEvent -- replaces the normal 'window.load = ...' allowing
you to stack multiple events on the page load event -- you can only have one event on 
'window.onload' - details @ http://www.sitepoint.com/blog-post-view.php?id=171578 */
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function destroycatfish() /* catfish closer function */
{
	var catfish = document.getElementById('catfish');
	catfish.parentNode.removeChild(catfish); /* clip catfish off the tree */
	document.getElementsByTagName('html')[0].style.padding= '0'; /* reset the padding at the bottom */
	return false; /* disable the link's 'linkiness' -- so it won't jump you up the top of the page */
}
function closelink() /* attach the catfish closer function to the link */
{
	var closelink = document.getElementById('closeme'); /* find the 'close this' link */
	closelink.onclick = destroycatfish; /* attach the destroy function to it's 'onclick' */
}
addLoadEvent(function() { 
	closelink();
	closeForever();
});

function closeForever() /* attach the catfish closer function to the link */
{
	var closeForever = document.getElementById('closeforever'); /* find the 'close forever' link */
	closeForever.onclick = savesettings;
	
}
addLoadEvent(function() { 
	closelink();
});


// Use this function to save a cookie
function setCookie(name, value, expires) {
    document.cookie = name + "=" + escape(value) + "; path=/" +
    ((expires == null) ? "" : "; expires=" + expires.toGMTString());
}

function savesettings() {
    var exp = new Date();
    // Set expiration date 365 days ahead
    exp.setTime(exp.getTime() + (1000 * 60 * 60 * 24 * 365));
    setCookie('catfish', 'catfish',    exp);
	
	var catfish = document.getElementById('catfish');
	catfish.parentNode.removeChild(catfish); /* clip catfish off the tree */
	document.getElementsByTagName('html')[0].style.padding= '0'; /* reset the padding at the bottom */

    return true;
}
-->

