(function($){
    $.fn.extend({
        loader: function () {
		    return this.each(function() {
               	if (this.complete || this.readyState === 4) {
					$(this).parent().parent().addClass('loaded');
				} else {
					$(this).hide();
					$(this).load(function(){
						$(this).show();//.removeClass('load').addClass('loaded');
						$(this).parent().parent().addClass('loaded');
					}).error(function(){
						$(this).show();//.removeClass('load').addClass('loaded');
						$(this).parent().parent().addClass('loaded');
					});
				}
            });
        }
    }); 
})(jQuery);
$(function(){
	$(window).resize();
})
$(window).resize(function() {
	var content = $('div#content').height() + $('div#content').offset().top;
	var marginTop = Math.max($(window).height() - content - $('div#footer').outerHeight(), 30);
	$('div#footer').css({
		marginTop: marginTop
	})	
});
