function addToShoppingCart(product_code, product)
{
    // set the request url
    url = 'add_item.php';
    if (confirm('Plaats in winkelmandje:\n'+ product))
    {
        if (product_code != '')
        {
            // if it is not IE
            if (window.XMLHttpRequest)
            {
                req = new XMLHttpRequest();
                req.onreadystatechange = processReqChange;
                req.open("GET", url + '?ref=xml&product_id=' + product_code, true);
                req.send(null);
            }
            // if IE
            else if (window.ActiveXObject)
            {
                req = new ActiveXObject("Microsoft.XMLHTTP");
                if (req)
                {
                    req.onreadystatechange = processReqChange;
                    req.open("GET", url + '?ref=xml&product_id=' + product_code, true);
                    req.send();
                }
            }
        }
    }
    else
    {
        //alert('Het product: '+ product +' \nis NIET in uw mandje geplaatst');
    }

    // function if the request is done
    function processReqChange()
    {
        var product_name = product;
        // only if req shows "loaded"
        if (req.readyState == 4)
        {
            // only if "OK"
            if (req.status == 200)
            {
                showResult();
            }
            else
            {
                alert("There was a problem retrieving the XML data:\n" + req.statusText);
            }
        }
    }

    function showResult()
    {
        var numerOfItems = new Array();
        var totalPrice = new Array();

        var items = req.responseXML.getElementsByTagName("item");

        for (var i = 0; i < items.length; i++) {
            numerOfItems[i] = getElementTextNS("", "totalitems", items[i], 0);
            totalPrice[i] = getElementTextNS("", "price", items[i], 0);
        }
        obj_totalItems = document.getElementById('cartItems');
        obj_totalPrice = document.getElementById('cartPrice');

        tmp = obj_totalItems.innerHTML;

        obj_totalItems.innerHTML = numerOfItems;
        obj_totalPrice.innerHTML = '&euro; ' + totalPrice;

        if (tmp < numerOfItems)
        {
            //alert('Het product is toegevoegd aan uw winkelmandje');
            addToBasket(product_code);
        }
        else
        {
            alert('Het product: '+ product +'\n is al aanwezig in uw winkelmandje.\n\nProductaantallen kunt u in het winkelmandje aanpassen... ');
        }
    }

    function getElementTextNS(prefix, local, parentElem, index) {
        var result = "";
        if (prefix && isIE) {
            // IE/Windows way of handling namespaces
            result = parentElem.getElementsByTagName(prefix + ":" + local)[index];
        } else {
            result = parentElem.getElementsByTagName(local)[index];
        }
        if (result) {
            // get text, accounting for possible
            // whitespace (carriage return) text nodes
            if (result.childNodes.length > 1) {
                return result.childNodes[1].nodeValue;
            } else {
                return result.firstChild.nodeValue;
            }
        } else {
            return "n/a";
        }
    }
}