function endreantall(antall, produktid) {
    if (antall == "blank") {
        window.document.getElementById("knapp"+produktid).value = "Du måste välja hur många du vill ha";
        window.document.getElementById("knapp"+produktid).disabled = true;
    }
    else {
        if (antall == 1) {
            window.document.getElementById("knapp"+produktid).value = "Lägg den här i kundvagnen";
        }
        else {
            window.document.getElementById("knapp"+produktid).value = "Lägg de här i kundvagnen";
        }
        window.document.getElementById("knapp"+produktid).disabled = false;
    }
}

function endreformat(formatid, produktid, kategori) {
    if (formatid == "blank") {
        if (kategori == 1) {
            document.getElementById("antall"+produktid).innerHTML = "<br /><br /><input type=\"submit\" name=\"submit\" style=\"width: 250px;\" value=\"Du måste börja med att välja storlek\" disabled=\"true\" />";
        }
        else {
            document.getElementById("antall"+produktid).innerHTML = "<br /><br /><input type=\"submit\" name=\"submit\" style=\"width: 250px;\" value=\"Du måste börja med att välja format\" disabled=\"true\" />";
        }
    }
    else {
        finnAntall(formatid, produktid);
    }
}

function finnAntall(formatid, produktid) {
    var xmlHttp;
    try {
        xmlHttp=new XMLHttpRequest(); //Firefox, Opera 8.0+, Safari
    }
    catch (e) {
        try {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); //Internet Explorer 6.0+
        }
        catch (e) {
            try {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); //Internet Explorer 5.5+
            }
            catch (e) {
                alert("Du beh?ver en nyare web-l?sare om du ska anv?nda v?r web-shop!");
                return false;
            }
        }
    }
    xmlHttp.onreadystatechange=function() {
        if(xmlHttp.readyState == 4) {
            document.getElementById("antall"+produktid).innerHTML=xmlHttp.responseText;
        }
        else {
            document.getElementById("antall"+produktid).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Vänta lite...";
        }
    }
    xmlHttp.open("GET","visprodukt_finnantall.php?formatid="+formatid+"&produktid="+produktid,true);
    xmlHttp.send(null);
}