// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

// Show "Loading"" spinner during every Ajax request
Ajax.Responders.register({
	onCreate: function() {
	   if($('spinner') && (Ajax.activeRequestCount > 0)) Element.show('spinner');
    },
	onComplete: function() {
	   if($('spinner') && (Ajax.activeRequestCount == 0)) {
	       setFullHeight(); 
	       Element.hide('spinner');
       }
   }
});

// Stretch all elements of class "fullheight" to full page height
Event.observe(window, 'load', setFullHeight, false);
function setFullHeight() {
    $$('.fullheight').each(function(e) {
        Element.setStyle(e, {height: document.body.scrollHeight + 'px'});
    });
}
