var ratio_w = 1560, ratio_h = 890, ratio = ratio_h / ratio_w, img_w = 0, img_h = 0;

function resize_background() {
    var win_w = $(window).width(), win_h = $(window).height();
    
    img_w = win_w;
    img_h = win_w * ratio;
    
    if (img_h < win_h) {
       img_h = win_h;
       img_w = img_h / ratio;
    }

    $('#background').width(img_w).height(img_h);
}

//http://jtauber.com/blog/2008/04/28/auto-scrolling_is_jquery/
//Thanks, James Tauber
function scrollTo(selector) {
	var targetOffset = $(selector).offset().top;
	if (isTouchDevice()) {
		$('html,body').animate({scrollTop: targetOffset}, 500);
	} else {
		$('#content').animate({scrollTop: targetOffset}, 500);
	}
}

function isTouchDevice() {
    return "ontouchstart" in window;
}

$(document).ready(function() {
	resize_background();
	
	$(window).resize(function() {
		resize_background();
	});
});
