function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

function siteInit() {
	getLeftNav();
	getFooter();
}

function getFooter() {
	new Ajax.Request('/footer.html', {
	  method: 'get',
		onSuccess: function(transport) {
			$('footer').innerHTML = transport.responseText;
		}
  });
}

function getLeftNav() {
	$('leftCol').hide();
	new Ajax.Request('/leftnav.html', {
		method: 'get',
		onSuccess: function(transport) {
			$('leftCol').innerHTML = transport.responseText;
			new Effect.BlindDown('leftCol');
		},
		onFailure: function(transport) {
			$('leftCol').innerHTML = "<div>Error: " + transport.status + "</div>";
			new Effect.BlindDown('leftCol');
		}
  });
}

Function.prototype.bind = function(obj) {
  var method = this,
    temp = function() {
      return method.apply(obj, arguments);
    };
  return temp;
}

addLoadEvent(siteInit);