function resize() {
	var Background = document.getElementById( 'BackgroundImage' );
	if( Background ) {

		if( !Background.aspectRatio ) {
			if( Background.offsetWidth && Background.offsetHeight ) {
				Background.aspectRatio = Background.offsetWidth / Background.offsetHeight;
			} else {
				return;
			}
		}
		var Width = window.innerWidth || document.body.clientWidth;
		var Height = window.innerHeight || document.body.clientHeight;
		if( ( Width/Height) > Background.aspectRatio ) {
			Background.style.width = '100%';
			Background.style.height = '';
		} else {
			Background.style.width = '';
			Background.style.height = '100%';
		}
	} else {
		//No background ID found
	}
}

$( window ).bind( 'resize load', function() { 
	resize();
});
