function show_plaque(b) {
    if ($("#plaque_message").val() != null) {
        var c = $("#plaque_message").val();
        var a = $("input[@id='plaque']:checked").val()
    }
    if (a == "yes") {
        $("#price").html(b + '<span id="added"> (+ $15.00 for Plaque)</span>')
    } else {
        $("#price").html(b)
    }
}
function show_loading(a, b) {
    $("#" + a).html('<font face="Verdana" size="2"><img src="js/loading.gif">' + b + "</font>")
}
function add2db(q, d, g, a, k, n, j, f, l, i, p, m, e, c, pc) {
    var b = "scripts/sport_frame.php";
    b = b + "?style=" + d + "bg=" + g + "&r=" + a + "&action=add2cart&price=" + k + "&width=" + n + "&height=" + j + "&cn=" + l + "&size=" + q + "&num=" + i + "&color2=" + p + "&color3=" + m + "&pl=" + e + "&plmsg=" + c + "&pcolor=" + pc;
    b = b + "&sid=" + Math.random();
    if (f == "add") {
        show_loading("result1", "Adding to Cart...");
        $.get(b, function (h) {
            url2 = "?file=addtocart&iproduct_id=" + h + "&icat_id=1247&action=addtocart";
            parent.location.href = url2
        })
    } else {
        show_loading("result1", "Redirecting to Frame it!...");
        $.get(b, function (h) {
            b = "index.php?file=frame_default&iproduct_id=" + h + "&icat_id=1247&ret_cat_id=1247";
            parent.location.href = b
        })
    }
}
function changeColor(c, g, a, h, f, e, j) {
    var d = $("#size").val();
    if (d !== undefined && d != "") {
        show_loading("price", "Calculating Price...");
        var i = "scripts/sport_frame.php";
        i = i + "?style=" + c + "&action=GetPrice&r=" + a + "&size=" + d + "&num=" + h + "&c=" + e + "&c2=" + f + "&c3=" + g;
        i = i + "&sid=" + Math.random();
        $.get(i, function (k) {
            show_plaque(k)
        })
    }
    show_loading("result", "Changing Color...");
    var b = "scripts/sport_frame.php";
    b = b + "?bg=" + g + "&r=" + a + "&style=" + c + "&action=step2B&num=" + h + "&bg2=" + f + "&bg3=" + e + "&t=" + j;
    b = b + "&sid=" + Math.random();
    $.get(b, function (k) {
        $("#result").html(k);
        $("img.dropshadow").wrap("<div class='wrap0'><div class='wrap1'><div class='wrap2'><div class='wrap3'></div></div></div></div>")
    })
}
function step2(d, e, b, c) {
    $("#style_type").val(c);
    num = 1;
    if (c == "double") {
        $("#trcolor2").show();
        num = 2
    }
    if (c == "shadow") {
        $("#trcolor").show();
        $("#trcolor2").show();
        $("#color2").prepend('<option value="">None</option>');
        num = 3
    }
    var a = "scripts/sport_frame.php";
    a = a + "?style=" + d + "&action=step2A&r=" + e + "&t=" + b + "&num=" + num + "&type=" + c;
    a = a + "&sid=" + Math.random();
    show_loading("result", "Updating...");
    $.get(a, function (h) {
        $("#result").html(h);
        var g = 2;
        $("#s_left").show();
        $("back-button").show()
    });
    $("#style_id").val(d);
    var f = "scripts/sport_frame.php";
    f = f + "?style=" + d + "&action=GetOptions&r=" + e;
    f = f + "&sid=" + Math.random();
    show_loading("sizes_dropdown", "Loading Available Sizes...");
    $.get(f, function (g) {
        $("#sizes_dropdown").html(g)
    })
}
function getInfo(b, j, a, f, h, i, d) {
    var c = "scripts/sport_frame.php";
    c = c + "?style=" + b + "&action=GetPrice&r=" + a + "&size=" + j + "&num=" + f + "&c3=" + h + "&c2=" + i + "&c=" + d;
    c = c + "&sid=" + Math.random();
    show_loading("price", "Calculating Price...");
    $.get(c, function (k) {
        show_plaque(k)
    });
    var g = "scripts/sport_frame.php";
    g = g + "?style=" + b + "&action=GetSize&r=" + a + "&size=" + j;
    g = g + "&sid=" + Math.random();
    show_loading("rsize", "Calculating Mat Size...");
    $.get(g, function (k) {
        $("#rsize").html(k)
    });
    var e = "scripts/sport_frame.php";
    e = e + "?style=" + b + "&action=GetSize&pft=1&r=" + a + "&size=" + j;
    e = e + "&sid=" + Math.random();
    $.get(g, function (k) {
        if (k.search(/none/i) != -1) {
            $("#frameitbutton").hide();
            $("#buttoninfo").html("<u>Framing is not available for this item.</u>")
        } else {
            $("#frameitbutton").show();
            $("#buttoninfo").html("")
        }
    })
};
