/*///////////////////////// UNIVERSAL FUNCTIONS //////////////////////////////// */
function $(id){
	return document.getElementById(id);
}
	
/*//////////////////////////////////	SITE FUNCTIONS ////////////////////////////// */
function showCalendar(){
	if($('start_date_calendar').style.display=='block') {
			$('start_date_calendar').style.display='none';
	} else {
		$('start_date_calendar').style.display='block';
	}
}


function checkAvailability(date, weeks) {
		$('table_results').innerHTML='<img src="/images/calwaiting.gif" />';
		$('checking').style.display="block";
		var ajaxRequest;  // The variable that makes Ajax possible!
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var longstring = ajaxRequest.responseText;
				$('table_results').style.display='block';
				$('table_results').innerHTML = longstring;
		}
	}
	ajaxRequest.open("GET", "action/checkAvailability.php?date="+date+"&weeks="+weeks, true);
	ajaxRequest.send(null);
	$('checking').style.display="none";
}

function booknow(){
		$('booking_form').style.display='block'
		$('final_checkin_date').value = $('checkin').value+ " at 4 p.m."
		$('final_checkout_date').value = $('checkout').value+ " at 11 a.m."
		$('final_n_o_w').value = $('number_of_weeks').value
		$('final_price').value = $('price').value
		$('name').focus();
}

function cot(value){
	if(value!=""){
		$('cot').style.display="block";
	}
	else
	{
		$('cot').style.display="none";
	}
}

function agreeConditions(){
	if($('agree').checked) {
		$('booknow').disabled=false
	}
	else
	{
		$('booknow').disabled=true
	}
}