document.observe('dom:loaded', function() {
	Loading.show();
	var buttons = Array('btnHome', 'btnSearch', 'btnFeatured', 
							  'btnOconeePage', 'btnAboutOconee', 'btnWeather', 
							  'btnGolf', 'btnMap', 'butAboutOconee', 
							  'butWeather', 'butGolf', 'butDining', 'btnRentals'
							  , 'btnContact')
	var loadScripts = new Array(
		function() {makeScriptReady(buttons)},
		loadFeaturedLinks,
		loadSearchLinks,
		loadRentalLinks,
		loadWeather,
		ie6DropDownSetup
	);
	while(loadScripts.length>0) {
		loadScripts.shift()();	
	}
	isLoaded();
});

showPage = new function() {
	var views = new Array('home', 'featured', 'search', 'oconeePage', 'aboutOconee', 'weather', 'golf', 'map', 'contact', 'rentals');
	function displayPage(ev) {
		var el = Event.element(ev);
		var page = el.id.substr(3,1).toLowerCase()+el.id.substr(4);
		for (var i=0; i<views.length; i++) {
			document.getElementById(views[i]).style.display = "none";	
		}
		$(page).style.display = "block";
	}
	return displayPage;
}

function ie6DropDownSetup() {
	if (document.all && !window.XMLHttpRequest) {
		$('btn4Holder').onmouseover=function() {
			$('oconeeDrop').style.display = "block";
 		}
		$('btn4Holder').onmouseout=function(){
			$('oconeeDrop').style.display = "none";
		}
 		$('oconeeDrop').onmouseover=function() {
  			$('oconeeDrop').style.display = "block";
 		}
		$('oconeeDrop').onmouseout=function() {
  			$('oconeeDrop').style.display = "none";
 		}
	}
} 

loadSearchLinks = new loadLinks('xml/searchLinks.xml', 'searchLinks');
loadFeaturedLinks = new loadLinks('xml/featuredLinks.xml', 'featuredLinks');
loadRentalLinks = new loadLinks('xml/rentalLinks.xml', 'rentalLinks');

function loadWeather() {
	new Ajax.Request('weather.html', {
			method: 'get',
			onComplete: function(oxhr) {
				document.getElementById('weather').innerHTML = oxhr.responseText;
			}
	});
}