var xmlHttp;

function getprice(c, b) {
    xmlHttp = GetXmlHttpObject();
    if (xmlHttp == null) {
        alert("Browser does not support HTTP Request");
        return
    }
    var a = "scripts/getprice.php";
    a = a + "?id=" + c + "&option=" + b;
    a = a + "&sid=" + Math.random();
    xmlHttp.onreadystatechange = priceChanged;
    xmlHttp.open("GET", a, true);
    xmlHttp.send(null)
}
function update_canvas_price(c, b) {
    xmlHttp = GetXmlHttpObject();
    if (xmlHttp == null) {
        alert("Browser does not support HTTP Request");
        return
    }
    var a = "scripts/update_canvas_price.php";
    a = a + "?id=" + c + "&t=" + b;
    a = a + "&sid=" + Math.random();
    xmlHttp.open("GET", a, true);
    xmlHttp.send(null)
}
function update_printing_price(b, c) {
    xmlHttp = GetXmlHttpObject();
    if (xmlHttp == null) {
        alert("Browser does not support HTTP Request");
        return
    }
    var a = "scripts/update_printing_price.php";
    a = a + "?id=" + b + "&type=" + c;
    a = a + "&sid=" + Math.random();
    xmlHttp.open("GET", a, true);
    xmlHttp.send(null)
}
function update_dim(d, a, c) {
    xmlHttp = GetXmlHttpObject();
    if (xmlHttp == null) {
        alert("Browser does not support HTTP Request");
        return
    }
    var b = "scripts/updatedimensions.php";
    b = b + "?id=" + d + "&w=" + a + "&h=" + c;
    b = b + "&sid=" + Math.random();
    xmlHttp.onreadystatechange = stateChanged;
    xmlHttp.open("GET", b, true);
    xmlHttp.send(null)
}
function stateChanged() {
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
        document.getElementById("new_dimensions").innerHTML = xmlHttp.responseText;
        document.getElementById("editpanel").style.display = "none";
        document.getElementById("editbutton").style.display = "block";
        if (document.getElementById("print")) {
            if (document.newuserupload.radio[0].checked) {
                option1()
            }
            if (document.newuserupload.radio[1].checked) {
                option2()
            }
            if (document.newuserupload.radio[2].checked) {
                option3()
            }
        }
    } else {
        document.getElementById("new_dimensions").innerHTML = '<font face="Verdana" size="2"><img src="js/loading.gif"> Updating...</font>'
    }
}
function priceChanged() {
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
        document.getElementById("pricing").innerHTML = xmlHttp.responseText;
        document.getElementById("editpanel").style.display = "none";
        document.getElementById("editbutton").style.display = "block";
        if (document.getElementById("print")) {
            if (document.newuserupload.radio[0].checked) {
                option1()
            }
            if (document.newuserupload.radio[1].checked) {
                option2()
            }
            if (document.newuserupload.radio[2].checked) {
                option3()
            }
        }
    } else {
        document.getElementById("pricing").innerHTML = '<font face="Verdana" size="2"><img src="js/loading.gif"> Calculating Price...</font>'
    }
}
function GetXmlHttpObject() {
    var a = null;
    try {
        a = new XMLHttpRequest()
    } catch (b) {
        try {
            a = new ActiveXObject("Msxml2.XMLHTTP")
        } catch (b) {
            a = new ActiveXObject("Microsoft.XMLHTTP")
        }
    }
    return a
};
