var xmldoc = false;

function getResponse()
{
	var message = xmldoc.getElementsByTagName("message").item(0).firstChild.nodeValue;
	alert(message);
}

function add_to_cart(product_id)
{
	var strURL	= "cart_funcs.php";
	if (document.getElementById('flavour_id'+product_id).value == -1)
	 {
		var flavour_id = 0;
	 } else {
		var flavour_id = document.getElementById('flavour_id'+product_id).options[document.getElementById('flavour_id'+product_id).selectedIndex].value;
	 }
	var query	= "action=add&product_id="+product_id+"&quantity="+document.getElementById('quantity'+product_id).value+"&flavour_id="+flavour_id;

    if (document.implementation && document.implementation.createDocument)
	{	// Firefox, Mozilla, Netscape
		xmldoc = document.implementation.createDocument("","doc",null);
		xmldoc.load(strURL+"?"+query);
		xmldoc.onload = getResponse;

	} else if (window.ActiveXObject) {	// IE
        xmldoc = new ActiveXObject("Microsoft.XMLDOM");
		xmldoc.async = false;
		xmldoc.load(strURL+"?"+query);
		getResponse();
    }
}