function check_availability(){
	
	var formObject =  dojo.formToObject(window.document.forms[0]);
	var uri = "product_availability.php";
	//Assemble the new uri with its query string attached.
  	var queryStr = dojo.objectToQuery(formObject);
  	var fulluri = uri + "?" + queryStr;
	//var queryStr = dojo.toJson(formObject, true);
	//alert(fulluri);
	//dojo.byId("availability").innerHTML = fulluri;
	//Look up the node we'll stick the text under.
    var targetNode = dojo.byId("availability");
	var data = "";
    //The parameters to pass to xhrGet, the url, how to handle it, and the callbacks.
    var xhrArgs = {
      url: uri,
      handleAs: "text",
      preventCache: true,
      load: helloCallback,
      content: formObject,
      error: helloError
    }
    //Call the asynchronous xhrGet
    var deferred = dojo.xhrGet(xhrArgs);
}

function helloCallback(data,ioArgs) {
	//alert(data);
	dojo.byId("availability").innerHTML = data;
	if(data == "Out Of Stock"){
		document.getElementById("cartbtn").disabled = true;
	} else {
		document.getElementById("cartbtn").disabled = false;
	}
}
function helloError(data, ioArgs) {
	alert('Error when retrieving data from the server!');
}