(function($){
  $.fn.shuffle = function() {
    return this.each(function(){
      var items = $(this).children();
      return (items.length)
        ? $(this).html($.shuffle(items))
        : this;
    });
  }

  $.shuffle = function(arr) {
    for(
      var j, x, i = arr.length; i;
      j = parseInt(Math.random() * i),
      x = arr[--i], arr[i] = arr[j], arr[j] = x
    );
    return arr;
  }
})(jQuery);

$(document).ready(function(){		
	$(window).load(function(){
		setInterval(function(){
			$('body')
			.animate( { backgroundColor: 'darkred' }, 1500)
			.animate( { backgroundColor: 'pink' }, 1500)
			.animate( { backgroundColor: 'purple' }, 1500)
			.animate( { backgroundColor: 'darkviolet' }, 1500)
			.animate( { backgroundColor: 'darkblue' }, 1500)
			.animate( { backgroundColor: 'blue' }, 1500)
			.animate( { backgroundColor: 'lightblue' }, 1500)
			.animate( { backgroundColor: 'bluegreen' }, 1500)
			.animate( { backgroundColor: 'seagreen' }, 1500)
			.animate( { backgroundColor: 'green' }, 1500)
			.animate( { backgroundColor: 'olive' }, 1500)
			.animate( { backgroundColor: 'khaki' }, 1500)
			.animate( { backgroundColor: 'rust' }, 1500)
			.animate( { backgroundColor: 'darksalmon' }, 1500)
			.animate( { backgroundColor: 'salmon' }, 1500);
		}, 0);
	});
	
	$(".link").click(function(){
		$("div#home").fadeOut();
		$("div#back").fadeIn();
		$("div#"+$(this).attr('id')).fadeIn();
	});

	$("#back").click(function() {
		$("div#home").fadeIn();
		$("div").not("div#home, div#content, div#distance, div#address, div#logo, div#bottom").fadeOut();
	});		
});
addEventListener('load', function() { setTimeout(hideAddressBar, 0); }, false);
function hideAddressBar() { window.scrollTo(0, 1); }
