function PushAllCookie() { /*my_history[1].push('sales.php');*/ setCookie("out_ring", img_out_ring.src.substring(img_out_ring.src.length - 6)), setCookie("inn_ring", img_inn_ring.src.substring(img_inn_ring.src.length - 6)), setCookie("grid", img_grid.src.substring(img_grid.src.length - 6)), setCookie("text_first_ring", $("#text_first_ring").val()), setCookie("text_two_ring", $("#text_two_ring").val()), setCookie("text_NAME", $("#text_NAME").val()), setCookie("text_INN", $("#text_INN").val()), setCookie("text_micro", $("#text_micro").val()), setCookie("x_Name", parseInt(document.getElementById("x-position-NAME").value)), setCookie("y_Name", parseInt(document.getElementById("y-position-NAME").value)), setCookie("font_value_INN", $("#font_value_INN").val()), setCookie("font_value_NAME", $("#font_value_NAME").val()), setCookie("font_strange_NAME", $("#font_strange_NAME").val()), setCookie("font_type_NAME", $("#font_type_NAME").val()), setCookie("img_clishe", ""), setCookie("price_clishe", check_price), "drei" == getCookie("last_step") ? setCookie("last_step", "first") : setCookie("last_step", "ein") } function MicroTextSwitch() { document.getElementById("out_04").className.indexOf("active") >= 0 ? show_on("microtext") : show_off("microtext") } function DrawTextById(t) { "" == document.getElementById(t).value ? (document.getElementById("without_" + t).value = " + ", document.getElementById(t).style.background = "#eee") : (document.getElementById("without_" + t).value = " − ", document.getElementById(t).style.background = "azure"), "text_micro" == t && MicroTextSwitch() } function PopAllCookie() { document.getElementById("text_first_ring").value = text_first_ring_TOV, document.getElementById("text_NAME").value = std_text_NAME, document.getElementById("text_INN").value = std_text_INN, document.getElementById("text_micro").value = std_text_micro, el = document.getElementById("out_" + start_out_ring), el.classList.remove("active"), el = document.getElementById("inn_" + start_inn_ring), el.classList.remove("active"), el = document.getElementById("inn_" + start_inn_ring), el.classList.remove("active"), loader && (temp_str = getCookie("out_ring").substring(0, 2), temp_str >= "01" && temp_str <= "04" && (start_out_ring = temp_str), temp_str = getCookie("inn_ring").substring(0, 2), temp_str >= "00" && temp_str <= "27" && (start_inn_ring = temp_str), temp_str = getCookie("grid").substring(0, 2), temp_str >= "00" && temp_str <= "30" && (start_grid = temp_str), document.getElementById("text_first_ring").value = getCookie("text_first_ring", text_first_ring_TOV), document.getElementById("text_two_ring").value = getCookie("text_two_ring", ""), document.getElementById("text_NAME").value = getCookie("text_NAME", std_text_NAME), document.getElementById("text_INN").value = getCookie("text_INN", std_text_INN), document.getElementById("text_micro").value = getCookie("text_micro", std_text_micro), "04" == start_out_ring && (el = document.getElementById("microtext"), el.setAttribute("display", "block"), el.style.display = "block")), img_out_ring.src = "../images/outer/out-ring_" + start_out_ring + ".png", el = document.getElementById("out_" + start_out_ring), el.classList.add("active"), img_inn_ring.src = "../images/inner/in-ring_" + start_inn_ring + ".png", el = document.getElementById("inn_" + start_inn_ring), el.classList.add("active"), img_grid.src = "../images/grid/grid_" + start_grid + ".png", "00" != start_grid && (el = document.getElementById("grd_" + start_grid), el.classList.add("active")), DrawTextById("text_two_ring"), DrawTextById("text_INN"), DrawTextById("text_micro"), $("#inn_ring").slick("slickGoTo", parseInt(start_inn_ring)), $("#grid").slick("slickGoTo", parseInt(start_grid) - 1) } function RestoreDriver() { if (loader) { switch (getCookie("font_value_INN", "normal")) { case "small": document.getElementById("font_value_INN").selectedIndex = 0; break; case "normal": document.getElementById("font_value_INN").selectedIndex = 1; break; case "big": document.getElementById("font_value_INN").selectedIndex = 2 } switch (getCookie("font_strange_NAME", "bold")) { case "normal": document.getElementById("font_strange_NAME").selectedIndex = 0; break; case "bold": document.getElementById("font_strange_NAME").selectedIndex = 1; break; case "bolditaly": document.getElementById("font_strange_NAME").selectedIndex = 2; break; case "italic": document.getElementById("font_strange_NAME").selectedIndex = 3; break; case "oblique": document.getElementById("font_strange_NAME").selectedIndex = 4 } switch (getCookie("font_value_NAME", "big")) { case "small": document.getElementById("font_value_NAME").selectedIndex = 0; break; case "normal": document.getElementById("font_value_NAME").selectedIndex = 1; break; case "big": document.getElementById("font_value_NAME").selectedIndex = 2 } switch (getCookie("font_type_NAME", "arial")) { case "arial": document.getElementById("font_type_NAME").selectedIndex = 0; break; case "times": document.getElementById("font_type_NAME").selectedIndex = 1; break; case "courier": document.getElementById("font_type_NAME").selectedIndex = 2; break; case "verdana": document.getElementById("font_type_NAME").selectedIndex = 3 } document.getElementById("y-position-NAME").value = getCookie("y_Name", 130) } else document.getElementById("font_value_INN").selectedIndex = 1, document.getElementById("font_strange_NAME").selectedIndex = 1, document.getElementById("font_value_NAME").selectedIndex = 2, document.getElementById("font_type_NAME").selectedIndex = 0, document.getElementById("y-position-NAME").value = 130 } function next_step() { for (var t = document.getElementById("example"), e = t.getContext("2d"), n = e.getImageData(0, 0, t.width, t.height), i = 0; i < n.data.length; i += 4) n.data[i + 2] > 230 && (n.data[i] = 0, n.data[i + 1] = 0, n.data[i + 2] = 0, n.data[i + 3] = 0); e.putImageData(n, 0, 0); var r = document.createElement("canvas"), o = r.getContext("2d"); r.width = 250, r.height = 250, o.drawImage(t, 0, 0, t.width, t.height, 0, 0, r.width, r.height), data = r.toDataURL(), data.replace("/+/g", " "), document.getElementById("id_sales_data").value = data, document.getElementById("id_sales_price").value = check_price, PushAllCookie() } loader = !1; var fontproperty = "", check_price = 0, start_out_ring = "01", start_inn_ring = "00", start_grid = "00"; text_first_ring_TOV = "", text_first_ring_FOP = "", std_text_two_ring = "", std_text_NAME = "", std_text_INN = "", std_text_micro = "", navigator.cookieEnabled || alert(""), $(function() { function t(t, e, n, i, r, o) { t.save(), t.translate(n, i), t.rotate(-Math.PI / 7), t.rotate(-1 * (o / e.length) / 2), strwidth = t.measureText(e).width, strlength = e.length, wordwidth = strwidth / strlength, chrwidth = 0, startangle = o / wordwidth / strlength; for (var _ = 0; _ < e.length; _++) { var a = e[_]; t.rotate(startangle * (.75 * chrwidth + .25 * t.measureText(a).width)), t.save(), t.translate(0, -1 * r), t.fillText(a, 0, 0), t.restore(), chrwidth = t.measureText(a).width } t.restore() } function e(t, e, n, i, r, o) { var _ = e.split(" "), a = _.length, g = "", l = 0; t.strokeStyle = "#f0f0f0", t.lineWidth = 6, t.lineJoin = "round", t.lineCap = "round"; for (var s = 0; a > s; s++) { var c = g + _[s] + " ", d = t.measureText(c).width; d > r ? (t.strokeText(g, n, i), t.fillText(g, n, i), g = _[s] + " ", i += o, l++) : g = c } return t.strokeText(g, n, i), t.fillText(g, n, i), l } function n() { check_price = 0, parseInt(document.getElementsByClassName("inn_ring active")[0].id.substring(4, 6)) > 0 && check_price++, 4 == parseInt(document.getElementsByClassName("out_ring active")[0].id.substring(4, 6)) & "" != document.getElementById("text_micro").value && check_price++, "00.png" != img_grid.src.substring(img_grid.src.length - 6) && check_price++, check_price = start_sales_price + add_sales_price[check_price], $("#price span").html(check_price.toString()) } function i() { loader = !0, RestoreDriver(loader), PopAllCookie(), a(), n() } function r() { switch (font_value_NAME = $("#font_value_NAME").val(), font_value_NAME) { case "small": addSize = 15; break; case "normal": addSize = 5; break; default: addSize = 0 } document.getElementById("x-position-NAME").value = 203, document.getElementById("y-position-NAME").value = 150 + addSize + 12 * (3 - NameLineCount) } var o = document.getElementById("example"), _ = o.getContext("2d"); text_first_ring = "", text_two_ring = "", text_Name = "", text_INN = "", text_micro = "", myImage = "", centerX_out_ring = 0, centerY_out_ring = 0, centerX_inn_ring = 60, centerY_inn_ring = 60, centerX_grid = 75, centerY_grid = 75, NameLineCount = 0, img_out_ring = new Image, img_inn_ring = new Image, img_grid = new Image, img_inn_ring.onload = function() { img_inn_ring.ZIndex = "55", "inn_ring" != last_redraw && a(), last_redraw = "inn_ring" }, img_grid.onload = function() { img_grid.ZIndex = "56", "grid" != last_redraw && a(), last_redraw = "grid" }, img_out_ring.onload = function() { "out_ring" != last_redraw && a(), last_redraw = "out_ring" }, "drei" == getCookie("last_step") ? (loader = confirm("", i), loader = !1) : loader = !0, RestoreDriver(), PopAllCookie(), last_redraw = ""; var a = function() { switch (_.clearRect(0, 0, _.canvas.width, _.canvas.height), "out_04" == document.getElementsByClassName("out_ring active")[0].id ? (text_micro = $("#text_micro").val(), img_out_ring.src = "../images/outer/out-ring_03.png", _.drawImage(img_out_ring, centerX_out_ring, centerY_out_ring, 400, 400), img_out_ring.src = "../images/outer/out-ring_04.png") : (text_micro = "", _.drawImage(img_out_ring, centerX_out_ring, centerY_out_ring, 400, 400)), _.fillStyle = "#f0f0f0", _.strokeStyle = "#f0f0f0", _.font = "bold 14px Arial ", _.textAlign = "left", text_first_ring = $("#text_first_ring").val(), text_two_ring = $("#text_two_ring").val(), text_NAME = $("#text_NAME").val(), text_INN = $("#text_INN").val(), "" == text_two_ring ? offset_first_ring = 0 : offset_first_ring = 8, "00.png" == img_inn_ring.src.substring(img_inn_ring.src.length - 6) ? offset_grid = 8 : offset_grid = 0, "00.png" != img_grid.src.substring(img_grid.src.length - 6) && _.drawImage(img_grid, centerX_grid - 8 * (offset_grid / 4 - 1), centerY_grid - 7 * (offset_grid / 4 - 1), 234 + 4 * offset_grid, 234 + 4 * offset_grid), _.drawImage(img_inn_ring, centerX_inn_ring, centerY_inn_ring + 2, 280, 280), text_micro_angle = text_micro.length / (4 * Math.PI), text_micro_angle > 2 * Math.PI && (text_micro_angle = 2 * Math.PI), text_first_ring_angle = text_first_ring.length / (3 * Math.PI), text_first_ring_angle > 2 * Math.PI && (text_first_ring_angle = 2 * Math.PI), text_two_ring_angle = text_two_ring.length / (3 * Math.PI), text_two_ring_angle > 2 * Math.PI && (text_two_ring_angle = 2 * Math.PI), t(_, text_micro, 201, 201, 187, text_micro_angle), _.fillStyle = "#88A4D6", _.strokeStyle = "#88A4D6", _.font = "bold 18px Arial ", t(_, text_first_ring, 201, 201, 156 + offset_first_ring, text_first_ring_angle), _.font = "bold 16px Arial ", t(_, text_two_ring, 200, 202, 144, text_two_ring_angle), font_value_INN = $("#font_value_INN").val(), font_value_INN) { case "small": _.font = "bold 16px Arial"; break; case "normal": _.font = "bold 20px Arial"; break; case "big": _.font = "bold 24px Arial" } switch (_.textAlign = "center", e(_, text_INN, 203, 275, 220, 30), fontproperty = "", font_value_NAME = $("#font_strange_NAME").val(), font_value_NAME) { case "bolditaly": fontproperty = "bold italic"; break; case "italic": fontproperty = "italic"; break; case "bold": fontproperty = "bold"; break; case "oblique": fontproperty = "oblique" } switch (font_value_NAME = $("#font_value_NAME").val(), font_value_NAME) { case "small": fontproperty += " 20px"; break; case "normal": fontproperty += " 24px"; break; case "big": fontproperty += " 28px" } switch (font_value_NAME = $("#font_type_NAME").val(), font_value_NAME) { case "arial": fontproperty += " Arial"; break; case "times": fontproperty += " Times"; break; case "courier": fontproperty += " Courier"; break; case "verdana": fontproperty += " Verdana" } _.fillStyle = "#88A4D6", _.strokeStyle = "#88A4D6", _.font = fontproperty, NameLineCount = e(_, text_NAME, parseInt(document.getElementById("x-position-NAME").value), parseInt(document.getElementById("y-position-NAME").value), 200, 30) }; $("#complete_order").click(function() { next_step() }), $(".out_ring").click(function() { img_out_ring.src = $(this).attr("src"), $(this).parent().parent().find(".active").removeClass("active"), $(this).addClass("active"), el = document.getElementById("microtext"), "out_04" == document.getElementsByClassName("out_ring active")[0].id ? document.getElementById("text_micro").value = std_text_micro : document.getElementById("text_micro").value = "", DrawTextById("text_micro"), a(), n() }), $(".inn_ring").click(function() { img_inn_ring.src = $(this).attr("src"), $(this).parent().parent().find(".active").removeClass("active"), $(this).addClass("active"), a(), n() }), $(".grid").click(function() { img_grid.src = $(this).attr("src"), $(this).parent().parent().find(".active").removeClass("active"), $(this).addClass("active"), a(), n() }), $("#without_text_micro").click(function() { "" != document.getElementById("text_micro").value ? document.getElementById("text_micro").value = "" : document.getElementById("text_micro").value = std_text_micro, DrawTextById("text_micro"), n(), a() }), $("#without_text_two_ring").click(function() { "" != document.getElementById("text_two_ring").value ? document.getElementById("text_two_ring").value = "" : document.getElementById("text_two_ring").value = std_text_two_ring, DrawTextById("text_two_ring"), a() }), $("#without_text_INN").click(function() { "" != document.getElementById("text_INN").value ? document.getElementById("text_INN").value = "" : document.getElementById("text_INN").value = std_text_INN, DrawTextById("text_INN"), a() }), $("#without_inn_ring").click(function() { try { $("#inn_ring").slick("slickGoTo", "00") } catch (e) {} $(".inn_ring.active").removeClass("active"), $(this).parent().parent().find("#inn_00").addClass("active"), img_inn_ring.src = "../images/inner/in-ring_00.png", check_price > 0 && (check_price -= 1), a(), n() }), $("#without_grid").click(function() { $(".grid.active").removeClass("active"), img_grid.src = "../images/grid/grid_00.png", a(), n() }), $("#tov").click(function() { document.getElementById("text_first_ring").value = text_first_ring_TOV, a() }), $("#fop").click(function() { document.getElementById("text_first_ring").value = text_first_ring_FOP, a() }), $("#text_micro").keyup(function() { DrawTextById("text_micro"), n(), a() }), $("#text_first_ring").keyup(function() { a() }), $("#text_two_ring").keyup(function() { DrawTextById("text_two_ring"), a() }), $("#text_NAME").keyup(function() { a() }), $("#text_INN").keyup(function() { DrawTextById("text_INN"), a() }), $("#font_value_INN").change(function() { a() }), $("#center_NAMEtext").click(function() { r(), a() }), $("#font_value_NAME").change(function() { a() }), $("#font_type_NAME").change(function() { a() }), $("#font_strange_NAME").change(function() { a() }), $("#getImage").click(function() { myImage = o.toDataURL(), $("#resultImg img").remove(), $("#resultImg").append('') }), $("#x-position-NAME").change(function() { a() }), $("#y-position-NAME").change(function() { a() }), $("#x-position-NAME").mousemove(function() { a() }), $("#y-position-NAME").mousemove(function() { a() }), a(), n() });