var ImgsArray = new Array();
ImgsArray[0] = "wasser.jpg";
ImgsArray[1] = "images/logo.gif";
ImgsArray[2] = "images/text_logo_blau.gif";
ImgsArray[3] = "images/text_logo_blau_aktuell.gif";
ImgsArray[3] = "images/listsymbol.png";
function preloadImgs(){
  for (i=0; i < ImgsArray.length; i++){
    var img = new Image();
    img.src = ImgsArray[i];
  }
}
preloadImgs();

function bg_img_resize(){
	var w = $(window).width();
	var h = $(window).height();

	var win_width = w;
	var win_height = h;

	var iw = parseInt( $('#background img').attr('width') );
	var ih = parseInt( $('#background img').attr('height') );
	var rw = iw / ih;
	var rh = ih / iw;
	var sc = h * rw;

	if (sc >= w) 
	{
		nh = h;
		nw = sc;
	} 
	else 
	{
		sc = w * rh;
		nh = parseInt(sc);
		nw = parseInt(w);
	}
	
	$('#background').css({height: h, width: w});
	$('#background img').css({height: nh, width: nw});
	w_ = '992px'; 
	t_ = '-10px'; 
	w__ = '1076px'; 
	t__ = '0px'; 
	if(w <= 1075){
		$('#main-container').css({width:w_});
		$('#main-container').css({top:t_});
	}
	else{
		$('#main-container').css({width:w__});
		$('#main-container').css({top:t__});
	}
}
	
$(window).resize(function()
{
	bg_img_resize();
});
