$(document).ready(function() {

	$("#blogBox").css("right","-600px").animate({
						'right':'-15px'
					},'slow');;
	
	
	 var layer = $('<div id="layer"></div>');
     $('body').prepend(layer);
     layer.css('background','url(http://www.ronixjapan.com/images/contents.png)');
     
		
	resizeBG();
     //maxWidth = $(window).width();
     //maxHeight = $(window).height();
     
        
        $(window).bind('resize', function () {
            resizeBG();
        });
        function resizeBG() {
        	
        	
        	
            //Define image ratio
            var ratio = 700 / 1059;

            var obj = document.getElementById("topImg");  //$("#bgX");
            imgSrc = obj.src;

            var aImg = new Image();

            aImg.src = imgSrc;

            //Gather browser and current image size
            var imagewidth = aImg.width;
            var imageheight = aImg.height;
            var browserwidth = $(window).width();
            var browserheight = $(window).height();
            var offset;
            //Resize image to proper ratio
            if ((browserheight / browserwidth) > ratio) {
                $("#topImg").height(browserheight);
                $("#topImg").width(browserheight / ratio);
                $("#topImg").children().height(browserheight);
                $("#topImg").children().width(browserheight / ratio);


            } else {
                $("#topImg").width(browserwidth);
                $("#topImg").height(browserwidth * ratio);
                $("#topImg").children().width(browserwidth);
                $("#topImg").children().height(browserwidth * ratio);
            }
            $("#topImg").children().css('left', (browserwidth - $("#topImg").width()) / 2);
            $("#topImg").children().css('top', (browserheight - $("#topImg").height()) / 2);
            
            $("#layer").css({
     		width:($("#topImg").width())+'px',
     		height:($("#topImg").height())+'px'});

         

           $('ul#homeSex').css('left', ($("#topImg").width() / 2) - 200);
            $('ul#homeSex').css('top', browserheight / 2);

        };
        
        
		
});
