/* Suwate Create on August 23, 2010 */ 
function getQuantity( productCode, elementId  )
{
	if ( productCode == "" ) 
	{
		document.getElementById( elementId ).innerHTML = "";
		return;
	} 
 
	var xmlhttp;
 
	if ( window.XMLHttpRequest )
	{// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp = new XMLHttpRequest();
    }
    else
    {// code for IE6, IE5 or older
		var XmlHttpVersions = new Array( "Microsoft.XMLHTTP", "MSXML2.XMLHTTP.6.0", "MSXML2.XMLHTTP.5.0"
									   , "MSXML2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP");
		// Try every id until one works
		for (i = 0; i < XmlHttpVersions.length && !xmlhttp; i++)
		{
		  try
		  {
			// Try to create XMLHttpRequest object
			xmlhttp = new ActiveXObject(XmlHttpVersions[i]);
		  }
		  catch (e) {} // Ignore potential error
		}8/23/2010
	
		if(!xmlhttp)
		{
			return;  // Cannot create object end function
		}
	}
 
    xmlhttp.onreadystatechange = function()
								 {
									if  (xmlhttp.readyState==4 && xmlhttp.status==200 )
									{
										document.getElementById( elementId ).innerHTML = xmlhttp.responseText;
									}
								 }
	xmlhttp.open( "GET","/quantity.php?pd=" + productCode, true);
	xmlhttp.send();
}

// Overload function getQuantity to accept one parameter.
function getQty( productCode )
{
	getQuantity( productCode, productCode );  // User must declare an elementId name as ProductCode
}
