// JavaScript Document
/* Stack up window.onload events using this function from Simon Willison - 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();
    }
  }
}

Ajax.Responders.register({
	onCreate: function() {
		if($('notification') && Ajax.activeRequestCount > 0)
			Effect.Appear('notification',{delay: 0.75, duration: 0.75, queue: 'end'});
	},
	onComplete: function() {
		if($('notification') && Ajax.activeRequestCount == 0)
			Effect.Fade('notification',{duration: 0.25, queue: 'end'});
	}
});

TestClass = Class.create();
TestClass.prototype = {
	initialize: function() {
		//nothing here
	},
	
	demoRequest: function() {
		var myAjax = new Ajax.Request('',{method: 'post',onComplete: this.handleRequest});	
	},
	
	handleRequest: function(originalRequest) {
		new Insertion.Bottom('content',originalRequest.responseText);
	}
}

var testClass = new TestClass();