 $(function() {
	
	$("#header").hide();
	$("#text_block").hide();
	$("#globalNav ul").hide();
	$(".front_img").hide();
	$("#address").hide();
	
});

function performAnimation () {
	$(document).ready(function(){
      $("#header").customFadeIn(1000, function() {$("#text_block").customFadeIn(1000, function() {$("#globalNav ul").customFadeIn(1000, function () { $(".front_img").customFadeIn(1000, function () { $("#address").customFadeIn(1000);} );} );} );} ); });
};

function randomNumber(limit){
  return Math.floor(Math.random()*limit);
};

function randomImage(imgArr)
{
 	var imgSrc, imgW, imgH, r;
 	var url, height, width;
 	r = randomNumber(imgArr.length / 3);
 	imgSrc = imgArr[r * 3];
 	imgW = imgArr[(r * 3)+1];
 	imgH = imgArr[(r * 3)+2];
 	preload_image_object = new Image();
 	preload_image_object.src = imgSrc;
 	url = "url("+imgSrc+")";
 	width = imgW + "px";
 	height = imgH + "px";

	document.write('<style>.front_img {background:transparent url('+imgSrc+') no-repeat scroll 0 0; width:'+imgW+'px; height:'+imgH+'px;}</style>');

	if ($(".front_img").complete) {
		performAnimation();
	} else {
		$(".front_img").bind('load', performAnimation());
	}
};

