function Background(fade){

	var element = $('.bg_img:visible');
	var elements = $('.bg_img');

	if(element.length>0){
		var marginLeft = '-'+parseInt(element.width()/2)+'px';
		var marginTop = '-'+parseInt(element.height()/2)+'px';
		
		elements.css('margin-left', marginLeft);
		elements.css('margin-top', marginTop);
		
		if(fade){
			if($.browser.msie){
				$('#background').css('visibility','inherit');
			}
			else{
				$('#content').animate({opacity: 1});
			}

			$('#background').animate({opacity: 1});
		}
	}
}

$(document).ready(function(){
	$('#background').css('opacity',0);
	if(!$.browser.msie){
		$('#content').css('opacity',0);
	}

	$('#logo').hover(function(){
		$(this).stop(true, true).fadeTo('normal',0.5);
	},function(){
		$(this).stop(true, true).fadeTo('normal',1);
	});
});

$(window).load(function(){
	Background(true);
});

$(window).resize(function(){
	Background(false);
});
