锘
function initgb(url) {
if ($("#NewGBForm").length == 0) {
GetGuestExtSettings(function (json) {
var t = 0;
if ($("#GBTYPEID").length != 0) {
t = parseInt($("#GBTYPEID").val());
};
var formid = "";
for (var i = 0; i < json.items.length; i++) {
if (t == json.items[i].typeid) {
formid = json.items[i].extform;
}
}
if (formid != "") {
GetExtForms(formid, function (html) {
$("#gbextforms").html(html);
InitFormVerify({ el: "#GBFORM" });
});
}
else {
InitFormVerify({ el: "#GBFORM" });
}
});
$("#GBPOST").click(function () {
var title = $("#GBTITLE").val();
var content = $("#GBCONTENT").val();
var user = "";
var tel = "";
var cap = $("#GBCAPTHCA").val();
if ($("#GBUSER").length != 0) {
user = $("#GBUSER").val();
}
if ($("#GBTEL").length != 0) {
tel = $("#GBTEL").val();
}
var im = "";
var t = -1;
if ($("#GBTYPEID").length != 0) {
t = $("#GBTYPEID").val();
}
if ($("#GBIM").length != 0)
im = $("#GBIM").val();
if (title.length == 0) {
alert(rclng.gbnotitle);
return;
}
if (content.length == 0) {
alert(rclng.gbnocontent);
return;
}
var usecap = 0;
if ($("#GBCAPTHCA") != null) {
if (cap.length == 0) {
alert(rclng.novalidcode);
return;
}
usecap = 1
}
jQuery.post(webhttp + "index.aspx?a=g", {
title: title,
user: user,
tel: tel,
content: content,
im: im,
cap: cap,
usecap: usecap,
t: t
}, function (ret) {
alert(ret);
ClearFormData({ el: "#GBFORM" });
$("#GBCAPTCHAIMG").html("");
});
});
if ($("#GBCAPTCHAIMG") != null && $("#GBCAPTHCA") != null) {
$("#GBCAPTCHAIMG").html("
");
}
}
else { initguestbook(url); }
}
function initguestbook(url) {
GetGuestExtSettings(function (json) {
var t = 0;
if ($("#GBTYPEID").length != 0) {
t = parseInt($("#GBTYPEID").val());
};
var formid = "";
for (var i = 0; i < json.items.length; i++) {
if (t == json.items[i].typeid) {
formid = json.items[i].extform;
}
}
if (formid != "") {
GetExtForms(formid, function (html) {
$("#gbextforms").html(html);
InitFormVerify({ el: "#GBFORM" });
});
}
else {
InitFormVerify({ el: "#GBFORM" });
}
});
$("#GBPOST").click(function () {
VerifyFormData({ el: "#GBFORM" }, function (postdata, extdata) {
postdata.cap = $("#GBCAPTHCA").val();
postdata.usecap = 0;
if ($("#GBCAPTHCA").length > 0) {
if (postdata.cap.length == 0) {
alert(rclng.novalidcode);
return false;
}
postdata.usecap = 1;
}
postdata.otherinfo = extdata;
var t = -1;
if ($("#GBTYPEID").length != 0) {
t = $("#GBTYPEID").val();
}
postdata.t = t;
jQuery.post(webhttp + "index.aspx?a=g",
postdata
, function (ret) {
alert(ret);
ClearFormData({ el: "#GBFORM" });
$("#GBCAPTCHAIMG").html("
");
});
});
});
if ($("#GBCAPTCHAIMG") != null && $("#GBCAPTHCA") != null) {
$("#GBCAPTCHAIMG").html("
");
}
}
function initorder(url) {
InitFormVerify({ el: "#ORDERFORM" });
$("#ORDERPOST").click(function () {
VerifyFormData({ el: "#ORDERFORM" }, function (postdata,extdata) {
postdata.cap = $("#ORDERCAPTHCA").val();
postdata.usecap = 0;
if ($("#ORDERCAPTHCA") != null) {
if (postdata.cap.length == 0) {
alert(rclng.novalidcode);
return false;
}
postdata.usecap = 1;
}
postdata.otherinfo = extdata;
jQuery.post(webhttp + "index.aspx?a=order",
postdata
, function (ret) {
alert(ret);
ClearFormData({ el: "#ORDERFORM" });
$("#ORDERCAPTCHAIMG").html("
");
if (Inquerycallback != undefined) {
Inquerycallback();
}
});
});
});
if ($("#ORDERCAPTCHAIMG") != null && $("#ORDERCAPTHCA") != null) {
$("#ORDERCAPTCHAIMG").html("
");
}
}
function initInput(cfg) {
$(cfg.el).attr("replacetxt", cfg.replacetxt).focus(function () {
if ($(this).val() == $(this).attr("replacetxt")) {
$(this).val("")
}
}).blur(function () {
if ($(this).val() == "") {
$(this).val($(this).attr("replacetxt"));
}
});
}
function AddToInqurieBasket(url) {
$.get(url, {}, function (data) {
alert(data.returnmsg);
if (data.result == "-2") {
location.href = data.url;
}
}, "json");
}
function initsimplesearch(url) {
$("#PDPOST").click(function () {
GoSearch();
});
$("#PDQUERY").on("keypress", function (event) {
if (event.keyCode == 13)
{
GoSearch();
}
});
var GoSearch = function () {
var q = $("#PDQUERY").val();
if ($("#PDQUERY").attr("replacetxt")) {
if ($("#PDQUERY").attr("replacetxt") == q) {
$("#PDQUERY").focus();
return false;
}
}
var psize = 10;
if ($("#PSIZE").length == 1) {
psize = $("#PSIZE").val();
}
if (q == null || q.length == 0) {
alert(rclng.noquerykey);
$("#PDQUERY").focus();
return;
}
var t = ($("#PDNAME").attr("checked") != null) ? 1 : (($("#PDCASNO").attr("checked") != null) ? 0 : 1);
if ($("#PDSNTYPE").length != 0) {
t = $("#PDSNTYPE").val();
}
var searchtype = 1;//1鏅€?鎵归噺
if ($("#PDSEARCHTYPE").length == 1) {
searchtype = $("#PDSEARCHTYPE").val();
}
if (searchtype == "2") {
q = $("#PLSEARCHQUERY").val();
}
var temp = "";
if ($("#PDSEARCHTEMPLATE").length != 0) {
temp = $("#PDSEARCHTEMPLATE").val();
}
if (searchtype == "4") {
location.href = webhttp + "index.aspx?a=is&psize=" + psize + "&kw=" + encodeURIComponent(q) + "&searchtmp=" + temp;
}
else {
location.href = webhttp + "index.aspx?a=s&searchtype=" + searchtype + "&psize=" + psize + "&q=" + encodeURIComponent(q) + "&searchtmp=" + temp + "&t=" + t;
}
}
}
function OpenPlLiangDialog()
{
OpenDialog({
el: "#PlLiangDialog",
title: rclng.multsearch,
width: 400
})
}
function GoPiLiangSearch()
{
var q = $.trim($("#PlSearchKeyArea").val());
if (q != "") {
location.href = webhttp + "index.aspx?a=s&searchtype=2&psize=50&q=" + encodeURIComponent(q) + "&searchtmp=goodssearch";
}
else {
alert(rclng.casrequired);
}
}
function initBatchSearch() {
$(".batchsearchresultbox").html('' + rclng.pending + '');
setTimeout(function () {
goBatchSearch();
}, 1000);
}
function goBatchSearch(callback) {
if ($(".batchsearchitem").length > 0) {
var pitem = $(".batchsearchitem").eq(0);
var id = pitem.attr("refid");
var cas = pitem.attr("cas");
$("#batchsearchresultbox_" + id).html('' + rclng.searching + '......');
$.post(webhttp+"index.aspx", { Action: "post", a: 's', searchtype: 3, q: cas },
function (data, textStatus) {
// data 鍙互鏄 xmlDoc, jsonObj, html, text, 绛夌瓑.
//this; // 杩欎釜Ajax璇锋眰鐨勯€夐」閰嶇疆淇℃伅锛岃鍙傝€僯Query.get()璇村埌鐨則his
//alert(data.myRecord);
//alert(data.result);
if (callback != undefined)
{
callback(id, data);
}
else
{
var done = parseInt(data.result);
if (done == -1) {
$("#batchsearchresultbox_" + id).html('' + data.returnmsg + '')
}
else if (done == 1) {
var list = data.data.list;
var ohtml = rclng.searchresult + "锛欬font color=\"red\">" + list.length + "锛欬br />