(function($) {	

	//same as $(document).ready();
	$(function() {
	
	$('#bg').fadeIn(1000);
				
	$(window).resize(function() {
	
	//BUG!!! Firefox won't give jQuery's height()
	var ua = $.browser;
	
	if(ua.mozilla){
	  var win_width = window.innerWidth;
	  var win_height = window.innerHeight;
	}
	else {
	  var win_width = $(window).width();
	  var win_height = $(window).height();
	}
	
	//resize background
	$('#bg').css({'width': win_width, 'height': win_height});
	resize_background();	
	
});
	
	
////////////////////////////////////////////////////////
// FUNCTION: Resize Background
////////////////////////////////////////////////////////

function resize_background() {
	var elem = "#bg";
	
	w = $(elem).width();
	h = $(elem).height();

	var ow = $(item).width();
	var oh = $(item).height();
	
	if (ow / oh > w / h) {
		var scale = h / oh;
		$(item).attr({'width':ow * scale,'height':oh * scale});
	} else {
		var scale = w / ow;
		$(item).attr({'width':ow * scale,'height':oh * scale});
	}
	$(item).css({'left':-(($(item).width()-w)/2),'top':-(($(item).height()-h)/2)});
}



	
});


	$(window).bind("load", function() {
	
	});
	
})(jQuery);


