"
}).timeout(4)) : OWDialog({
id: OW.createDialogID(),
content: "鍝庡晩锛屾湇鍔″櫒鍒氬紑浜嗕竴涓嬪皬宸紒"
}).timeout(4)),
g.call()
},
success: function(a) {
var b, c, d, e = '{"result":"failed","message":"' + escape("绯荤粺杩斿洖閿欒锛屾搷浣滃け璐ワ紒") + '"}';
d = a,
OW.isNull(d) && (d = e);
try {
d = $.parseJSON(d)
} catch(h) {
d = $.parseJSON(e)
}
if (OW.ajaxData = d, "success" == d.result) f.call(this);
else {
if (c = unescape(d.message), OW.isNull(c)) for (c = "", b = 0; b < d.messages.length; b++) c = c + "" + unescape(d.messages[b].message) + " ";
OW.debug && (c = c + "
" + a + "
");
try {
g(c).call(this)
} catch(h) {}
}
}
})
},
this.appendToString = "",
this.append = function(a) {
OW.appendToString = OW.appendToString + a
},
this.arrayUnique = function(a) {
var b, c, e, d = 0,
f = [];
for (b = 0; b < a.length; b++) if ("" != $.trim(a[b])) {
for (e = !1, c = 0; c < f.length; c++)($.trim(a[b]) == $.trim(f[c]) || "" == $.trim(f[c])) && (e = !0);
e || (f[d] = a[b], d += 1)
}
return f
},
this.bodyScrollTime = 3600,
this.bodyScrollClose = !1,
this.bodyScroll = function() {
OW.bodyScrollTime = OW.bodyScrollTime - 1,
document.documentElement.scrollTop = document.body.scrollHeight,
!OW.bodyScrollClose && OW.bodyScrollTime > 0 && window.setTimeout(function() {
OW.bodyScroll()
},
200)
},
this.closeParentDialog = function(a) {
parent.closeDialog(a)
},
this.confirm = function(a) {
return confirm(a) ? !0 : !1
},
this.echo = function(a) {
document.write(a)
},
this.formatDateTime = function(a, b) {
var c, d, e, f, g, h, i, j;
try {
c = OW.rep(a, "-", "/"),
d = c.split(" "),
e = OW.int(d[0].split("/")[0]),
f = OW.int(d[0].split("/")[1]),
g = OW.int(d[0].split("/")[2]),
h = OW.int(d[1].split(":")[0]),
i = OW.int(d[1].split(":")[1]),
j = OW.int(d[1].split(":")[2]),
"0" == b ? c = e + "-" + f + "-" + g + " " + h + ":" + i + ":" + j: "1" == b ? c = e + "." + f + "." + g + " " + h + ":" + i + ":" + j: "2" == b ? c = e + "-" + f + "-" + g: "3" == b ? c = h + ":" + i + ":" + j: "4" == b && (c = e + "." + f + "." + g)
} catch(k) {
c = ""
}
return c
},
this.toDate = function(a) {
var b, c, d, e, f, g, h, i, j;
return "string" == typeof a ? (b = OW.rep(a, "-", "/"), c = b.split(" "), d = parseInt(OW.int(c[0].split("/")[0])), e = parseInt(OW.int(c[0].split("/")[1])) - 1, f = parseInt(OW.int(c[0].split("/")[2])), g = parseInt(OW.int(c[1].split(":")[0])), h = parseInt(OW.int(c[1].split(":")[1])), i = parseInt(OW.int(c[1].split(":")[2])), j = new Date(d, e, f, g, h, i), j) : a
},
this.dateAdd = function(a, b, c) {
switch ("string" == typeof c && (c = OW.toDate(c)), a) {
case "y":
return new Date(c.setFullYear(c.getFullYear() + b));
case "m":
return new Date(c.setMonth(c.getMonth() + b));
case "d":
return new Date(c.setDate(c.getDate() + b));
case "w":
return new Date(c.setDate(c.getDate() + 7 * b));
case "h":
return new Date(c.setHours(c.getHours() + b));
case "n":
return new Date(c.setMinutes(c.getMinutes() + b));
case "s":
return new Date(c.setSeconds(c.getSeconds() + b));
case "l":
return new Date(c.setMilliseconds(c.getMilliseconds() + b))
}
},
this.dateDiff = function(a, b, c) {
try {
switch ("string" == typeof b && (b = OW.toDate(b)), "string" == typeof c && (c = OW.toDate(c)), a) {
case "s":
return parseInt((c - b) / 1e3);
case "n":
return parseInt((c - b) / 6e4);
case "h":
return parseInt((c - b) / 36e5);
case "d":
return parseInt((c - b) / 864e5);
case "w":
return parseInt((c - b) / 6048e5);
case "m":
return c.getMonth() + 1 + 12 * (c.getFullYear() - b.getFullYear()) - (b.getMonth() + 1);
case "y":
return c.getFullYear() - b.getFullYear()
}
} catch(d) {}
},
this.timeOutTip = function(a) {
var b, c, d, e, f, g = "",
h = a.time,
i = a.now,
j = a.section,
k = a.d,
l = a.h,
m = a.n,
n = a.s;
OW.isNotNull(h) && (h = OW.toDate(h), timeDiff = OW.dateDiff("s", i, h), timeDiff > 0 && (60 >= timeDiff ? g = timeDiff + n: timeDiff > 60 && 5400 >= timeDiff ? (d = OW.int(timeDiff / 60), e = timeDiff - 60 * d, g = e > 0 ? d + m + e + n: d + m) : timeDiff > 5400 && 86400 >= timeDiff ? (c = OW.int(timeDiff / 3600), f = timeDiff - 3600 * c, d = OW.int(f / 60), e = f - 60 * d, g = e > 0 ? c + l + d + m + e + n: c + l + d + m) : (b = OW.int(timeDiff / 86400), f = timeDiff - 86400 * b, c = OW.int(f / 3600), f -= 3600 * c, d = OW.int(f / 60), e = f - 60 * d, g = e > 0 ? b + k + c + l + d + m + e + n: b + k + c + l + d + m), j.html(g), i = OW.dateAdd("s", 1, i), a = {
d: k,
h: l,
n: m,
s: n,
time: h,
now: i,
section: j
},
window.setTimeout(function() {
OW.timeOutTip(a)
},
1e3)))
},
this.timeAgoTip = function(a, b, c) {
var d, e, f, g, h, i, j, k = "",
l = a.y,
m = a.m,
n = a.w,
o = a.d,
p = a.h,
q = a.n,
r = a.s,
s = a.z || "";
return b = OW.toDate(b),
c = OW.toDate(c),
d = OW.dateDiff("y", b, c),
e = OW.dateDiff("m", b, c),
f = OW.dateDiff("w", b, c),
g = OW.dateDiff("d", b, c),
h = OW.dateDiff("h", b, c),
i = OW.dateDiff("n", b, c),
j = OW.dateDiff("s", b, c),
0 >= j && (k = s),
j > 0 && (k = j + r),
i > 0 && (k = i + q),
h > 0 && (k = h + p),
g > 0 && (k = g + o),
f > 0 && g > 7 && (k = f + n),
e > 0 && f > 4 && (k = e + m),
d > 0 && e > 12 && (k = d + l),
k
},
this.delay = function(a, b) {
window.setTimeout(function() {
b.call()
},
a)
},
this.echoAdData = function(a, b) {
var c = $("#ow_ad_" + a).attr("data");
if (!OW.isNull(c)) for (json = OW.JSON.parse(c), i = 0; i < json.length; i++) s = b,
s = OW.rep(s, "{$i}", i + 1),
s = OW.rep(s, "{$link}", json[i].link),
s = OW.rep(s, "{$name}", json[i].name),
s = OW.rep(s, "{$url}", json[i].url),
document.write(s);
$("script[id='" + a + "']").remove()
},
this.echoImagesData = function(a, b) {
if (!OW.isNull(a)) for (a = OW.rep(a, """, '"'), json = OW.JSON.parse(a), i = 0; i < json.length; i++) s = b,
s = OW.rep(s, "{$i}", i + 1),
s = OW.rep(s, "{$name}", json[i].name),
s = OW.rep(s, "{$url}", json[i].url),
document.write(s)
},
this.enterClick = function(a) {
$(document).keydown(function(b) {
var c;
b = b ? b: window.event ? window.event: null,
c = b.keyCode ? b.keyCode: b.which,
13 == c && a.call(this)
})
},
this.filename = function(a) {
var b, c, d, e, f = a.split("/");
return e = f[f.length - 1],
b = OW.filename.arguments,
b.length > 1 && (c = b[1], 0 == c.exName && (d = e.lastIndexOf("."), d > 0 && (e = OW.left(e, d)))),
e
},
this.fileExName = function(a) {
if (a = $.trim(a), "" != a) {
var b = a.split(".");
return b[b.length - 1]
}
return ""
},
this.getSubDomain = function(a) {
if ("" == a || null == a) a = "";
else {
var b = a.split(".");
a = "www" == b[0] ? b[1] : b[0]
}
return a
},
this.goBack = function() {
history.go( - 1)
},
this.iif = function(a, b, c) {
return a ? b: c
},
this.int = function(a) {
return "" == a || null == a ? 0 : (a += "", "px" == OW.right(a, 2) ? (a = a.replace(/[^0-9.-]*/g, ""), "" == a && (a = "0"), a = parseInt(a)) : (a = a.replace(/[^0-9.-]*/g, ""), "" == a && (a = 0), a = parseInt(a)), a)
},
this.indexOf = function(a, b) {
return OW.isNull(a) ? -1 : a.indexOf(b)
},
this.isIE = function() {
return window.navigator.userAgent.indexOf("IE") >= 0 ? !0 : !1
},
this.isFirefox = function() {
return window.navigator.userAgent.indexOf("Firefox") >= 0 ? !0 : !1
},
this.isWebKit = function() {
return window.navigator.userAgent.indexOf("WebKit") >= 0 ? !0 : !1
},
this.isChrome = function() {
return window.navigator.userAgent.indexOf("Chrome") >= 0 ? !0 : !1
},
this.isOpera = function() {
return window.navigator.userAgent.indexOf("Opera") >= 0 ? !0 : !1
},
this.isWeixinAgent = function() {
return window.navigator.userAgent.indexOf("MicroMessenger") >= 0 ? !0 : !1
},
this.isEmail = function(a) {
return - 1 != a.search(OW.rule("email")) ? !0 : !1
},
this.isFlash = function(a) {
var b = OW.fileExName(a);
return "swf" == b ? !0 : !1
},
this.isImage = function(a) {
var b = OW.fileExName(a);
return "jpg" == b || "jpeg" == b || "gif" == b || "png" == b || "bmp" == b || "ico" == b ? !0 : !1
},
this.isInArray = function(a, b) {
var c, d = !1;
for (c = 0; c < a.length; c++) if (a[c] == b) {
d = !0;
break
}
return d
},
this.isNull = function(a) {
var b = $.trim(a);
return null == b ? !0 : "undefined" == b ? !0 : "" == b ? b === !1 || b === !0 ? !1 : !0 : !1
},
this.isNotNull = function(a) {
return ! OW.isNull(a)
},
this.objExist = function(a) {
return OW.isObjExist(a)
},
this.isObjExist = function(a) {
return null == a || "undefined" == a || void 0 == a || null == a.html() ? !1 : !0
},
this.isInArray = function(a, b) {
var d, c = !1;
if (a.length > 0) for (d = 0; d < a.length; d++) if (b == a[d]) {
c = !0;
break
}
return c
},
this.isValidDataime = function(a) {
var b = !1;
return OW.isNull(a) || "1900" != OW.left(a, 4) && (b = !0),
b
},
this.isValidMobile = function(a) {
var b = !1;
return a = OW.parseMobile(a),
OW.isNull(a) || 11 == a.length && "1" == OW.left(a, 1) && (b = !0),
b
},
this.leftString = function(a, b) {
var c = a.length,
d = OW.left(a, b);
return c > b && (d += " ..."),
d
},
this.left = function(a, b) {
return "" == a || void 0 == a || 1 > b ? "": a.substring(0, b)
},
this.right = function(a) {
if (OW.isNull(a)) return "";
a += "";
var c = a.length;
return a = a.substring(c - 2, c)
},
this.listOrderBy = function(a) {
var b = a.obj;
b.each(function() {
var a = $(this).attr("orderby"),
b = OW.listOrderByURL(a);
OW.orderby == a ? $(this).addClass("current") : $(this).removeClass("current"),
$(this).click(function() {
OW.redirect(b)
})
})
},
this.listOrderByURL = function(a) {
var b = "";
return b = OW.isNull(OW.rootpath) ? OW.page > 0 ? OW.c2t: OW.c1t: OW.page > 0 ? OW.c3t: OW.c3t,
b.replace("{$rootpath}", OW.rootpath).replace("{$urlpath}", OW.urlpath).replace("{$page}", OW.page).replace("{$typeid}", OW.typeid).replace("{$orderby}", a)
},
this.onblur = function(me, opt) {
var v = $(me).val(),
rep = opt.rep,
length = opt.length;
rep && (v = v.replace(eval(rep), "")),
length && (v = v.substring(0, length)),
$(me).val($.trim(v))
},
this.openPage = function(a) {
window.location.href = a
},
this.openNewPage = function(a) {
window.open(a)
},
this.parseBankCode = function(a) {
var b = "";
return OW.isNull(a) || (b = a.replace(/[^0-9a-zA-Z\-\_]*/g, "")),
b
},
this.parseFloat = function(a) {
return OW.isNull(a) ? 0 : parseFloat(a)
},
this.parseFormInputValue = function(a) {
var b, c = a.form;
c.find("input").each(function() {
b = $.trim($(this).val()),
$(this).val(b)
})
},
this.parseMobile = function(a) {
return a.replace(/[^0-9]*/g, "")
},
this.parseMobileCode = function(a) {
return OW.left(a.replace(/[^0-9]*/g, ""), 6)
},
this.parseUsername = function(a) {
return a.replace(/[^0-9a-zA-Z\.\-\_]*/g, "")
},
this.parseMoney = function(a) {
return a = OW.parseFloat(a),
a = a.toFixed(2),
a = OW.parseFloat(a)
},
this.parsePrice = function(a) {
return OW.isNull(a) || "0" == a ? "0.00": (a = OW.parseMoney(a), a = a.toFixed(2))
},
this.parseVal = function(a) {
return ("undefined" == a || void 0 == a) && (a = ""),
a
},
this.random = function() {
return parseInt(1e5 * Math.random())
},
this.redirect = function(a, b) {
b = OW.int(b),
b = parseInt(b - 1),
b > 0 ? ($("#redirect_timeout").html(b), window.setTimeout(function() {
OW.redirect(a, b)
},
1e3)) : window.location.href = a
},
this.refresh = function() {
OWDialog({
id: "refresh_" + OW.createDialogID(),
content: "椤甸潰鍒锋柊涓?..",
shadow: !1
}).padding("13px 20px").position(),
window.location.reload()
},
this.pageLoading = function() {
OWDialog({
id: "loading_" + OW.createDialogID(),
content: "椤甸潰鍔犺浇涓?..",
shadow: !1
}).padding("13px 20px").position()
},
this.rep = function(str, rule, s) {
return OW.isNull(str) ? "": (rule = rule.replace(/\$/g, "\\$"), eval("str.replace(/" + rule + "/g,s)"))
},
this.reps = function(a, b, c) {
return OW.isNull(a) ? "": a.replace(b, c)
},
this.rule = function(a) {
switch (a) {
case "email":
return /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
case "domain":
return /[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/;
case "site_url":
return "";
case "img":
return "img";
default:
return ! 1
}
},
this.scrollTop = function(a) {
var b = 1;
a.click(function() {
for (var a = document.body.scrollHeight - 1; a && (window.scrollTo(0, a), a > 200 ? (a = a - 2 - b, b += 5) : a -= 2, !(0 > a)););
})
},
this.documentScrollTop = function() {
return parseInt(document.body.scrollTop || document.documentElement.scrollTop)
},
this.setDisabled = function(a, b) {
1 == b ? a.addClass("disabled").attr("disabled", !0) : a.removeClass("disabled").attr("disabled", !1)
},
this.tabSwitch = function(a) {
var b = a.current || 1,
c = a.tab || "tab",
d = a.tabbar,
e = a.container;
d.find("[name='" + c + "'][" + c + "='" + b + "']").addClass("current"),
e.find("[is_" + c + "='true'][" + c + "!='" + b + "']").hide(),
d.find("[name='" + c + "']").click(function() {
var a = OW.int($(this).attr(c));
$(this).addClass("current"),
d.find("[name='" + c + "'][" + c + "!='" + a + "']").removeClass("current"),
e.find("[is_" + c + "='true'][" + c + "!='" + a + "']").hide(0),
e.find("[is_" + c + "='true'][" + c + "='" + a + "']").show(50)
})
},
this.timeoutTime = 0,
this.timeoutFinish = {},
this.timeoutDisplay = function(a) {
OW.timeoutTime > 0 ? (OW.timeoutTime = OW.timeoutTime - 1, a.html(OW.timeoutTime), window.setTimeout(function() {
OW.timeoutDisplay(a)
},
1e3)) : OW.timeoutFinish.call()
},
this.toString = function(a) {
return a.toString()
},
this.trim = function(a) {
return $.trim(a)
},
this.urlEncode = function(a) {
return a = OW.isNotNull(a) ? encodeURIComponent(a) : ""
},
this.verifyCode = function(a) {
var b = a.boxer || $("#verifycode"),
c = a.path || THIS.sitePath,
d = OW.random();
b.append(''),
b.html('鍒锋柊'),
b.find("img,a[name='fresh']").click(function() {
OW.verifyCode(a)
})
},
this.author = function() {
var a = ">l>i>n>x>i>a>o>d>o>n>g>";
return OW.rep(a, ">", "")
},
this.verifyCodeValueBlur = function(a) {
OW.isObjExist(a) && a.blur(function() {
$(this).val(OW.parseVerifyCode($(this).val()))
})
},
this.verifyCodeValueFocus = function(a, b) {
OW.isObjExist(a) && a.focus(function() {
OW.isNull(b.html()) && OW.verifyCode({
boxer: b
})
})
},
this.parseVerifyCode = function(a) {
return OW.left(OW.trim(a).replace(/[^0-9]*/g, ""), 5)
},
this.regionJson = [],
this.subRegion = [],
this.currentPath = "",
this.regionSelectFinished = {},
this.isRegionSelected = function(a, b) {
var c = THIS.currentPath.split(",");
return a == c[b] ? !0 : !1
},
this.createRegionSelect = function(a, b, c) {
THIS.regionJson = OWRegion || [],
"" != c && (THIS.currentPath = c);
var d, e = THIS.regionJson,
f = !1;
for (s = '",
a.append(s),
d = a.find("select[name='" + b + "']"),
f && THIS.createSubRegion(a, b + "_2", d.find("option:selected").attr("path"), THIS.regionJson),
d.change(function() {
OW.int($(this).val()) > 0 ? THIS.createSubRegion(a, b + "_2", $(this).find("option:selected").attr("path"), THIS.regionJson) : a.find("select[depth!='1']").remove()
})
},
this.createSubRegion = function(a, b, c, d) {
var e, f, g, h;
if (THIS.getRegionJson(c, THIS.regionJson), d = THIS.subRegion, f = !1, h = c.split(",").length - 1, d.length > 0) {
for (a.find("select").each(function() {
OW.int($(this).attr("depth")) >= h && $(this).remove()
}), g = '",
a.append(g),
e = a.find("select[name='" + b + "']"),
f && THIS.createSubRegion(a, b + "_" + (h + 1), e.find("option:selected").attr("path"), THIS.regionJson),
e.change(function() {
OW.int($(this).val()) > 0 ? THIS.createSubRegion(a, b + "_" + (h + 1), $(this).find("option:selected").attr("path")) : a.find("select").each(function() {
OW.int($(this).attr("depth")) > h && $(this).remove()
})
})
} else {
a.find("select").each(function() {
OW.int($(this).attr("depth")) >= h && $(this).remove()
});
try {
THIS.regionSelectFinished(c).call()
} catch(j) {}
$("span[name='t_order_region']").removeClass("t-err").html("")
}
},
this.getRegionJson = function(a, b) {
var c, d, e = a.split(",");
for (THIS.subRegion = [], c = 0; c < b.length; c++) for (d = 0; d < e.length; d++) if (OW.int(e[d]) > 0 && b[c].i == e[d]) {
if (d == e.length - 2) {
THIS.subRegion = b[c].c;
break
}
THIS.getRegionJson(a, b[c].c);
break
}
},
this.getMobileCode = function(a) {
var b = a.mb,
c = a.mc,
d = a.getmc,
e = OW.int(d.attr("timeout")),
f = a.url,
g = a.vv || {},
h = a.vc || {},
i = a.isHide,
j = a.vcodeOpen;
b.blur(function() {
$(this).val(OW.parseMobile($(this).val()))
}),
c.blur(function() {
$(this).val(OW.parseMobileCode($(this).val()))
}),
b.focus(),
d.click(function() {
var a, c, k, o, l = !0,
m = b.val(),
n = b.attr("scode_name");
OW.isValidMobile(m) || (OWDialog().alert("璇峰~鍐欐纭殑鎵嬫満鍙风爜").position().timeout(2), l = !1, b.focus()),
OW.objExist(h) && 1 == j && (OW.objExist(h) && (a = h.find("input[name='verifycode_name']")), 1 == OW.int(g.attr("need_refresh")) && (OW.verifyCode({
boxer: h
}), g.attr("need_refresh", "0").val("").focus().parent().parent().show()), c = OW.trim(a.val()), k = OW.trim(g.val()), OW.isNull(k) && l && (OWDialog().alert("璇峰~鍐欓獙璇佺爜锛?).position().timeout(2), l = !1, g.focus())),
l && (o = OWDialog().posting("姝e湪鍙戦€佺煭淇¢獙璇佺爜..."), OW.ajax({
url: f,
data: "mobile=" + OW.encrypt.encode(m) + "&scode_name=" + n + "&verifycode_name=" + c + "&verifycode_value=" + k,
success: function() {
d.addClass("disabled").attr("disabled", "disabled").html("宸插彂閫佺煭淇?" + e + ")"),
OW.timeoutTime = d.attr("timeout"),
OW.timeoutFinish = function() {
d.removeClass("disabled").attr("disabled", "").html("閲嶆柊鑾峰彇楠岃瘉鐮?)
},
OW.timeoutDisplay(d.find("i")),
o.success("楠岃瘉鐮佸凡鍙戦€侊紝璇锋煡鐪嬫墜鏈虹煭淇★紒").position().timeout(3),
g.attr("need_refresh", "1"),
i && g.parent().parent().hide()
},
failed: function(a) {
o.error("楠岃瘉鐮佸彂閫佸け璐ワ紝璇锋煡鐪嬩互涓嬮敊璇彁绀轰俊鎭?, a).position().timeout(4),
OW.indexOf(a, "鎵嬫満鍙风爜") >= 0 && b.focus(),
OW.indexOf(a, "楠岃瘉鐮?) >= 0 && (OW.verifyCode({
boxer: h
}), g.val("").focus())
}
}))
})
},
this.webScreenHeight = function() {
return parseInt(document.documentElement.clientHeight)
},
this.webScreenWidth = function() {
return OW.isFirefox() || OW.isIE() || OW.isWebKit() ? parseInt(document.documentElement.clientWidth) - 1 : parseInt(document.documentElement.clientWidth)
},
this.webHeight = function() {
return parseInt($("body").height())
},
this.webWidth = function() {
return parseInt(document.body.scrollWidth)
},
this.createDialogID = function() {
var a = new Date,
b = "d" + a.getHours().toString() + a.getMinutes().toString() + a.getSeconds().toString() + a.getMilliseconds().toString() + parseInt(1e4 * Math.random()).toString();
return b
},
this.dialogBigHeight = function() {
return OW.webScreenHeight() - 48
},
this.dialogBigWidth = function() {
return OW.webScreenWidth() - 52
},
this.DIALOG_Class = function(a, b) {
var c = "OWDialog" + +new Date,
d = function(a) {
var f, e = d.defaults;
a = a || {},
("string" == typeof a || 1 === a.nodeType) && (a = {
content: a
});
for (f in e) void 0 === a[f] && (a[f] = e[f]);
return document.getElementById(a.id) ? void 0 : (a.button && a.button.push || (a.button = []), a.ok && a.button.push({
id: "ok",
value: a.okValue,
callback: a.ok,
important: !0,
focus: !0
}), a.cancel && a.button.push({
id: "cancel",
value: a.cancelValue,
callback: a.cancel
}), new d.fn.constructor(a))
};
d.fn = d.prototype = {
constructor: function(a) {
var b;
return this.config = a,
this.dom = b = this.dom || this.createHTML(a),
this.button.apply(this, a.button),
this.title(a.title).content(a.content).iframe(a.iframe).padding(a.padding).size(a.height, a.width).timeout(a.timeout),
this.reset(),
this.zIndex(),
this.addEvent(),
this.dom.dialog.show(),
a.initialize && a.initialize.call(this),
this
},
createHTML: function(b) {
a("body").append(d.template.replace(/{tpl:([^}]+)}/g,
function(a, c) {
var d = b[c];
return "string" == typeof d ? d: ""
}));
var c = {};
return c.dialog = a("#" + b.id),
c.shadow = a("#" + b.id + "_shadow"),
c.title = a("#" + b.id + "_title"),
c.content = a("#" + b.id + "_content"),
c.close = a("#" + b.id + "_close"),
c.buttons = a("#" + b.id + "_buttons"),
c.timeout = a("#" + b.id + "_timeout"),
b.shadow && a("#" + b.id + "_shadow").show(),
b.close || a("#" + b.id + "_close").hide(),
OW.move(document.getElementById(b.id + "_titleBar"), document.getElementById(b.id)),
c
},
button: function() {
var g, h, i, j, k, d = this.dom.buttons,
e = this.Listeners = this.Listeners || {},
f = [].slice.call(arguments);
for (g = 0; g < f.length; g++) val = f[g],
h = val.value,
i = val.id || h,
j = !e[i],
k = j ? document.createElement("button") : e[i].button,
k.className = "btn",
e[i] || (e[i] = {}),
h && a(k).html(h),
val.important && a(k).addClass("btn-primary"),
val.remove && a(k).remove(),
val.callback && (e[i].callback = val.callback),
k[c + "callback"] = i,
val.disabled ? (a(k).attr("disabled", !0), a(k).addClass("disabled")) : (a(k).attr("disabled", !1), a(k).removeClass("disabled")),
j && (e[i].button = k, d.append(k)),
val.focus && a(k).focus();
return d.find("button").length < 1 ? d.hide() : d.show(),
this
},
title: function(a) {
var b = this.dom.title;
return a ? (b.html(a), b.show()) : b.hide(),
this
},
content: function(a) {
return this.dom.content.html(a),
this
},
fontSize: function(a) {
return this.dom.content.css("font-size", a),
this
},
alert: function(a) {
return a = OW.isNull(a) ? "": a,
this.dom.content.addClass("ow-dialog-content-alert").html(a),
this.timeout(4),
this
},
success: function(a) {
return a = OW.isNull(a) ? "": a,
this.dom.content.addClass("ow-dialog-content-success").html(a),
this.timeout(4),
this
},
error: function(a, b) {
var c = OW.isNull(a) ? "": '
' + a + "
",
d = OW.isNull(b) ? "": '
閿欒淇℃伅
' + b + "
",
e = c + d;
return this.dom.content.addClass("ow-dialog-content-error").html(e),
this.timeout(4),
this
},
loading: function(a) {
return a = OW.isNull(a) ? "浜诧紝鎴戞鍦ㄥ姫鍔涘姞杞芥暟鎹紝璇风◢鍊?..": a,
this.dom.content.html('
' + a + "
"),
this
},
posting: function(a) {
return a = OW.isNull(a) ? "浜诧紝鎴戞鍦ㄦ彁浜や繚瀛樻暟鎹紝璇风◢鍊?..": a,
this.dom.content.html('
' + a + "
"),
this
},
top: function() {
var a = b,
c = function(a) {
try {
var c = b[a].document;
c.getElementsByTagName
} catch(d) {
return ! 1
}
return b[a].artDialog && 0 === c.getElementsByTagName("frameset").length
};
return c("top") ? a = b.top: c("parent") && (a = b.parent),
a
},
footerFix: function(a) {
return this.dom.dialog,
height = a.height || "",
this.dom.dialog.css({
position: "fixed",
left: "0px",
top: "auto",
bottom: "0px",
width: "100%"
}),
this.dom.content.css({
width: "100%"
}),
OW.isNotNull(height) && (height = OW.int(height) / 100 * OW.webScreenHeight(), this.dom.content.css("height", height)),
this
},
iframe: function(b) {
var e, c = this,
d = this.config.id;
return b && (this.dom.content.css("overflow", "hidden"), e = c.top().document.createElement("iframe"), e.src = b + "&dialog_id=" + d, e.name = c.config.id + "_iframe", e.setAttribute("frameborder", 0, 0), e.setAttribute("frameborder", 0, 0), e.setAttribute("allowTransparency", !0), e.setAttribute("dialog", !0), $iframe = a(e), $iframe.addClass("ow-dialog-iframe").attr("id", "" + d + "_iframe"), c.dom.content.html(e), this.dom.iframe = e),
this
},
padding: function(a) {
return this.dom.content.css("padding", a),
this
},
size: function(a, b) {
var c = this.dom.title,
d = this.dom.buttons;
return a = OW.int(a),
b = OW.int(b),
"none" != c.css("display") && (a -= OW.int(c.height())),
"none" != d.css("display") && (a -= 40),
a > 0 && (this.dom.content.css({
height: a + "px"
}), this.dom.content.find("iframe[name='dialog-iframe']").css({
height: a + "px"
})),
b > 0 ? (this.dom.content.css({
width: b + "px"
}), this.dom.content.find("iframe[name='dialog-iframe']").css({
width: b + "px"
})) : (b = OW.int(OW.webScreenWidth()) - 80, this.dom.content.css("max-width", b + "px"), this.dom.content.find("iframe[name='dialog-iframe']").css("max-width", b + "px")),
this
},
follow: function(b) {
var c = this.dom.dialog,
d = a(b),
e = d.attr("offsetWidth"),
f = d.attr("offsetHeight"),
g = d.offset(),
h = g.left,
i = g.top,
j = parseInt(c.width()),
k = OW.webScreenWidth();
return h + j - 20 > k && (h = k - j - 100),
c.css({
position: "absolute",
left: h + e / 2,
top: i + f
}),
this
},
position: function(a) {
var b, d, e, f, g, h;
return a = a || "",
b = this.dom.dialog,
this.dom.title,
d = "none" != this.dom.close.css("display") ? parseInt(this.dom.close.width()) : 0,
e = parseInt(a.left || (OW.webScreenWidth() - parseInt(b.width()) - d) / 2),
f = parseInt(OW.documentScrollTop()),
g = (OW.webScreenHeight() - parseInt(b.height())) / 2,
h = parseInt(a.top || f + g) + 2,
0 > e && (e = 2 * e),
10 > h && (h = 10),
b.css({
position: "absolute",
left: e,
top: h
}),
this
},
fixTop: function(a) {
a = OW.int(a);
var b = this.dom.dialog,
c = "none" != this.dom.close.css("display") ? parseInt(this.dom.close.width()) : 0;
left = parseInt((OW.webScreenWidth() - parseInt(b.width()) - c) / 2),
b.css({
position: "fixed",
left: left + "px",
top: a + "px"
})
},
reset: function() {
return this.config.follow ? this.follow(this.config.follow) : this.position(this.config.position),
this
},
shadow: function(a) {
return a ? this.dom.shadow.show() : this.dom.shadow.hide(),
this
},
shadowBackground: function(a) {
return this.dom.shadow.css("background", a),
this
},
close: function() {
var a = this.dom.dialog,
b = this.config.beforeClose,
c = this.config.afterClose;
return this.removeEvent(),
b && b.call(this) === !1 ? this: (this.dom.shadow.remove(), a.remove(), c && c.call(this) === !1 ? this: void 0)
},
removeClose: function(a) {
var b = a ? a: !0;
b && this.dom.close.hide()
},
click: function(a) {
var b = this.Listeners[a] && this.Listeners[a].callback;
return "function" != typeof b || b.call(this) !== !1 ? this.close() : this
},
timeout: function(a) {
var c = this,
d = this.TIMER;
return d && clearTimeout(d),
null !== a && (this.dom.timeout.html(this.config.timeTip.replace("{tpl:time}", a)), a = parseInt(a - 1), a >= 0 ? this.TIMER = b.setTimeout(function() {
c.timeout(a)
},
1e3) : c.close()),
this
},
addEvent: function() {
var a = this,
b = this.dom,
d = this.dom.dialog;
d.bind("click",
function(d) {
var e, f = d.target;
return f.disabled ? !1 : f === b.close[0] ? (a.click("cancel"), !1) : (e = f[c + "callback"], e && a.click(e), void 0)
}).bind("mousedown",
function() {})
},
removeEvent: function() {
this.dom.dialog.unbind()
},
zIndex: function() {
var a = this.dom,
b = OWDialog.defaults.zIndex++;
return a.shadow.css("zIndex", b + 1),
a.dialog.css("zIndex", b + 2),
this
}
},
d.fn.constructor.prototype = d.fn,
d.defaults = {
id: "dialog",
title: null,
content: '