function send_to_textarea(e, t) {
if (myField = document.getElementById(e), document.selection) myField.focus(), sel = document.selection.createRange(), sel.text = t, myField.focus();
else if (myField.selectionStart || "0" == myField.selectionStart) {
var a = myField.selectionStart,
r = myField.selectionEnd,
o = myField.scrollTop;
myField.value = myField.value.substring(0, a) + t + myField.value.substring(r, myField.value.length), myField.focus(), myField.selectionStart = a + t.length, myField.selectionEnd = a + t.length, myField.scrollTop = o
} else myField.value += t, myField.focus()
}
function checked_by_class(e) {
$("." + e).each(function() {
this.checked = !this.checked
})
}
function do_ajax(e, t, a, r, o, n, i, s, l, c) {
$.ajax({
manconf_id_for_show: r,
manconf_id_for_loading: o,
manconf_is_loading_need: n,
manconf_loading_type: i,
manconf_onsuccess: s,
manconf_scroll_top: l,
type: e,
url: t,
data: a,
encoding: "UTF-8",
cache: !1,
id_hide: c,
beforeSend: function() {
ajax_before_send({
manconf_id_for_show: r,
manconf_id_for_loading: o,
manconf_is_loading_need: n,
manconf_loading_type: i,
manconf_onsuccess: s,
manconf_scroll_top: l
})
}
})
}
function do_load(e, t) {
"on" == t ? (pageSize = new Array, "body" == e ? (pageSize.w = $(window).width(), pageSize.h = $(document).height(), pageSize.t = 0, pageSize.l = 0, m_app = "body") : (m_app = "#" + e, me = $(m_app).position("top"), pageSize.w = $(m_app).width(), pageSize.h = $(m_app).height(), pageSize.t = me.top, pageSize.l = me.left), first_loading[e] ? overlay = $("#lightbox-overlay_" + e) : ($(m_app).append('
'), overlay = $("#lightbox-overlay_" + e), overlay.click(function() {
$("#lightbox-overlay_" + e).animate({
height: "hide",
opacity: "hide"
}, "slow")
}), first_loading[e] = "ok"), overlay.css({
position: "absolute",
display: "none",
top: pageSize.t,
left: pageSize.l,
zIndex: 1005,
opacity: 0,
height: pageSize.h + "px",
width: pageSize.w + "px"
}).fadeTo(1, .6).animate({
height: "show"
}, "slow")) : $("#lightbox-overlay_" + e).animate({
height: "hide",
opacity: "hide"
}, "slow")
}
function table_show_list() {
if ("ok" == var_list_show) {
$("#hidden_" + var_get_page).columnManager({
listTargetID: "targetall",
onClass: "advon",
offClass: "advoff",
hideInList: [1],
saveState: !0,
colsHidden: [var_colsHidden]
}), $("#ulSelectColumn").clickMenu({
onClick: function() {}
})
}
}
function include_once_js(e) {
js_load[e] || (head = document.getElementsByTagName("head")[0], script = document.createElement("script"), script.type = "text/javascript", script.src = e, head.appendChild(script), js_load[e] = "ok")
}
function get_value_for_ajax(e) {
return "" == e ? "" : (id = "" != last_form ? last_form + " #" + e + " " : e, $("#" + id).hasClass("checkbox_value") ? $("#" + id).is(":checked") ? $("#" + id).val() : "" : "checkbox" == $("#" + id).attr("type") ? $("#" + id).is(":checked") : $("#" + id).hasClass("inputprice") ? removecomma_obj("#" + id) : encodeURIComponent($("#" + id).hasClass("editor") ? editor_value(e) : $("#" + id).val()))
}
function change_list_class() {
$(".list").each(function(e) {
this.className = "list_" + e % 2
})
}
function my_go(e) {
setTimeout('document.location.href="' + decodeURIComponent(e) + '"', 100)
}
function select_user_value(e, t) {
$("#" + e + " option").each(function() {
this.value == t && (this.selected = !0)
})
}
function hide_id_link(e) {
$("#" + e).find("a").each(function() {
this.style.display = "none"
})
}
function moneycommasep(e) {
var t = ",",
a = e.value.replace(new RegExp(t, "g"), ""),
r = new RegExp("\\B(\\d{3})(" + t + "|$)");
do a = a.replace(r, t + "$1"); while (a.search(r) >= 0);
e.value = a
}
function removecomma(e) {
var t = ",";
return removed = document.getElementById(e).value.replace(new RegExp(t, "g"), ""), removed
}
function removecomma_obj(e) {
var t = ",";
return removed = $(e).val().replace(new RegExp(t, "g"), ""), removed
}
function array_search(e, t) {
var a;
bb = "no";
for (a in t) e === t[a] && (bb = a);
return bb
}
function check_form_befor_submit(e, t, a) {
id = t[0].id, my_error = "موارد الزامي را تکميل نماييد", my_ajax_form_error = $("#" + id).attr("ajax_error_id");
for (var r = 0; r < e.length; r++) {
if (my_id = e[r].name, my_value = e[r].value, "ok" == $("#" + my_id).attr("ajax_require") && !$("#" + my_id).is(":disabled")) {
if ("" == my_value) return my_ajax_error = $("#" + my_id).attr("ajax_error"), this_error = null == my_ajax_error ? my_error : my_ajax_error, $("#" + my_id).tooltip({
items: "#" + my_id,
content: this_error,
open: function(e) {
setTimeout(function() {
$(e.target).tooltip("destroy")
}, 1e4)
}
}).tooltip("open"), $("#" + my_ajax_form_error).show("slow").html(this_error), $("#" + my_id).removeClass("my_error_fill_ok").addClass("my_error_fill_error").css({
"background-color": "#FFF1F2",
border: "1px solid red"
}).focus(), $(".pe#" + my_ajax_form_error).fadeOut(5e3), "ok" == a.manconf_scroll_top && $("html,body").animate({
scrollTop: 0
}, 800), setTimeout("$('#" + my_id + "').css('background-color','" + $("#" + my_id).css("background-color") + "')", 1e3), "admin" == my_site_place, !1;
if ($("#" + my_id).is("[ajax_validate]"))
if (validate = $("#" + my_id).attr("ajax_validate"), pat_arr = new Array, pat_arr.email = /^[a-zA-Z0-9-._]+@[a-zA-Z0-9-._]+\.[a-zA-Z0-9-._]{2,4}$/i, pat_arr.url = /http\:\/\/[a-zA-Z0-9-._]+\.[a-zA-Z]{2,4}/i, pat_arr.user = /^[a-zA-Z0-9-._]{3,40}$/, pat_arr.pass = /^[a-zA-Z0-9-._]{5,40}$/, pat_arr.mobile = /^09[0-9]{9}$/, pat_arr.tell = /^(0[0-9]{3})?[0-9]{7,8}$/, pat_arr.number = /^([0-9]+)$/, "price" == validate) {
if (!$.isNumeric(my_value)) return !1
} else "mobile" == validate ? (value = pat_arr.mobile, my_value.match(new RegExp(value)) || alert(value)) : "email" == validate && (value = pat_arr.email, my_value.match(new RegExp(value)) || alert(value))
}
$("#" + my_id).removeClass("my_error_fill_error").addClass("my_error_fill_ok")
}
ajax_before_send(a)
}
function check_form_do_success(e, t, a, r, o, n) {
$("#" + e).removeClass("my_error_error").addClass("my_error_success"), "ok" == r && ($("#" + t).slideUp(), "admin" == my_site_place && (a += '[ فرم خالي] [ فرم حاوی اطلاعات تکمیل شده]")), "" !== a && null !== a && $("#" + e).append(a), "" !== o && null !== n && $("#" + o).hide("slow"), "" !== n && null !== n && ($("#list_" + n).addClass("list_delete"), $("#list_" + n).find("td").addClass("list_delete"), hide_id_link("list_" + n))
}
function check_form_do_delete(e, t) {
do_ajax("POST", e, t, "ajax_error", "body", "ok", "normal", "write")
}
function confirm_submitdata(e) {
var t = confirm("از ثبت درخواست اطمینان دارید؟");
1 == t && check_form_and_send_with_ajax(e)
}
function form_need_onload() {
$("form[ajax=ok]").each(function() {
$(this).is("[mdajax]") || ($(this).attr("mdajax", "ok"), check_form_and_send_with_ajax($(this).attr("id")))
}), $(".inputprice").keyup(function() {
moneycommasep(this)
}).click(function() {
moneycommasep(this)
}), $(".isnumeric").keypress(function(e) {
return "no" != $(this).attr("isnumeric") && 8 != e.which && 0 != e.which && (e.which < 48 || e.which > 57) ? ($(".isnumeric_error").remove(), $(this).after(" لطفا مقدار را به صورت عددي وارد كنيد"), $(".isnumeric_error").fadeOut(5e3), !1) : void 0
})
}
function check_form_and_send_with_ajax(e) {
$("#" + e + " input[type=file]").length > 0 && $("#" + e).attr("enctype", "multipart/form-data"), $("#" + e + " input,#" + e + " textarea,#" + e + " select").each(function() {
$(this).is("[name]") || $(this).attr("name", $(this).attr("id"))
}), $("#" + e).is("[ajax_error_id]") || $("#" + e).attr("ajax_error_id", "ajax_error"), $("#" + e).attr("action", $("#" + e).attr("ajaxurl")).attr("method", "POST"), scrolltop = $("#" + e).attr("scrolltop"), my_ajax_form_error = $("#" + e).attr("ajax_error_id");
var t = {
beforeSubmit: check_form_befor_submit,
manconf_form: !0,
manconf_id_for_show: my_ajax_form_error,
manconf_id_for_loading: "body",
manconf_is_loading_need: "ok",
manconf_loading_type: "normal",
manconf_onsuccess: "write",
manconf_scroll_top: scrolltop
};
$("#" + e).ajaxForm(t)
}
function clearFields(e) {
$("input,select,textarea", "#" + e).each(function() {
var e = this.type,
t = this.tagName.toLowerCase();
if ("text" == e || "password" == e || "" == t) this.value = "";
else if ("textarea" == e)
if ("editor" == $(this).attr("class")) {
var a = FCKeditorAPI.GetInstance($(this).attr("id"));
a.SetData("")
} else this.value = "";
else "checkbox" == e || "radio" == e ? this.checked = !1 : "select" == t && (this.selectedIndex = -1)
})
}
function mycallbackform_delete_all(e) {
my_d_i = "selected=ok", $("input[ch=ok]:checked").each(function() {
my_d_i += "&id[]=" + $(this).val()
}), "selected=ok" !== my_d_i && check_form_do_delete(e, my_d_i)
}
function ajax_confirm_send_ok(e) {
"no" !== e && (mySplitResult = e.split("@@@"), check_form_do_delete(mySplitResult[0], mySplitResult[1]))
}
function ajax_confirm_send(e, t) {
$.prompt("آيا از همه ي موارد انتخاب شده اطمينان داريد؟", {
callback: ajax_confirm_send_ok,
buttons: {
"بله": e + "@@@" + t,
"خير": "no"
},
show: "slideDown"
})
}
function delete_all_confirm(e) {
$.prompt("آيا از همه ي موارد انتخاب شده اطمينان داريد؟", {
callback: mycallbackform_delete_all,
buttons: {
"بله": e,
"خير": "no"
},
show: "slideDown"
})
}
function list_select_all() {
$("input[ch=ok]").each(function() {
this.checked = !this.checked
})
}
function select_all(e) {
for (field = document.getElementById(e), i = 0; i < field.length; i++) "checkbox" == field[i].type && "record_arr[]" == field[i].name && (field[i].checked = !0)
}
function form_style() {
$("form input[type=checkbox]").addClass("form_input_type_checkbox"), $("form input[type=text]").addClass("form_input_type_text"), $("form input[type=submit]").addClass("form_input_type_submit"), $("form button[type=submit]").addClass("form_input_type_submit")
}
function show_tooltip_result(e, t) {
my_id = e.attr("id"), $("#" + my_id).tooltip({
items: "#" + my_id,
content: t,
open: function(e) {
setTimeout(function() {
$(e.target).tooltip("destroy")
}, 1e4)
}
}).tooltip("open")
}
function require_select(e, t) {
$("#" + e).each(function() {
this.selectedIndex = -1, $(this).val("").attr("ajax_require", "ok").attr("ajax_error", t)
})
}
function max_length_textarea() {
$("textarea[maxlength]").keyup(function() {
var e = parseInt($(this).attr("maxlength")),
t = $(this).val(),
a = t.length;
if (a > e) {
var r = t.substr(0, e);
$(this).val(r)
}
})
}
function ajax_before_send(e) {
"undefined" != typeof e.manconf_id_for_show && ("undefined" != typeof e.manconf_form && ($("#disabled_button").attr("disabled", "disabled"), $("#" + e.manconf_id_for_show).addClass("my_error_error").show("slow").html("منتظر بمانيد...")), "ok" == e.manconf_is_loading_need && ("user" == my_site_place && $("#" + e.manconf_id_for_show).html('لطفا صبر کنید...
'), do_load(e.manconf_id_for_loading, "on", e.manconf_loading_type)))
}
function PreviewImage(e, t) {
var a = new FileReader;
a.readAsDataURL(document.getElementById(e).files[0]), a.onload = function(e) {
document.getElementById(t).src = e.target.result
}, document.getElementById(t).style.display = "block"
}
function foucse_error_field(e) {
$("#" + e).removeClass("my_error_fill_ok").addClass("my_error_fill_error").css({
"background-color": "#FFF1F2",
border: "1px solid red"
}).focus()
}! function(e) {
"function" == typeof define && define.amd ? define(["jquery"], e) : e("undefined" != typeof jQuery ? jQuery : window.Zepto)
}(function(e) {
"use strict";
function t(t) {
var a = t.data;
t.isDefaultPrevented() || (t.preventDefault(), e(t.target).ajaxSubmit(a))
}
function a(t) {
var a = t.target,
r = e(a);
if (!r.is("[type=submit],[type=image]")) {
var o = r.closest("[type=submit]");
if (0 === o.length) return;
a = o[0]
}
var n = this;
if (n.clk = a, "image" == a.type)
if (void 0 !== t.offsetX) n.clk_x = t.offsetX, n.clk_y = t.offsetY;
else if ("function" == typeof e.fn.offset) {
var i = r.offset();
n.clk_x = t.pageX - i.left, n.clk_y = t.pageY - i.top
} else n.clk_x = t.pageX - a.offsetLeft, n.clk_y = t.pageY - a.offsetTop;
setTimeout(function() {
n.clk = n.clk_x = n.clk_y = null
}, 100)
}
function r() {
if (e.fn.ajaxSubmit.debug) {
var t = "[jquery.form] " + Array.prototype.join.call(arguments, "");
window.console && window.console.log ? window.console.log(t) : window.opera && window.opera.postError && window.opera.postError(t)
}
}
var o = {};
o.fileapi = void 0 !== e("").get(0).files, o.formdata = void 0 !== window.FormData;
var n = !!e.fn.prop;
e.fn.attr2 = function() {
if (!n) return this.attr.apply(this, arguments);
var e = this.prop.apply(this, arguments);
return e && e.jquery || "string" == typeof e ? e : this.attr.apply(this, arguments)
}, e.fn.ajaxSubmit = function(t) {
function a(a) {
var r, o, n = e.param(a, t.traditional).split("&"),
i = n.length,
s = [];
for (r = 0; i > r; r++) n[r] = n[r].replace(/\+/g, " "), o = n[r].split("="), s.push([decodeURIComponent(o[0]), decodeURIComponent(o[1])]);
return s
}
function i(r) {
for (var o = new FormData, n = 0; n < r.length; n++) o.append(r[n].name, r[n].value);
if (t.extraData) {
var i = a(t.extraData);
for (n = 0; n < i.length; n++) i[n] && o.append(i[n][0], i[n][1])
}
t.data = null;
var s = e.extend(!0, {}, e.ajaxSettings, t, {
contentType: !1,
processData: !1,
cache: !1,
type: l || "POST"
});
t.uploadProgress && (s.xhr = function() {
var a = e.ajaxSettings.xhr();
return a.upload && a.upload.addEventListener("progress", function(e) {
var a = 0,
r = e.loaded || e.position,
o = e.total;
e.lengthComputable && (a = Math.ceil(r / o * 100)), t.uploadProgress(e, r, o, a)
}, !1), a
}), s.data = null;
var c = s.beforeSend;
return s.beforeSend = function(e, a) {
a.data = t.formData ? t.formData : o, c && c.call(this, e, a)
}, e.ajax(s)
}
function s(a) {
function o(e) {
var t = null;
try {
e.contentWindow && (t = e.contentWindow.document)
} catch (a) {
r("cannot get iframe.contentWindow document: " + a)
}
if (t) return t;
try {
t = e.contentDocument ? e.contentDocument : e.document
} catch (a) {
r("cannot get iframe.contentDocument: " + a), t = e.document
}
return t
}
function i() {
function t() {
try {
var e = o(y).readyState;
r("state = " + e), e && "uninitialized" == e.toLowerCase() && setTimeout(t, 50)
} catch (a) {
r("Server abort: ", a, " (", a.name, ")"), s(T), $ && clearTimeout($), $ = void 0
}
}
var a = u.attr2("target"),
n = u.attr2("action");
k.setAttribute("target", p), (!l || /post/i.test(l)) && k.setAttribute("method", "POST"), n != m.url && k.setAttribute("action", m.url), m.skipEncodingOverride || l && !/post/i.test(l) || u.attr({
encoding: "multipart/form-data",
enctype: "multipart/form-data"
}), m.timeout && ($ = setTimeout(function() {
b = !0, s(j)
}, m.timeout));
var i = [];
try {
if (m.extraData)
for (var c in m.extraData) m.extraData.hasOwnProperty(c) && i.push(e.isPlainObject(m.extraData[c]) && m.extraData[c].hasOwnProperty("name") && m.extraData[c].hasOwnProperty("value") ? e('').val(m.extraData[c].value).appendTo(k)[0] : e('').val(m.extraData[c]).appendTo(k)[0]);
m.iframeTarget || h.appendTo("body"), y.attachEvent ? y.attachEvent("onload", s) : y.addEventListener("load", s, !1), setTimeout(t, 15);
try {
k.submit()
} catch (d) {
var f = document.createElement("form").submit;
f.apply(k)
}
} finally {
k.setAttribute("action", n), a ? k.setAttribute("target", a) : u.removeAttr("target"), e(i).remove()
}
}
function s(t) {
if (!v.aborted && !E) {
if (C = o(y), C || (r("cannot access response document"), t = T), t === j && v) return v.abort("timeout"), void w.reject(v, "timeout");
if (t == T && v) return v.abort("server abort"), void w.reject(v, "error", "server abort");
if (C && C.location.href != m.iframeSrc || b) {
y.detachEvent ? y.detachEvent("onload", s) : y.removeEventListener("load", s, !1);
var a, n = "success";
try {
if (b) throw "timeout";
var i = "xml" == m.dataType || C.XMLDocument || e.isXMLDoc(C);
if (r("isXml=" + i), !i && window.opera && (null === C.body || !C.body.innerHTML) && --A) return r("requeing onLoad callback, DOM not available"), void setTimeout(s, 250);
var l = C.body ? C.body : C.documentElement;
v.responseText = l ? l.innerHTML : null, v.responseXML = C.XMLDocument ? C.XMLDocument : C, i && (m.dataType = "xml"), v.getResponseHeader = function(e) {
var t = {
"content-type": m.dataType
};
return t[e.toLowerCase()]
}, l && (v.status = Number(l.getAttribute("status")) || v.status, v.statusText = l.getAttribute("statusText") || v.statusText);
var c = (m.dataType || "").toLowerCase(),
d = /(json|script|text)/.test(c);
if (d || m.textarea) {
var u = C.getElementsByTagName("textarea")[0];
if (u) v.responseText = u.value, v.status = Number(u.getAttribute("status")) || v.status, v.statusText = u.getAttribute("statusText") || v.statusText;
else if (d) {
var p = C.getElementsByTagName("pre")[0],
_ = C.getElementsByTagName("body")[0];
p ? v.responseText = p.textContent ? p.textContent : p.innerText : _ && (v.responseText = _.textContent ? _.textContent : _.innerText)
}
} else "xml" == c && !v.responseXML && v.responseText && (v.responseXML = z(v.responseText));
try {
D = M(v, c, m)
} catch (g) {
n = "parsererror", v.error = a = g || n
}
} catch (g) {
r("error caught: ", g), n = "error", v.error = a = g || n
}
v.aborted && (r("upload aborted"), n = null), v.status && (n = v.status >= 200 && v.status < 300 || 304 === v.status ? "success" : "error"), "success" === n ? (m.success && m.success.call(m.context, D, "success", v), w.resolve(v.responseText, "success", v), f && e.event.trigger("ajaxSuccess", [v, m])) : n && (void 0 === a && (a = v.statusText), m.error && m.error.call(m.context, v, n, a), w.reject(v, "error", a), f && e.event.trigger("ajaxError", [v, m, a])), f && e.event.trigger("ajaxComplete", [v, m]), f && !--e.active && e.event.trigger("ajaxStop"), m.complete && m.complete.call(m.context, v, n), E = !0, m.timeout && clearTimeout($), setTimeout(function() {
m.iframeTarget ? h.attr("src", m.iframeSrc) : h.remove(), v.responseXML = null
}, 100)
}
}
}
var c, d, m, f, p, h, y, v, g, x, b, $, k = u[0],
w = e.Deferred();
if (w.abort = function(e) {
v.abort(e)
}, a)
for (d = 0; d < _.length; d++) c = e(_[d]), n ? c.prop("disabled", !1) : c.removeAttr("disabled");
if (m = e.extend(!0, {}, e.ajaxSettings, t), m.context = m.context || m, p = "jqFormIO" + (new Date).getTime(), m.iframeTarget ? (h = e(m.iframeTarget), x = h.attr2("name"), x ? p = x : h.attr2("name", p)) : (h = e(''), h.css({
position: "absolute",
top: "-1000px",
left: "-1000px"
})), y = h[0], v = {
aborted: 0,
responseText: null,
responseXML: null,
status: 0,
statusText: "n/a",
getAllResponseHeaders: function() {},
getResponseHeader: function() {},
setRequestHeader: function() {},
abort: function(t) {
var a = "timeout" === t ? "timeout" : "aborted";
r("aborting upload... " + a), this.aborted = 1;
try {
y.contentWindow.document.execCommand && y.contentWindow.document.execCommand("Stop")
} catch (o) {}
h.attr("src", m.iframeSrc), v.error = a, m.error && m.error.call(m.context, v, a, t), f && e.event.trigger("ajaxError", [v, m, a]), m.complete && m.complete.call(m.context, v, a)
}
}, f = m.global, f && 0 === e.active++ && e.event.trigger("ajaxStart"), f && e.event.trigger("ajaxSend", [v, m]), m.beforeSend && m.beforeSend.call(m.context, v, m) === !1) return m.global && e.active--, w.reject(), w;
if (v.aborted) return w.reject(), w;
g = k.clk, g && (x = g.name, x && !g.disabled && (m.extraData = m.extraData || {}, m.extraData[x] = g.value, "image" == g.type && (m.extraData[x + ".x"] = k.clk_x, m.extraData[x + ".y"] = k.clk_y)));
var j = 1,
T = 2,
S = e("meta[name=csrf-token]").attr("content"),
F = e("meta[name=csrf-param]").attr("content");
F && S && (m.extraData = m.extraData || {}, m.extraData[F] = S), m.forceSync ? i() : setTimeout(i, 10);
var D, C, E, A = 50,
z = e.parseXML || function(e, t) {
return window.ActiveXObject ? (t = new ActiveXObject("Microsoft.XMLDOM"), t.async = "false", t.loadXML(e)) : t = (new DOMParser).parseFromString(e, "text/xml"), t && t.documentElement && "parsererror" != t.documentElement.nodeName ? t : null
},
L = e.parseJSON || function(e) {
return window.eval("(" + e + ")")
},
M = function(t, a, r) {
var o = t.getResponseHeader("content-type") || "",
n = "xml" === a || !a && o.indexOf("xml") >= 0,
i = n ? t.responseXML : t.responseText;
return n && "parsererror" === i.documentElement.nodeName && e.error && e.error("parsererror"), r && r.dataFilter && (i = r.dataFilter(i, a)), "string" == typeof i && ("json" === a || !a && o.indexOf("json") >= 0 ? i = L(i) : ("script" === a || !a && o.indexOf("javascript") >= 0) && e.globalEval(i)), i
};
return w
}
if (!this.length) return r("ajaxSubmit: skipping submit process - no element selected"), this;
var l, c, d, u = this;
"function" == typeof t ? t = {
success: t
} : void 0 === t && (t = {}), l = t.type || this.attr2("method"), c = t.url || this.attr2("action"), d = "string" == typeof c ? e.trim(c) : "", d = d || window.location.href || "", d && (d = (d.match(/^([^#]+)/) || [])[1]), t = e.extend(!0, {
url: d,
success: e.ajaxSettings.success,
type: l || e.ajaxSettings.type,
iframeSrc: /^https/i.test(window.location.href || "") ? "javascript:false" : "about:blank"
}, t);
var m = {};
if (this.trigger("form-pre-serialize", [this, t, m]), m.veto) return r("ajaxSubmit: submit vetoed via form-pre-serialize trigger"), this;
if (t.beforeSerialize && t.beforeSerialize(this, t) === !1) return r("ajaxSubmit: submit aborted via beforeSerialize callback"), this;
var f = t.traditional;
void 0 === f && (f = e.ajaxSettings.traditional);
var p, _ = [],
h = this.formToArray(t.semantic, _);
if (t.data && (t.extraData = t.data, p = e.param(t.data, f)), t.beforeSubmit && t.beforeSubmit(h, this, t) === !1) return r("ajaxSubmit: submit aborted via beforeSubmit callback"), this;
if (this.trigger("form-submit-validate", [h, this, t, m]), m.veto) return r("ajaxSubmit: submit vetoed via form-submit-validate trigger"), this;
var y = e.param(h, f);
p && (y = y ? y + "&" + p : p), "GET" == t.type.toUpperCase() ? (t.url += (t.url.indexOf("?") >= 0 ? "&" : "?") + y, t.data = null) : t.data = y;
var v = [];
if (t.resetForm && v.push(function() {
u.resetForm()
}), t.clearForm && v.push(function() {
u.clearForm(t.includeHidden)
}), !t.dataType && t.target) {
var g = t.success || function() {};
v.push(function(a) {
var r = t.replaceTarget ? "replaceWith" : "html";
e(t.target)[r](a).each(g, arguments)
})
} else t.success && v.push(t.success);
if (t.success = function(e, a, r) {
for (var o = t.context || this, n = 0, i = v.length; i > n; n++) v[n].apply(o, [e, a, r || u, u])
}, t.error) {
var x = t.error;
t.error = function(e, a, r) {
var o = t.context || this;
x.apply(o, [e, a, r, u])
}
}
if (t.complete) {
var b = t.complete;
t.complete = function(e, a) {
var r = t.context || this;
b.apply(r, [e, a, u])
}
}
var $ = e("input[type=file]:enabled", this).filter(function() {
return "" !== e(this).val()
}),
k = $.length > 0,
w = "multipart/form-data",
j = u.attr("enctype") == w || u.attr("encoding") == w,
T = o.fileapi && o.formdata;
r("fileAPI :" + T);
var S, F = (k || j) && !T;
t.iframe !== !1 && (t.iframe || F) ? t.closeKeepAlive ? e.get(t.closeKeepAlive, function() {
S = s(h)
}) : S = s(h) : S = (k || j) && T ? i(h) : e.ajax(t), u.removeData("jqxhr").data("jqxhr", S);
for (var D = 0; D < _.length; D++) _[D] = null;
return this.trigger("form-submit-notify", [this, t]), this
}, e.fn.ajaxForm = function(o) {
if (o = o || {}, o.delegation = o.delegation && e.isFunction(e.fn.on), !o.delegation && 0 === this.length) {
var n = {
s: this.selector,
c: this.context
};
return !e.isReady && n.s ? (r("DOM not ready, queuing ajaxForm"), e(function() {
e(n.s, n.c).ajaxForm(o)
}), this) : (r("terminating; zero elements found by selector" + (e.isReady ? "" : " (DOM not ready)")), this)
}
return o.delegation ? (e(document).off("submit.form-plugin", this.selector, t).off("click.form-plugin", this.selector, a).on("submit.form-plugin", this.selector, o, t).on("click.form-plugin", this.selector, o, a), this) : this.ajaxFormUnbind().bind("submit.form-plugin", o, t).bind("click.form-plugin", o, a)
}, e.fn.ajaxFormUnbind = function() {
return this.unbind("submit.form-plugin click.form-plugin")
}, e.fn.formToArray = function(t, a) {
var r = [];
if (0 === this.length) return r;
var n = this[0],
i = t ? n.getElementsByTagName("*") : n.elements;
if (!i) return r;
var s, l, c, d, u, m, f;
for (s = 0, m = i.length; m > s; s++)
if (u = i[s], c = u.name, c && !u.disabled)
if (t && n.clk && "image" == u.type) n.clk == u && (r.push({
name: c,
value: e(u).val(),
type: u.type
}), r.push({
name: c + ".x",
value: n.clk_x
}, {
name: c + ".y",
value: n.clk_y
}));
else if (d = e.fieldValue(u, !0), d && d.constructor == Array)
for (a && a.push(u), l = 0, f = d.length; f > l; l++) r.push({
name: c,
value: d[l]
});
else if (o.fileapi && "file" == u.type) {
a && a.push(u);
var p = u.files;
if (p.length)
for (l = 0; l < p.length; l++) r.push({
name: c,
value: p[l],
type: u.type
});
else r.push({
name: c,
value: "",
type: u.type
})
} else null !== d && "undefined" != typeof d && (a && a.push(u), r.push({
name: c,
value: d,
type: u.type,
required: u.required
}));
if (!t && n.clk) {
var _ = e(n.clk),
h = _[0];
c = h.name, c && !h.disabled && "image" == h.type && (r.push({
name: c,
value: _.val()
}), r.push({
name: c + ".x",
value: n.clk_x
}, {
name: c + ".y",
value: n.clk_y
}))
}
return r
}, e.fn.formSerialize = function(t) {
return e.param(this.formToArray(t))
}, e.fn.fieldSerialize = function(t) {
var a = [];
return this.each(function() {
var r = this.name;
if (r) {
var o = e.fieldValue(this, t);
if (o && o.constructor == Array)
for (var n = 0, i = o.length; i > n; n++) a.push({
name: r,
value: o[n]
});
else null !== o && "undefined" != typeof o && a.push({
name: this.name,
value: o
})
}
}), e.param(a)
}, e.fn.fieldValue = function(t) {
for (var a = [], r = 0, o = this.length; o > r; r++) {
var n = this[r],
i = e.fieldValue(n, t);
null === i || "undefined" == typeof i || i.constructor == Array && !i.length || (i.constructor == Array ? e.merge(a, i) : a.push(i))
}
return a
}, e.fieldValue = function(t, a) {
var r = t.name,
o = t.type,
n = t.tagName.toLowerCase();
if (void 0 === a && (a = !0), "checkbox" == o) return e(t).is(":checked");
if (a && (!r || t.disabled || "reset" == o || "button" == o || ("checkbox" == o || "radio" == o) && !t.checked || ("submit" == o || "image" == o) && t.form && t.form.clk != t || "select" == n && -1 == t.selectedIndex)) return null;
if ("select" == n) {
var i = t.selectedIndex;
if (0 > i) return null;
for (var s = [], l = t.options, c = "select-one" == o, d = c ? i + 1 : l.length, u = c ? i : 0; d > u; u++) {
var m = l[u];
if (m.selected) {
var f = m.value;
if (f || (f = m.attributes && m.attributes.value && !m.attributes.value.specified ? m.text : m.value), c) return f;
s.push(f)
}
}
return s
}
return e(t).val()
}, e.fn.clearForm = function(t) {
return this.each(function() {
e("input,select,textarea", this).clearFields(t)
})
}, e.fn.clearFields = e.fn.clearInputs = function(t) {
var a = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;
return this.each(function() {
var r = this.type,
o = this.tagName.toLowerCase();
a.test(r) || "textarea" == o ? this.value = "" : "checkbox" == r || "radio" == r ? this.checked = !1 : "select" == o ? this.selectedIndex = -1 : "file" == r ? /MSIE/.test(navigator.userAgent) ? e(this).replaceWith(e(this).clone(!0)) : e(this).val("") : t && (t === !0 && /hidden/.test(r) || "string" == typeof t && e(this).is(t)) && (this.value = "")
})
}, e.fn.resetForm = function() {
return this.each(function() {
("function" == typeof this.reset || "object" == typeof this.reset && !this.reset.nodeType) && this.reset()
})
}, e.fn.enable = function(e) {
return void 0 === e && (e = !0), this.each(function() {
this.disabled = !e
})
}, e.fn.selected = function(t) {
return void 0 === t && (t = !0), this.each(function() {
var a = this.type;
if ("checkbox" == a || "radio" == a) this.checked = t;
else if ("option" == this.tagName.toLowerCase()) {
var r = e(this).parent("select");
t && r[0] && "select-one" == r[0].type && r.find("option").selected(!1), this.selected = t
}
})
}, e.fn.ajaxSubmit.debug = !1
});
var first_loading = new Array,
var_list_show = "no",
js_load = new Array,
last_form = "";
$(document).bind("form-pre-serialize", function() {
$(".inputprice").each(function() {
$("#" + this.id).val(removecomma_obj("#" + this.id))
})
}), $("body").bind("DOMSubtreeModified", function() {
$("#" + id + " input,#" + id + " textarea,#" + id + " select").each(function() {
$(this).is("[name]") || $(this).attr("name", $(this).attr("id"))
})
}), $(document).ready(function() {
form_need_onload(), table_show_list(), form_style(), $.isFunction($.fn.tooltip) && $(document).tooltip({
track: !0,
items: "[title],[manconf],[tooltip]",
content: function() {
return $(this).is("[tooltip]") ? $(this).attr("tooltip") : void 0
}
})
}), $(document).bind("form-pre-serialize", function() {
$("input,textarea,select").not("[name]").each(function() {
$(this).is("[name]") || $(this).attr("name", $(this).attr("id"))
})
}), $(document).ajaxComplete(function(e, t, a) {
"write" == a.manconf_onsuccess ? ($("#" + a.manconf_id_for_show).show(), $("#" + a.manconf_id_for_show).html(t.responseText)) : "" != a.manconf_onsuccess && window[a.manconf_onsuccess](a.id_hide), "user" == my_site_place ? "no" != a.manconf_scroll_top : "ok" == a.manconf_scroll_top && $("html,body").animate({
scrollTop: 0
}, 800), "ok" == a.manconf_is_loading_need && do_load(a.manconf_id_for_loading, "off", a.manconf_loading_type), "user" == my_site_place && (ajax_link(), change_list_class()), table_show_list(), form_style(), FarsiType.init(), $("#disabled_button").attr("disabled", !1), form_need_onload()
}), $(function() {
$("a[href*=#]:not([href=#])").click(function() {
if (location.pathname.replace(/^\//, "") == this.pathname.replace(/^\//, "") && location.hostname == this.hostname) {
var e = $(this.hash);
if (e = e.length ? e : $("[name=" + this.hash.slice(1) + "]"), e.length) return $("html,body").animate({
scrollTop: e.offset().top
}, 1500), !1
}
})
});
function checkMelliCode(meli_code) {
if (meli_code.length == 10) {
if (meli_code == '1111111111' ||
meli_code == '0000000000' ||
meli_code == '2222222222' ||
meli_code == '3333333333' ||
meli_code == '4444444444' ||
meli_code == '5555555555' ||
meli_code == '6666666666' ||
meli_code == '7777777777' ||
meli_code == '8888888888' ||
meli_code == '9999999999') {
return false;
}
c = parseInt(meli_code.charAt(9));
n = parseInt(meli_code.charAt(0)) * 10 +
parseInt(meli_code.charAt(1)) * 9 +
parseInt(meli_code.charAt(2)) * 8 +
parseInt(meli_code.charAt(3)) * 7 +
parseInt(meli_code.charAt(4)) * 6 +
parseInt(meli_code.charAt(5)) * 5 +
parseInt(meli_code.charAt(6)) * 4 +
parseInt(meli_code.charAt(7)) * 3 +
parseInt(meli_code.charAt(8)) * 2;
r = n - parseInt(n / 11) * 11;
if ((r == 0 && r == c) || (r == 1 && c == 1) || (r > 1 && c == 11 - r)) {
return true;
} else {
return false;
}
} else {
return false;
}
}