 

window.onload = function() {
	
	
	
	available_result();//return the result when the page is loaded
		
	return false;
	
	
}

function available_result() {
	
	new Ajax.Updater('availability','http://www.staddlescottage-lavenham.co.uk/index.php/prices/availability/',
		{method: 'post', evalScripts:true, onCreate : startLoading, onComplete : stopLoading});
	
}

function get_prices($date) {
	
	new Ajax.Updater('prices','http://http://www.staddlescottage-lavenham.co.uk/index.php/prices/getprices/'+$date+'/',
		{method: 'post', evalScripts:true, onCreate : startLoading, onComplete : stopLoadingPrice});
	
}




function startLoading() {
    loaded = false;
    window.setTimeout('showLoadingImage()', 1000);
}
  
  
function showLoadingImage() {
	if (!loaded)
	{
	    new Effect.Appear('wait');
	}
}
  
function stopLoading() {
    Element.hide('wait');
    loaded = true;
    new Effect.Appear('availability');
  }
 
  function stopLoadingPrice() {
    Element.hide('wait');
    loaded = true;
 
  }