// businessID and general calendar settings
var businessID = "6d7519"; // enter businessID provided by StrictManager.com


document.getElementById('postCode').focus();

function checkPostCode(optionalVal){
	
var postCode = document.getElementById('postCode').value;
var optionalVal = document.getElementById('optionalVal').value;
postCode = postCode.trim();
if(postCode.length > 0){
var xmlhttp = new XMLHttpRequest();
//var url = "http://strictmanager.com/busav/avail.php?id="+businessID+"&date="+date;
var url = "https://www.strictmanager.com/busav/checkPostCodes.php?id="+businessID+"&postCode="+postCode;

xmlhttp.onreadystatechange = function() {
	if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
	var myRes = JSON.parse(xmlhttp.responseText);
	if(myRes=='Y'){
	
	window.location.href = "http://capitalmaid.com/getQuote.html?postCode="+postCode+"&optionalVal="+optionalVal;
	}else if(myRes=='N'){
	document.getElementById('messageDiv').innerHTML = "Unfortunately we don't service this area!";
	}else{
	document.getElementById('messageDiv').innerHTML = "Couldn't verify information, try later!";
	}
	}

}
xmlhttp.open("GET", url, true);
xmlhttp.send();
}else{
	document.getElementById('messageDiv').innerHTML = "Please enter post code!";
	
}
}




function handleKeyPress(e){
 var key=e.keyCode || e.which;
  if (key==13){
     checkPostCode();
  }
}


