


$(document).ready(function() {
	startUp();
	
	$("#background img").fadeIn('slow', function() {
		$("#news_container").slideDown("slow", function() {
			$("#footer").show("slide", { direction: "down" }, 500,function(){
			});
		});
	});
	function changeBG(append_code){
		if ('standalone' in navigator && !navigator.standalone && (/iphone|ipod|ipad/gi).test(navigator.platform) && (/Safari/i).test(navigator.appVersion)) {
			$("#background img").hide();
			$("#background").empty();
			$("#background").append(''+append_code+'');
			$('#background img').load(function() {
				$("#background img").show();
			});
			bgResize();
		}else{
			$("#background img").fadeOut('slow', function() {
				$("#background").empty();
				$("#background").append(''+append_code+'');
				$('#background img').load(function() {
					$("#background img").fadeIn('slow');
				});
				bgResize();
			});
		}
	}
	function bgResize(){
		var bgwidth = $("#background img").width();
		var diffrence = $(window).width()/ bgwidth;
		$("#background img").width($(window).width());
		$("#background img").height($("#background img").height()*diffrence);
		//alert($("#background img").height()*diffrence);
		
		if($(window).height()>=$("#background img").height()){
			var bgheight = $("#background img").height();
			var diffrence = $(window).height()/ bgheight;
			$("#background img").width($("#background img").width()*diffrence);
			$("#background img").height($(window).height());
		}
	}
	$(window).resize(function() {
		bgResize();
	});
	function startUp(){
		bgResize();
	}
});
