function theRest(){
	var url = document.location.toString();	
		if (url.match('#')) {
			var offset = $("#comment-offset").offset();
			$.scrollTo( { top:(offset.top-20), left:0}, 400 );
		}
};

 $(function () {
        var img = new Image();
        $(img).load(function () {
            //$(this).css('display', 'none'); // .hide() doesn't work in Safari when the element isn't on the DOM already
            $('body').css({'background-image' : 'url(' + $(this).attr("src") + ')', 'background-repeat' : 'repeat-y', 'background-position' : 'center -55px'});
			secondImage();

        }).attr('src', 'http://www.girltalkhome.com/images/ui/bg.jpg');

});


secondImage = function() {

        var img = new Image();
        $(img).load(function () {
            //$(this).css('display', 'none'); // .hide() doesn't work in Safari when the element isn't on the DOM already
            $('#table').css({'background-image' : 'url(' + $(this).attr("src") + ')', 'background-repeat' : 'no-repeat', 'background-position' : 'top center'});

			$("#container").show();
	  		theRest();
            }).attr('src', 'http://www.girltalkhome.com/images/ui/sub.sprite.png');
  	}

$(document).ready(function() {
   $("#comments-link").click(function() {
		var offset = $("#comment-form").offset();
		$.scrollTo( { top:(offset.top-50), left:0}, 400 );
   });
});