锘縡unction FillReturnMsg(o, t, msg) {
var tip = $("span.formcolumn-item-tipstxt", $(o).parent());
if ($("span.formcolumn-item-errtipstxt", $(o).parent()).length > 0) {
tip = $("span.formcolumn-item-errtipstxt", $(o).parent());
}
tip.html(msg);
if (t == 1) {
$(o).removeClass("needFill");
tip.css("color", "green");
}
else if (t == 0) {
$(o).addClass("needFill");
tip.css("color", "red");
}
else if (t == 2) {
$(o).removeClass("needFill");
tip.css("color", "#999999");
}
}
function InitFormVerify(cfg)
{
if (typeof (InitExtCountry) == "function")
{
InitExtCountry();
}
$("input[exrequired='true'],textarea[exrequired='true']", cfg.el).after(" *");
$("input[exrequired='true'],textarea[exrequired='true']", cfg.el).each(function () {
if ($(this).attr("onblur") == undefined) {
$(this).on("blur", function () {
var v = $(this).val();
if (v != "") {
FillReturnMsg(this, 1, " ");
}
else {
if ($(this).attr("title")) {
FillReturnMsg(this, 0, GetLangTxt(rclng.itemrequired, [{ title: "title", text: $(this).attr("title") }]));
}
else {
FillReturnMsg(this, 0, "");
}
}
});
}
});
}
function AjaxReturn(ret, callback) {
var rc = ret.value;
if (rc) {
callback();
}
else {
alert(ret.error.Message);
}
}
function OpenDialog(cfg) {
$(cfg.el).dialog({
title: cfg.title,
autoOpen: true,
modal: true,
width: cfg.width,
resizable: false,
close: function () {
$("body").css("overflow", "auto");
NowOpenDialogEl = '';
},
open: function () {
$("body").css("overflow", "hidden");
if (cfg.opencallback != undefined) {
cfg.opencallback();
}
}
});
}
function Alert(msg, title, width) {
if (title == undefined) {
title = "" + rclng.sysalert;
}
if (width == undefined) {
width = 400;
}
if ($("#AlertDialog").length == 0) {
$("body").append('
');
}
OpenDialog({
el: "#AlertDialog",
width: width,
title: title,
buttons: [
{
text: "" + rclng.sysok,
icons: {
primary: "ui-icon-heart"
},
click: function () {
$(this).dialog("close");
}
}
],
opencallback: function () {
$("#AlertMsgBox").html(msg);
}
});
}
function CloseDialog(el) {
$(el).dialog("close");
}
function AutoCenterDialog(el) {
$(el).dialog("option", "position", "center");
}
function initCloseBtn(o) {
if (o != undefined) {
$("input[closebtn='true']", o).bind("click", function () {
var el = $(this).attr("reel");
$("#" + el).dialog("close");
})
}
else {
$("input[closebtn='true']").bind("click", function () {
var el = $(this).attr("reel");
$("#" + el).dialog("close");
})
}
}
function GetExtAttrValues(cfg)
{
var extv = {};
$("input[dataref='true'],textarea[dataref='true'],select[dataref='true'],span[addresstype],span[countrytype]", $(cfg.el)).each(function () {
if (extv[$(this).attr("classname")] == undefined)
{
extv[$(this).attr("classname")] = {};
}
if ($(this).hasClass("address_extipt")) {
var vxv = "";
if ($(this).attr("areacode") != "") {
vxv = $(this).attr("areacode") + "|" + $(this).attr("areatitle");
}
extv[$(this).attr("classname")][$(this).attr("relkey")] = vxv;
}
else if ($(this).hasClass("country_extipt")) {
var vxv = "";
if ($(this).attr("countrycode") != "") {
vxv = $(this).attr("countrytitle") + "|" + $(this).attr("countrycode");
}
extv[$(this).attr("classname")][$(this).attr("relkey")] = vxv;
}
else {
extv[$(this).attr("classname")][$(this).attr("relkey")] = $(this).val();
}
});
var r = {};
r.str = JSON2.stringify(extv);
r.json = extv;
return r;
}
function ClearFormData(cfg, callback)
{
$("input[dataref='true'][type!='checkbox'],textarea[dataref='true'],input[data-ref][type!='checkbox'],textarea[data-ref]", $(cfg.el)).val("");
if (callback != undefined) {
callback();
}
}
function VerifyFormData(cfg, callback)
{
var success = true;
var postdata = {};
$("input[dataref='true'],textarea[dataref='true'],select[dataref='true'],input[data-ref],textarea[data-ref],span[addresstype],span[countrytype]", $(cfg.el)).each(function () {
var v = "";
if ($(this).attr("addresstype") != undefined || $(this).attr("countrytype") != undefined) {
v = $(this).attr("areacode");
}
else {
v = $(this).val();
}
if ($(this).attr("exrequired") == "true"&&v=="")
{
alert(GetLangTxt(rclng.itemrequired, [{ title: "title", text: $(this).attr("title") }]));
success = false;
$(this).focus();
return false;
}
if ($(this).attr("data-ref") != undefined) {
if ($(this).attr("type") != undefined) {
if ($(this).attr("type") == "checkbox") {
if ($(this).is(":checked")) {
postdata[$(this).attr("data-ref")] = v;
}
else {
postdata[$(this).attr("data-ref")] = "";
}
}
else {
postdata[$(this).attr("data-ref")] = v;
}
}
else {
postdata[$(this).attr("data-ref")] = v;
}
}
});
if (success)
{
var extdata = GetExtAttrValues(cfg);
callback(postdata, extdata.str,extdata.json);
}
}
function JsonToDict(data) {
var dict = new Ajax.Web.Dictionary("Dictionary");
for (var jd in data)
{
dict.add(jd, data[jd]);
}
return dict;
}
function InitUserLoginStatus(cfg)
{
$.get( "/index.aspx?a=checkuserlogin&mfrsh="+Math.random(), {}, function (data) {
if (cfg.callback == undefined) {
if (data.result == "1") {
$(cfg.el).html(rclng.hello+'锛?b>' + data.username + ' ' + rclng.membercenter + ' ' + rclng.loginout + ' ');
}
else if (data.result == "-1") {
$(cfg.el).html('' + rclng.login + ' ' + rclng.register + ' ');
}
if (cfg.ondone != undefined)
{
cfg.ondone(data);
}
}
else {
cfg.callback(data);
}
}, "json");
}
function ViewVerifyImage(cfg)
{
$(cfg.el).html('
');
}
function ReFreashVerifyImg(o)
{
var verifytype = $(o).attr("verifytype");
var veid = $(o).attr("vref");
$(o).attr("src", "/index.aspx?a=verifycode&verifytype=" + verifytype + "&r=" + Math.random());
$(veid).val("");
}
function VerifyCodeCheck(o) {
var v = $(o).val();
Web960.Web.index.verifyRegCode(v, "userlogin", function (res) {
AjaxReturn(res, function () {
var rv = res.value;
if (rv.Status == "1") {
}
else {
// rv.ClientMsg
}
});
});
}
function InitDataMapping()
{
$.get("/index.aspx?a=getuserinfo", {}, function (data) {
if (data.IntResult == 1) {
//logined;
var comment = eval("(" + data.ObjResult.comment + ");");
$("input[data-mapping],textarea[data-mapping],select[data-mapping]").each(function () {
var mapping = $.trim($(this).attr("data-mapping"));
if (mapping != "")
{
try{
var v = eval("(comment." + mapping + ");");
$(this).val(v);
}
catch(e){}
}
})
}
}, "json");
}
function GetGuestExtSettings(callback)
{
$.get( "/index.aspx?a=g&getmethod=getsettings", {}, function (data) {
if (data.IntResult == 1) {
var json = eval('(' + data.StrResult + ')');
callback(json);
}
}, "json");
}
function GetExtForms(formid,callback) {
$.get( "/index.aspx?a=g&getmethod=getextforms&formid=" + formid, {}, function (data) {
if (data.IntResult == 1) {
callback(data.StrResult);
}
}, "json");
}
function Guid(callback)
{
$.get("/index.aspx?a=guid&rnd="+Math.random(1), {}, function (data) {
callback(data.guid);
}, "json");
}
function GoToPage(o)
{
var v = $.trim($(o).val());
var patrn = /^[1-9]*[1-9][0-9]*$/;
if (patrn.exec(v)) {
var page = parseInt(v);
var url = $(o).attr("pageurl");
var pagecount = parseInt($(o).attr("pagecount"));
if (page <= 1)
{
url = url.replace("-{0}", "").replace("_{0}", "");
}
else if (page > pagecount)
{
page = pagecount;
url = url.replace("{0}", page);
}
else
{
url = url.replace("{0}", page);
}
location.href = url;
}
}
function jumppropage(o) {
var v = $.trim($(o).val());
var url = $("#wpagenavgotuipt").attr("pageurl");
var pagecount = parseInt($(o).attr("pagecount"));
url = url.replace("-{0}", "").replace("_{0}", "").replace("page={0}", "page=").replace("&psize", "&apsizeq").replace("?psize", "?apsizeq");
if (url.indexOf("?") == -1) {
location.href = url + "?psize=" + v;
} else {
location.href = url + "&psize=" + v;
}
}
function GetSimpMoneyUnit(m)
{
switch (m)
{
case "CNY":
case "鍏?:
return "楼";
case "USD":
return "$";
case "HKD":
return "HK$";
case "EUR":
return "鈧?;
}
}
function InitBrowseHistoryCookie(cookiename,cookievalue,savetime)
{
var str = cookiename + "=" +escape( cookievalue);
var date = new Date();
var ms=savetime*60*1000;
date.setTime(date.getTime() + ms);
str += ";expires=" + date.toGMTString();
document.cookie = str;
}
var nowExtUploadRefId = "";
var BFCallBack = null;
function ExtUpload(t, elid,callback)
{
BFCallBack = callback;
var dialoghtml = '';
if ($("#ExtUploadDialog").length == 0) {
$("body").append(dialoghtml);
ExtUpload(t, elid);
}
else {
$("#uploadnoticediv").html("");
nowExtUploadRefId = elid;
if (t == 1) {
title = rclng.uploadimage;
$("#ExtUploadForm").attr("action", "/admin/filehandler.aspx?t=100&dir=image&id=0&n=0&cb=ExtUploadCallBack");
} else if (t == 2) {
title = rclng.uploadfile;
$("#ExtUploadForm").attr("action", "/admin/filehandler.aspx?t=110&dir=file&id=0&n=0&cb=ExtUploadCallBack");
}
OpenDialog({ el: "#ExtUploadDialog", width: 410, title: title });
}
}
function ExtUploadCallBack(res) {
if (res.error == "1") {
alert(res.message);
}
else {
var fileName = res.filename;
$("input[id$='" + nowExtUploadRefId+"'").val(fileName);
if (BFCallBack) {
BFCallBack(fileName);
}
$("#ExtUploadDialog").dialog("close");
}
}
///鑾峰彇寰呯‘璁よ鍗曠殑鏁伴噺
function GetCountorderwating() {
$.get("/index.aspx?a=getorderwatingcount", {}, function (data) {
var res = data;
if (data.result == 1) {
var ct = data.count;
if ($(".ordermanage_orderwating").length > 0) {
var sphtm = ""+ct+"";
$(".ordermanage_orderwating a").append(sphtm);
}
}
}, "json");
}