$.fn.resizenow = function() {
  	return this.each(function() {

		var ratio = 768/1024;

		var imagewidth = $(this).width();
		var imageheight = $(this).height();
		var browserwidth = $(window).width();
		var browserheight = $(window).height();
		var offset;

		var newwidth = browserwidth - 420;
		var newheight = browserheight - 126 -30;

		if ((newheight/newwidth) > ratio){
		    $(this).height(newheight);
		    $(this).width(newwidth);
		    $(this).children().height(newheight);
		    $(this).children().width(newheight / ratio);
		} else {
		    /* $(this).height(newheight); */
		    $(this).height(newwidth * ratio);
		    $(this).width(newwidth);
		    $(this).children().height(newwidth * ratio);
		    $(this).children().width(newwidth);
		}

		return false;

	});
};

$(window).bind("resize", function(){
	$('#bg').resizenow();
});

jQuery(document).ready(function(){
	$('#bg').resizenow();
});




/*

function showNavBar() {
	var win_y = $(window).height();
	var scroll_y = $(window).scrollTop();
	$("#footer").css({ top: ((win_y - 30) + scroll_y) + "px" });
}
var showTimer = false;
function maybeShowNavBar(evt) {
if ( showTimer ) {
	clearTimeout( showTimer );
}
showTimer = setTimeout( showNavBar, 175 );
}
$(window).bind( "scroll", maybeShowNavBar );



window.onscroll = function() {
  document.getElementById('footer').style.top =
     (window.pageYOffset + window.innerHeight - 30) + 'px';
};

*/

