google.load("jquery","1.4.2");

google.setOnLoadCallback(function(){
	
	$.ajaxSetup({async: false});
	$.getScript("js/jquery.innerfade.js");
	$.ajaxSetup({async: true});
	
	$.ajaxSetup({async: false});
	$.getScript("js/jquery.simplemodal.js");
	$.ajaxSetup({async: true});
	
	/*slideshowLists = new Array(4);
		
	slideshowOutput="<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" id=\"slideshowTable\">\n\t<tr>\n\t\t";
	
	for(ii=0;ii<4;ii++) {
		slideshowOutput+="\n\t\t<td><ul id=\"miniSlide"+ii+"\" class=\"miniSlideshow\">\n"+getNumbers()+"</ul></td>\n";
	}
	
	slideshowOutput+="</tr></table>";
	
	$("#topSlideshow").html(slideshowOutput);
	
	$("#slideshowTable td").click(function(){
										   
		alert($(this).html());

	});*/
	
	slideshowLists="\t<ul>\n";
	
	for(ii=1;ii<5;ii++) {
	
		slideshowLists+="\t\t<li><img src=\"images/headers/header"+ii+".jpg\"></li>\n";
		
	}
	
	slideshowLists+="\t</ul>\n";
	
	$("#topSlideshow").html(slideshowLists);
	
	$("#topSlideshow ul").innerfade({
									
		speed: "slow",
		animationType: "slide",
		timeout: "4000",
		type: "random"
									
	});
	
	$("#parkPhotos img").click(function(){
		
		$.modal("<center><img src=\""+$(this).attr("src")+"\" width=\"640\" style=\"margin: 20px 10px 10px 10px;border:3px solid #fff;\"></center>", {

			opacity: 35,
			containerCss:{
				height: 520,
				padding: 0,
				width: 680
			}
																					  
		});
		
	});
	
	
	/*
	
	$('ID or class of the element containing the fading objects').innerfade({
		animationtype: Type of animation 'fade' or 'slide' (Default: 'fade'),
		speed: Fadingspeed in milliseconds or keywords (slow, normal or fast)(Default: 'normal'),
		timeout: Time between the fades in milliseconds (Default: '2000'),
		type: Type of slideshow: 'sequence',
		'random' or 'random_start' (Default: 'sequence'),
		containerheight: Height of the containing element in any css-height-value (Default: 'auto'),
		runningclass: CSS-Class which the container get’s applied (Default: 'innerfade') }); 
	
	*/
	
	if($("#listingInfo").length>0) {
	
		$("#footer").css({
						 
			position: "relative",
			left: "-15px",
			top: "15px"
						 
						 })
		
	}
	
	//$(".regionPage .col1 a[href^=http]").replaceWith("<span>"+$(this).html()+"</span>");
	
});

function getNumbers() {

	temp = 0
	newnumber = 0
	lottery = new Array(16);
	randomNumbs="";

	for (i = 1; i < 17; i++) {
		lottery[i] = i
	}

	for (i = 1; i < 17; i++) {
		newnumber = (Math.random() * 16) + 1
		newnumber = parseInt(newnumber, 10)
		temp = lottery[i]
		lottery[i] = lottery[newnumber]
		lottery[newnumber] = temp
	}
	
	for (i = 1; i < 17; i++) {
		randomNumbs = randomNumbs + "\t\t\t<li><img src=\"images/headers/photo"+lottery[i]+".jpg\" width=\"245\" height=\"305\"></li>\n";
	}
	
	return randomNumbs;

}
