$(document).ready(function(){
    
    var iH= 1100;
    var iW= 4400;
    
    var ratio= ($(window).height()*100)/110000;
    
    
    var newH= $(window).height();
    var newW= parseInt(iW*ratio);
    var halfW= newW/2;
    var timer= 5;
    var safari= false;
    var windowWidth= $(window).width();

    if (windowWidth<=1024) {
        
        $('#menuList').css({width: windowWidth-20+'px'});
        $('#content').css({width: windowWidth-20+'px'});
        $('#facebook').css({marginRight: (479-(1044-windowWidth))+'px'});
        $('#rightButton').css({marginLeft: (924-(1044-windowWidth))+'px'});
    }
    
	$(document.body).css({backgroundSize: (parseInt(iW*ratio))+'px '+($(window).height())+'px'});
	$(document.body).css({backgroundPosition: '-'+(halfW-(windowWidth/2))+'px 0px'});
	
	
	$(window).resize(function(){
	    
	    ratio= ($(window).height()*100)/110000;
        newH= $(window).height();
        newW= parseInt(iW*ratio);
        halfW= newW/2;
	    
	    $(document.body).css({backgroundSize: newW+'px '+newH+'px'});
		$(document.body).css({backgroundPosition: '-'+(halfW-(windowWidth/2))+'px '+($(window).height()-newH)+'px'});
	});
	
	if (jQuery.browser['safari']) {
	    
	    safari= true;
	}
	
	if (jQuery.browser['msie'] && jQuery.browser['version']!='9.0')
	{
		$('#leftButton').remove();
		$('#rightButton').remove();
	}
	
	$('#leftButton').mouseover(function(){
		$(document.body).clearQueue();
	    $(document.body).stop();
		var time= parseInt($(document.body).css('backgroundPosition'))*-timer;
		$(document.body).animate({
		    backgroundPosition: '0px 0px',
		    WebkitTransition: 'top .5s'
		  }, time, 'linear');


	});
	
	$('#leftButton').mouseout(function(){
		$(document.body).clearQueue();
	    $(document.body).stop();
	});
	
	
	$('#rightButton').mouseover(function(){
		$(document.body).clearQueue();
	    $(document.body).stop();

		var width= newW-windowWidth;
		var time= (parseInt($(document.body).css('backgroundPosition'))+halfW)*timer;
		$(document.body).animate({
			    backgroundPosition: '-'+width+'px 0px',
			    WebkitTransition: 'top .5s'
		  }, time, 'linear');

	});
	
	$('#rightButton').mouseout(function(){
		$(document.body).clearQueue();
	    $(document.body).stop();
	});
	
	
	
});
