var request = false;
try {
	request = new XMLHttpRequest();
} catch (trymicrosoft) {
	try {
  	request = new ActiveXObject("Msxml2.XMLHTTP");
 	} catch (othermicrosoft) {
  	try {
    	request = new ActiveXObject("Microsoft.XMLHTTP");
   	} catch (failed) {
     	request = false;
   	}  
 	}
}

function getAmazonProductInfo() {
	var num = Math.random();
	var asin = document.getElementById("asin").value;
	asin = trimAll(asin);
 	var url = "/responseVerifyAmazon.php?asin=" + escape(asin) + "&rnd=" + escape(num);
 	request.open("GET", url, true);
 	request.onreadystatechange = updatePage;
 	request.send(null);
}

function updatePage() {
	if (request.readyState == 4) {
		if (request.status == 200) {
  	 	var response = request.responseText;
			document.getElementById("verify").innerHTML = response;
		}
	}
}
function trimAll(sString) {
	while (sString.substring(0,1) == ' ') {
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' ') {
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}