/******************************************************************************/
/**
	GetBookingSlots - Function that generates an xml with the booking time slots based on the parameters selected by the user
*/
function GetBookingSlots(selecteddate,selectedday,bookingtime,bookingsize,bookingdetail) {	
	/*// Need to reset the Availablity Planner
	//ResetAvailablityPlanner();
	//XMLhttp variable will hold the XMLHttpRequest object
	var xmlhttp = false;
	// If the user is using Mozilla/Firefox/Safari/etc	
	if (window.XMLHttpRequest) {
			//Intiate the object
			xmlhttp = new XMLHttpRequest();
			//xmlhttp.setHeader("Cache-Control", "no-cache");
			//Set the mime type
			//xmlhttp.overrideMimeType('text/xml');
	}
	// If the user is using IE
	else if (window.ActiveXObject) {
			//Intiate the object
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			//xmlhttp.setHeader("Cache-Control", "no-cache");
			//Http.get(params, callback_args)
	}	
	//Calling 
	var url = 'getbookingslots.php?bookingdate='+selecteddate+'&bookingtime='+bookingtime+'&bookingsize='+bookingsize+'&selectedday='+selectedday;				
 	//return false;
	//Open the URL above "asynchronously" (that's what the "true" is for) using the GET method		
	xmlhttp.open('GET', url, true);
	//Check that the PHP script has finished sending us the result
	xmlhttp.onreadystatechange = function() {
		if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			//Replace the content of the "result" DIV with the result returned by the PHP script
			var response     = xmlhttp.responseText;								
			if(response){					
				//Split the response into dataarray
				//console.log("Response text" ,response);
 			}
		}
	} // end of function
	xmlhttp.send(null); */
	var booking=document.getElementById("bookdetail").value;		
	var timing=booking.split("$$");
	document.getElementById("bookingdate").value = timing[0];
	
	//alert(document.getElementById("bookingdate").value);
	//alert("selecteddate = " + selecteddate);
	if(document.getElementById("bookingdate").value && selecteddate!=document.getElementById("bookingdate").value){
			document.getElementById("bookid").value = 0;
	}
	 
 	document.getElementById("bookingdate").value = selecteddate;
	document.getElementById("bookingtime").value = bookingtime;
 	document.getElementById("bookingsize").value = bookingsize;
	document.getElementById("selectedday").value =selectedday ;
	document.getElementById("bookingdetail").value = bookingdetail;
 	
	//document.frmbook.action='booking-form.php?bookingdate='+selecteddate+'&bookingtime='+bookingtime+'&bookingsize='+bookingsize+'&selectedday='+selectedday+'&bookingdetail='+bookingdetail;
	document.frmbook.action='booking-form.php';
	document.frmbook.submit();
 }

function gotoCakePanel(){		
		document.frmbook.action="bookingprocess.php?from=cake";
		document.frmbook.submit();
}
/******************************************************************************/