PageSourceSearch

https://fufashoes.com/Common/Js/actOrderCommon.js?_t=26062910_0

js fufashoes.com collected 2026-10-07 21:52:40 UTC 44,265 bytes, 1,335 lines download raw bytes

1$.ajaxSetup({ cache: false });
2 /*
3function b64_to_utf8(str) {
4    //if (!window.btoa) window.btoa = base64.encode;
5    if (!window.atob) {
6        return base64Decode(str, UTF8);
7        return "";
8    }
9    return decodeURIComponent(escape(window.atob(str)));
10}
11
12
13
14function stringFromUTF8Array(data) {
15    var extraByteMap = [1, 1, 1, 1, 2, 2, 3, 0];
16    var count = data.length;
17    var str = "";
18    for (var index = 0; index < count;) {
19        var ch = data[index++];
20        if (ch & 0x80) {
21            var extra = extraByteMap[(ch >> 3) & 0x07];
22            if (!(ch & 0x40) || !extra || ((index + extra) > count))return null;
23            ch = ch & (0x3F >> extra);
24            for (; extra > 0; extra -= 1) {
25                var chx = data[index++];
26                if ((chx & 0xC0) != 0x80)return null;
27                ch = (ch << 6) | (chx & 0x3F);
28            }
29        }
30        str += String.fromCharCode(ch);
31    }
32    return str;
33}*/
34/* 
35//20261209 del , systemcommon.js已整合,而且systemcommon.js會先載入
36
37function ParsePakoArray(str) {
38    if (str.indexOf('[,]') === -1) {
39        return pakoInflate(str);
40    }
41    var ary = str.split('[,]');
42    var s = "";
43    for (var i = 0; i < ary.length; i++) {
44        var v = ary[i];
45        if (v.length == 0) continue;
46        //  console.log(ary[i]);
47        s += pakoInflate(v);
48    }
49    return s;
50}
51
52function ParseJSON(str) { //20180109
53    return ParseJson(str);
54}
55function ParseJson(str) { //留著相容舊版。整合到。systemcommon.js了
56    if ((str.length > 5) && (str[0] == '@') && (str[1] == 'p') && (str[2] == 'a') && (str[3] == 'o') && (str[4] == ':')) { str = pakoInflate(str.substr(5)); }
57    if ((str.length > 5) && (str[0] == '@') && (str[1] == 'p') && (str[2] == 'a') && (str[3] == 'o') && (str[4] == 'a')) { str = ParsePakoArray(str.substr(6)); }
58    else if ((str[0] != '{') && (str[0] != '[')) { str = b64_to_utf8(str); }
59    else {
60        str = str.replace(/\"\\&quot;/g, "\\\"").replace(/\\&quot;\"/g, "\\\"")
61            .replace(/\\&quot;\/\">/g, "\\\"/>") //img "/> 結尾會有問題
62            .replace(/\\&quot;/g, "\\\\&quot;")
63            ;
64    }
65
66    try {
67        return jQuery.parseJSON(str);
68    } catch (e) {
69        console.log(e + "\r\n" + str);
70    }
71}
72
73*/
74function includeJs(src) {
75    var s = document.createElement('script');
76    s.setAttribute('type', 'text/javascript');
77    s.setAttribute('src', src);
78    var head = document.getElementsByTagName('head')[0];
79    if (head) head.appendChild(s);
80    else document.body.appendChild(s);
81}
82
83function includeCss(href) {
84    var s = document.createElement('link');
85    s.setAttribute('type', 'text/css');
86    s.setAttribute('rel', 'stylesheet');
87    s.setAttribute('href', href);
88    var head = document.getElementsByTagName('head')[0];
89    if (head) head.appendChild(s);
90    else document.body.appendChild(s);
91}
92
93String.format = function (src) {
94    if (arguments.length == 0) return null;
95    var args = Array.prototype.slice.call(arguments, 1);
96    return src.replace(/\{(\d+)\}/g, function (m, i) {
97        return args[i];
98    });
99};
100
101 
102function GetFbItemListAry(count) {
103    if (count == undefined) count = 5;    
104    if (typeof (sit) != 'undefined') return sit;
105    var sit = [];
106    if ($("#itemListJson").length == 1) {
107        //itemListJson
108        var data;
109        if (typeof (itemListJson) != 'undefined') { data = ParseJson(itemListJson); }
110        else { data = ParseJson($("#itemListJson").html()); }
111        var i = 0;
112        var cSetup;
113        var m1;
114        var dataLs;
115        //vmItemList
116        if ((typeof vmItemList != 'undefined') && (!IsUn(vmItemList.m)) && (!IsUn(vmItemList.m.Data))) {
117            dataLs = vmItemList.m.Data.StItem;
118        } else
119            if ((typeof vm != 'undefined') && (!IsUn(vm.m)) && (!IsUn(vm.m.Data))) {
120            dataLs = vm.m.Data.StItem;
121        } else
122        if (typeof (data.Data.StItem) != 'undefined') { dataLs = data.Data.StItem; }
123        else { dataLs = data.Data;}
124        for (it in dataLs) {
125            m1 = dataLs[it].merNo1;
126            sit[i] = m1;/*
127            if (data.ItemShowMode == 1) {
128                for (c in data.Data[it].ColorSetup){
129                    cSetup = data.Data[it].ColorSetup[c];
130                    sit[i] = m1 + "_" + cSetup.Color;
131                    i++;
132                    if (i == count) {
133                        break;
134                    }
135                }
136            }
137            if (data.ItemShowMod != 1) i++;*/
138            i++;
139            if (i == count) {
140                break;
141            }
142        }
143        return sit;
144    }
145    var oDv = $(".itemListDiv,.fbNo1,.m_itemListDiv");
146    
147    var iNo = 0;
148    var isFind = false;
149    for (var i = 0; i < oDv.length; i++) {
150        var fid = $(oDv[i]).attr("mNo1");
151        if ((fid != undefined) && (fid.length > 0)) {
152            isFind = false;
153            for (var j = 0; j < sit.length; j++) {
154                if (sit[j] == fid) { isFind = true; break;}
155            }
156            if (isFind) continue;
157            sit[iNo] = fid;
158            iNo++;
159            if (iNo >= count) break;
160        }
161    }
162    if ((iNo <= 0)&&(typeof (content_ids) != 'undefined')) return content_ids;
163    return sit;
164}
165
166
167$(function () {    
168    AutoIFrameHeight();
169    SetIFrameBk();
170    setTimeout(AutoIFrameHeight, 1000);
171    setTimeout(AutoIFrameHeight, 3000);
172    var obj = $("#floatlayer");
173    if (typeof (obj) != 'undefined') {
174        $(window).resize(function () {
175            SetFloatlayerLeft(obj);
176            //obj.css("z-index", getBrowserWidth());
177        });
178        SetFloatlayerLeft(obj);
179    }
180    $("#coChk").removeAttr("checked");
181
182    var objMoStr = $("[mostr]");
183    if (objMoStr.length >= 1) {
184
185        objMoStr.each(function () {
186
187            var ths = $(this);
188            var divDt = ths.parent();
189            divDt.data('img1', ths.html());
190            divDt.data('img2', ths.attr('mostr'));
191
192            divDt.hover(function () {
193                ths.html($(this).data('img2'))
194            }, function () {
195                ths.html($(this).data('img1'))
196            });
197
198        });
199    }
200    $(window).resize(function () {
201        BindMobile();
202    });
203    BindMobile();
204 
205});
206
207function CheckJquery() {
208    //check Jquery
209    var ver = $().jquery;
210    if ((ver != "1.12.0") && (ver != "1.12.4") && (ver != "1.8.1") && (ver != "1.9.1") && (ver != "3.6.4")) {
211        alert("請勿重覆載入Jquery!" + ver);
212    }
213}
214
215function TimerCheckJquery() {
216    setInterval(function () { CheckJquery(); }, 3000);
217}
218
219/*
220function BindMoImg(atype) {
221    var objImg = $("[moimg]");
222    if (atype == "mouseover") {
223        objImg.mouseover(function () {
224            var objThis = $(this).parent();
225            objThis.html(objThis.attr("mostr"));
226            var objimg2 = objThis.find("img");
227            objimg2.attr("moimg", "1");
228            BindMoImg("mouseout");
229        });
230    } else {
231        objImg.attr("onmouseout", "moimgout(this);");
232    }
233}
234
235function moimgout(sender) {
236    $(sender).attr("now", new Date());
237    var objThis = $(sender).parent();
238    objThis.html(objThis.attr("mosouce"));
239    var objimg2 = objThis.find("img");
240    objimg2.attr("moimg", "1");
241    BindMoImg("mouseover");
242}
243*/
244
245function SetFloatlayerLeft(obj) {
246    var w = getBrowserWidth();
247    if (/msie/.test(navigator.userAgent.toLowerCase())/*$.browser.msie*/) {
248        obj.css("margin-left", (520 - (w / 2)) + "px");
249    } else {
250        obj.css("margin-left", (645 - (w / 2)) + "px");
251    }
252}
253
254
255function getBrowserWidth() {
256    if (/msie/.test(navigator.userAgent.toLowerCase())/*$.browser.msie*/) {
257        return document.compatMode == "CSS1Compat" ? document.documentElement.clientWidth :
258	                 document.body.clientWidth;
259    } else {
260        return self.innerWidth;
261    }
262}
263
264function AutoIFrameHeight() {
265    var objIframe = $(".autoHeight");
266    for (var i = 0; i < objIframe.length; i++) {
267        dyniframesize(objIframe[i]);
268    } 
269}
270
271function GetHeight(obj) {
272    var h = obj.contents().find("body").height() + 50;
273    if (h = 50) return 400;
274    return h;
275}
276
277function dyniframesize(pTar) {
278    try {
279        if (pTar && !window.opera) {
280            if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight) {
281                //ns6 syntax
282                pTar.height = pTar.contentDocument.body.offsetHeight + 50;
283            }
284            else {
285                if (pTar.Document && pTar.Document.body.scrollHeight) {
286                    //ie5+ syntax
287                    pTar.height = pTar.Document.body.scrollHeight + 50;
288                }
289            }
290        }
291    } catch (Error) {
292    }
293}
294
295function SetIFrameBk() {
296    if (location.hash.length > 0) {
297        var objIframe = $(".autoHeight");
298        objIframe.attr("src", function () {
299            this.src = this.src + location.hash;
300            //alert(this.src);
301        });
302    }
303}
304
305
306function SetShow(value, objItem, speed) {
307    //alert(value.html());
308    if (value.html().length > 0) {
309        objItem.fadeIn(speed);
310    } else {
311        objItem.fadeOut(speed);
312    }
313}
314
315function SetTextRequired(value, obj) {
316    if (value.html().length > 0) {
317        obj.addClass("Required");
318    } else {
319        obj.removeClass("Required");
320    }
321}
322
323function SetShowHide(valueStr, objItem) {
324    if ((valueStr.length <= 0) || (valueStr == "0") || (valueStr == "False") || (valueStr == false)) {
325        objItem.hide();
326    } else {
327        objItem.show();
328    }
329}
330
331//看需要檢查的欄位,是不是都有值
332function isRequired() {
333    //要找class=Required type="text"
334    var errMsg = GetRequiredErrMsg();
335    obj = $("[class*='ReqDate']");
336    obj.removeClass("ReqShowStyle");
337    for (i = 0; i < obj.length; i++) {
338        //alert(obj[i].value);
339        if (obj[i].value.length > 0) {
340            if (!isDate(obj[i].value)) {
341                if (errMsg.length <= 0) {
342                    obj[i].focus();
343                }
344                errMsg += ".日期格式錯誤!請依照格式輸入日期:[ yyyy/MM/dd ]";
345                $("#" + obj[i].id).addClass("ReqShowStyle");
346            }
347        }
348    }
349
350    if (errMsg.length > 0) {
351        alert("親愛的賣家要記得填以下的欄位才可以繼續哦!\n\n" + errMsg);
352        return false;
353    } else {
354        return true;
355    }
356}
357
358function isHaveErrWord(word) {
359    return (word.search("<") >= 0) || (word.search(">") >= 0);
360}
361
362function ClassHaveErrWord(classTag) {
363    var obj = $(classTag);
364    var isHave = false;
365    obj.removeClass("ReqShowStyle");
366    for (i = 0; i < obj.length; i++) {
367        if (isHaveErrWord(obj[i].value)) {
368            $("#" + obj[i].id).addClass("ReqShowStyle");
369            isHave = true;
370        }
371    }
372    return isHave;
373}
374
375function GetRequiredErrMsg() {
376    //要找class=Required type="text" 
377    var errMsg = "";
378
379    var obj = $("input[type$='text'][class*='Required']");
380    //var obj = $("input[type$='text'],.Required"); 
381    obj.removeClass("ReqShowStyle");
382    for (i = 0; i < obj.length; i++) {
383        if (obj[i].value.length <= 0) {
384            if (errMsg.length <= 0) {
385                obj[i].focus();
386            }
387            errMsg += GetRequiredWord(obj[i].id);
388            $("#" + obj[i].id).addClass("ReqShowStyle");
389        } else if (isHaveErrWord(obj[i].value)) {
390            errMsg += GetRequiredWord(obj[i].id).replace("\n", "") + "請勿輸入特殊字元,例如:<,>\n";
391            $("#" + obj[i].id).addClass("ReqShowStyle");
392        }
393    }
394
395    obj = $(".RequiredMobile");
396    var re = /^[0-9]+$/;
397    for (i = 0; i < obj.length; i++) {
398        var v = obj[i].value;
399        if (obj[i].value.length <= 9) {
400            if (errMsg.length <= 0) {
401                obj[i].focus();
402            }
403            errMsg += GetRequiredWord(obj[i].id).replace("\n", "") + "格式不正確\n";
404            $("#" + obj[i].id).addClass("ReqShowStyle");
405        } else if (isHaveErrWord(v)) {
406            errMsg += GetRequiredWord(obj[i].id).replace("\n", "") + "請勿輸入特殊字元,例如:<,>\n";
407            $("#" + obj[i].id).addClass("ReqShowStyle");
408        } else if (v[0] == '+') {
409            //不處理
410        } else if (!re.test(v)) {
411            errMsg += GetRequiredWord(obj[i].id).replace("\n", "") + "只能為數字\n";
412            $("#" + obj[i].id).addClass("ReqShowStyle");
413        }
414    }
415
416    //CheckHtmlValue
417    var obj = $("[class*='CheckValue']");
418    //var obj = $("input[type$='text'],.Required");
419    obj.removeClass("ReqShowStyle");
420    for (i = 0; i < obj.length; i++) {
421        //alert(obj[i]);
422        if (isHaveErrWord(obj[i].value)) {
423            errMsg += GetRequiredWord(obj[i].id).replace("\n", "") + "請勿輸入特殊字元,例如:<,>\n";
424            $("#" + obj[i].id).addClass("ReqShowStyle");
425        }
426    }
427
428    //select
429    obj = $("select[class*='Required']");
430    obj.removeClass("ReqShowStyle");
431    for (i = 0; i < obj.length; i++) {
432        if ((obj[i].length > 1) && (obj[i].selectedIndex <= 0)) {
433            if (errMsg.length <= 0) {
434                obj[i].focus();
435            }
436            errMsg += GetRequiredWord(obj[i].id);
437            $("#" + obj[i].id).addClass("ReqShowStyle");
438        }
439    }
440
441    //radio 確認所有的radio,
442    try {
443        obj = $("span[class*='Required']>input[type=radio]");
444        if (obj.length > 0) {
445            var oldName = "";
446            for (i = 0; i < obj.length; i++) {
447                if (oldName != obj[i].name) {
448                    var chkObj = $("span[class*='Required']>input[name='" + obj[i].name + "']:checked").val();
449                    oldName = obj[i].name;
450                    if (chkObj == undefined) {
451                        var id = obj[i].id.replace("_0", "");
452                        errMsg += GetRequiredWord(id);
453                        $("#" + id).addClass("ReqShowStyle");
454                        shake($("#" + id), "shake", 7);
455                    } else {
456                        var id = obj[i].id.replace("_0", "");
457                        $("#" + id).removeClass("ReqShowStyle");
458                    }
459                }
460            }
461        }
462    } catch (e) {
463        alert(e);
464    }
465
466    obj = $("span[class*='Required']>input[type=hidden]");
467    if (obj.length > 0) {
468        for (i = 0; i < obj.length; i++) {
469            var id = obj[i].id.replace("_0", "");
470            if (obj[i].value.length == 0) {
471                errMsg += GetRequiredWord(id);
472                objItem = $("." + id);
473                objItem.addClass("ReqShowStyle");
474                shake(objItem, "shake", 7);
475            } else {
476                $("." + id).removeClass("ReqShowStyle");
477            }
478        }
479    }
480    return errMsg;
481}
482
483function shake(ele, cls, times) {
484    var i = 0, t = false, o = ele.attr("class") + " ", c = "", times = times || 2;
485    if (t) return;
486    t = setInterval(function () {
487        i++;
488        c = i % 2 ? o + cls : o;
489        ele.attr("class", c);
490        if (i == 2 * times) {
491            clearInterval(t);
492            ele.removeClass(cls);
493        }
494    }, 200);
495};
496
497
498function GetRequiredWord(id) {
499    var word = $("#" + id + "Required").text();
500    if (word != "") {
501        return "." + word + "\n";
502    } else {
503        return "." + id + "\n";
504    }
505}
506
507function isNetRequired(source, arguments) {
508    if (GetRequiredErrMsg().length == 0) {
509        arguments.IsValid = true;
510    } else {
511        arguments.IsValid = false;
512    }
513}
514
515
516function SetDivRound(className) {
517    //$("[class*='" + className + "']").corner("5px");
518    //$("['." + className +"']").corner("round");
519}
520
521function MM_swapImgRestore() { //v3.0
522    var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
523}
524
525function MM_preloadImages() { //v3.0
526    var d = document; if (d.images) {
527        if (!d.MM_p) d.MM_p = new Array();
528        var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
529            if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; }
530    }
531}
532
533function MM_findObj(n, d) { //v3.0
534    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
535        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
536    }
537    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
538    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document); return x;
539}
540
541function MM_swapImage() { //v3.0
542    var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2) ; i += 3)
543        if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
544}
545
546
547function AddMoneyCommom(num) {
548    
549    num = num + "";
550    var re = /(-?\d+)(\d{3})/
551    while (re.test(num)) {
552        num = num.replace(re, "$1,$2")
553    } 
554    return num;
555    /*
556    var parts = num.toString().split('.');
557    parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
558    return parts.join('.');*/
559}
560
561function FormatMoneyHtml(num) {
562    //加錢分號和notranslate
563    num = num + "";
564    var re = /(-?\d+)(\d{3})/
565    while (re.test(num)) {
566        num = num.replace(re, "$1,$2")
567    }
568    return "<span class='notranslate coMoney'><span class='moneySymbol'>$</span>" + num + "<span>";
569   
570}
571
572function onCartNextClick() {
573    //如果值超過一個,不能選 0  
574    //var Sels = window.document.getElementsByTagName("SELECT");
575    var Sels = $("input[class*='Required']");
576    for (var i = 0; i < Sels.length; i++) {
577        if ((Sels[i].length <= 0) || (parseInt(Sels[i].value, 0) <= 0) || (isNaN(parseInt(Sels[i].value)))) {
578            alert('請輸入正確的購買數量!');
579            return false;
580        }
581    }
582    Sels = $(".NumEnd");
583    if (Sels.length > 0) {
584        alert('有物品已售完,請刪除該物品!');
585        return false;
586    }
587
588    return GCart.CanNext();
589
590}
591
592function optionsClear(object) {
593    var length = object.options.length;
594    if (length <= 0) return;
595    for (var i = length - 1; i >= 0; i--) {
596        e.options.remove(i);
597    }
598}
599
600function addOption(object) {
601    object.add(new Option(label, value));
602    //使用options集合中最後一項獲取焦點
603    //object.selectedIndex = object.lentht-1;
604}
605
606function SyncHeight(sName, toName) {
607    $("#" + toName).height($("#" + sName).height());
608}
609
610function ClickSetRadio(id) {
611    $("#" + id).get(0).checked = true;
612}
613
614var win = null;
615function newWindow(mypage, myname, w, h, features) {
616    var winl = (screen.width - w) / 2;
617    var wint = (screen.height - h) / 2;
618    if (winl < 0) winl = 0;
619    if (wint < 0) wint = 0;
620    var settings = 'height=' + h + ',width=' + w + ',';
621    settings += 'top=' + wint + ',';
622    settings += 'left=' + winl + ',' + features;
623    win = window.open(mypage, myname, settings);
624    win.window.focus();
625}
626
627
628function AskReturn() {
629    return confirm('這筆訂單已退貨過,確定還有其它物品要退貨嗎?');
630}
631
632function getCookie(c_name) {
633    if (document.cookie.length > 0) {
634        var c_list = document.cookie.split("\;");
635        for (i in c_list) {
636            var cook = c_list[i].split("=");
637            if (cook[0].replace(' ', '') == c_name) {
638                return unescape(cook[1]);
639            }
640        }
641    }
642    return null
643}
644
645function setCookie(c_name, value, expiredays) {
646    var exdate = new Date()
647    exdate.setDate(exdate.getDate() + expiredays)
648    document.cookie = c_name + "=" + escape(value) +
649    ((expiredays == null) ? "" : ";expires=" + exdate)
650}
651
652function QueryString(name) {
653    var AllVars = window.location.search.substring(1);
654    var Vars = AllVars.split("&");
655    for (i = 0; i < Vars.length; i++) {
656        var Var = Vars[i].split("=");
657        if (Var[0].toUpperCase() == name.toUpperCase()) return Var[1];
658    }
659    return "";
660}
661
662function openDoor(page, param) { window.open(page, "_blank", param); }
663
664function cvsOpenDoor(outside, doorType) {
665    var scrollbars = "no";
666    var h = 650; if (h >= screen.height - 50) { h = screen.height - 50; scrollbars = "yes"; }
667    //alert(doorType);
668    window.open("../Common/CvsDoorSelDlg.aspx?outside=" + outside + "&doorType=" + doorType, "door", "height=" + h + ", width=850, top=0, left=0, toolbar=no, menubar=no,scrollbars=" + scrollbars + ",  resizable=no,location=no, status=no");
669}
670
671var isDoorTimeRun = false;
672function SevenOpenDoor(outside,doorType) {
673    var scrollbars = "no";
674    var h = 850; if (h >= screen.height - 50) { h = screen.height - 50; scrollbars = "yes"; }
675    var dlgType = "def";
676    if (outside == undefined) outside = "";    
677    if (GetUserAgent() != "pc") { dlgType = "timer"; }
678    // dlgType = "modal"; //debug
679
680
681    //$("#edtPs").val(dlgType);
682    //if (isDebug) { alert(dlgType); }
683    if (dlgType == "modal") {
684        var objDoor = $("#DoorDlg");
685        if (objDoor.length == 0) {
686            AddDoorModalDlgDv($("#container"), outside);
687        }
688        DoorDlg();
689    } else {
690        var bname = "door";
691        if (dlgType == "timer") {
692            if (isDoorTimeRun) return;
693            isDoorTimeRun = true;
694            setInterval("AjaxDoorSession();", 2000);
695        } else {
696
697        }
698        window.open("../Common/SevenDoorSelDlg.aspx??t=1&dlgType=" + dlgType + "&outside=" + outside + "&doorType=" + doorType, bname, "height=" + h + ", width=1000, top=0, left=0, toolbar=no, menubar=no, scrollbars=" + scrollbars + ",resizable=no,location=no, status=no");
699    }
700}
701var isDebug = false;
702var iDebug = 0;
703var DoorTimerId = 0;
704function AjaxDoorSession() {
705    $.get("../Common/AJAX/DoorSession.aspx",
706                      function (data) {
707                          /*
708                          if (isDebug) {
709                              var o = $("#edtPs");
710                              o.val(o.val() + "\r\n" + iDebug + ":" + data);
711                              iDebug += 1;
712                          }*/
713                          if (data.length > 5) {
714                              $.get("../Common/AJAX/DoorSession.aspx?clear=1", function () { });
715                              SetDoorLine(data);
716                              isDoorTimeRun = false;
717                              clearInterval(DoorTimerId);
718                              DoorTimerId = 0;
719                          } else {
720                              //setTimeout("AjaxDoorSession();", 2000);
721                          }
722                      }
723                   );
724}
725
726
727
728function AddDoorModalDlgDv(parent, outside) {
729    var oD = $("<div id='DoorDlg'>")
730    oD.append($("<div>").append($("<div id='olClode' onClick='DoorDlg();'><a href='#' onclick='return false;'>[關閉]</a> </div>"))
731                        .append($("<iframe id='ifDoor' src='../Common/SevenDoorSelDlg.aspx?dlgType=modal&outside=" + outside +"></iframe>"))
732        );
733
734    parent.append(oD);
735}
736
737
738
739function SetDoorLine(v) {
740    if (v == undefined) {
741        return;
742    }
743    var arg = v.split(";");
744    doorValue = arg[0]
745    $("#doorMsg").html(arg[1]);
746    $("#hidDoorValue").parent().removeClass("ReqShowStyle");
747    $("#hidDoorValue").val(arg[2]);
748}
749 
750function SetDoorType(atype, limitType) {
751    //if ((atype == 7) || (atype == 8)) { SevenOpenDoor(limitType, atype); }
752    //else { cvsOpenDoor(limitType, atype); }
753    if (atype == 9) {
754        cvsOpenDoor(limitType, atype);
755    } else {
756        SevenOpenDoor(limitType, atype); 
757    }
758}
759function DoorDlg() {
760    var oDv = $("#ifDoor");
761    var w = screen.width - 50 - 1024;
762    var left = w / 2;
763
764
765    var h = 750; if (h >= screen.height - 150) { h = screen.height - 150; }
766    oDv.css({ "height": h, "left": left });
767    el = $("#DoorDlg")[0];
768    el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible";
769}
770
771
772
773function CheckAuid(obj) {
774    obj.removeClass("ReqShowStyle");
775    var value = obj[0].value.trim();
776    if (value.length <= 0) {
777        obj.addClass("ReqShowStyle");
778        alert('請輸入拍賣代號');
779        return false;
780    }
781    var re = /(^Y|^y)\d{10}$/;
782    if (!re.test(value)) {
783        obj.addClass("ReqShowStyle");
784        alert("請輸入正確的拍賣代號");
785        return false;
786    }
787    return true;
788}
789
790function bookmarksite() {
791    if (document.all) {
792        // For IE
793        window.external.AddFavorite(location.href, document.title);
794    }
795    else if (window.sidebar) {
796        // For Firefox
797        window.sidebar.addPanel(document.title, location.href, "");
798    }
799}
800
801
802function ImgLoad(imgLoad, imgTar, url) {
803    if (imgTar.attr("src") !== url) {
804        imgTar.addClass("LoadingIcon");
805        imgTar.attr("src", "../common/Images/shop/loadingPhoto.gif");
806        imgLoad.unbind("load");
807        imgLoad.show();
808        imgLoad.one("load", function () {
809            imgTar.removeClass("LoadingIcon");
810            imgTar.attr("src", url);
811            imgLoad.hide();
812        });
813        //google chrome對src為一樣的不會重新讀取,要先改變才行
814        imgLoad.attr("src", "");
815        setTimeout(function () {
816            imgLoad.attr("src", url);
817        }, 0);
818    }
819}
820
821function clickCoupon(chk, t1, ok) {
822    objChk = $(chk);
823    objItem = $("#spCoupon");
824    // 有問題
825    //if (objChk.prop("checked")) {
826    if (objChk.prop("checked")) {
827        if (objItem.html().length < 10) {
828            objItem.html(t1 + "<input id=\"edtCouponNo\" type=\"text\" />" +
829                   "<input id=\"btnCouponOK\" name=\"btnCouponOK\" type=\"button\" value=\"" + ok + "\" />" +
830                   "<img id=\"imgCouponLoad\" src=\"../Common/Images/load16.gif\" class=\"syHide\" align=\"absmiddle\" />");
831            objOk = $("#btnCouponOK").addClass("form-control0");
832            objEdt = $("#edtCouponNo");
833            objLoad = $("#imgCouponLoad");
834            objOk.unbind("click");
835            objOk.click(function () {
836                objEdt.attr("disabled", "true");
837                objOk.hide();
838                objLoad.show();
839                if (objEdt.val().length < 4) {
840                    objEdt.removeAttr("disabled");
841                    objOk.show();
842                    objLoad.hide();
843                    alert("請輸入編號!");
844                    return;
845                }
846
847                $.get("../Common/AJAX/Coupon.aspx?m=" + Math.random(), { no: objEdt.val(), oa: 1, sst: $("#sst").text() }, function (data) {
848                    if (data.search("[ok]") >= 0) {
849                        objItem.html("<img id=\"imgCouponLoad\" src=\"../Common/Images/load16.gif\" align=\"absmid
849dle\" />");
850                        if (QueryString("de") == 1) {
851                            alert(data);
852                            return;
853                        }
854                        GotoCartStep2fUrl();
855                    } else {
856                        alert(data);
857                        objEdt.removeAttr("disabled");
858                        objOk.show();
859                        objLoad.hide();
860                    }
861
862                });
863                return false;
864
865            });
866        }
867        objItem.fadeIn(200, function () { $("#coChk").prop("checked", true); });
868
869    } else {
870        objItem.fadeOut(200);
871    }
872}
873
874function GotoCartStep2fUrl() {
875    var url = location.href.toLowerCase();
876    if (url.search("searchordermain.aspx") > 0) {
877        document.location.href = location.href;
878    } else {
879        var td = new Date();
880        var m = td.getMonth() + 1;
881        var day = td.getDate();
882        if (m <= 9) m = "0" + m;
883        if (day <= 9) day = "0" 
883+ day;
884        var datevm = td.getFullYear() + "" + m + "" + day;
885        var parma = location.search;
886        if (parma == "") parma = "?";
887        if (parma.search("red=") == -1) parma = parma + "&red=" + datevm;
888        document.location.href = "cartListStep2.aspx" + parma;
889    }
890}
891
892function clickCouponCancel(obj, no) {
893    if (!confirm('確定取消' + no + '折價券嗎?')) return;
894    objMsg = $("#couponMsg");
895    oldHtml = objMsg.html();
896    objMsg.html("<img id=\"imgCouponLoad\" src=\"../Common/Images/load16.gif\" align=\"absmiddle\" />");
897    $.get("../Common/AJAX/Coupon.aspx?m=" + Math.random(), { cl: 1 }, function (data) {
898        if (data.search("[ok]") >= 0) {
899            // location.reload() 
900            GotoCartStep2fUrl();
901        } else {
902            objMsg.html(oldHtml);
903            alert(data);
904        }
905    });
906}
907
908//secure設置為ture時,只有是HTTPS連接時才設置cookie
909function setcookie(name, value, expires, path, domain, secure) {
910    var today = new Date();
911    today.setTime(today.getTime());
912    var expire_date = new Date(today.getTime() + (expires * 1000));
913    document.cookie = name + '=' + escape(value) +
914                        ((expires) ? ';expires=' + expire_date.toGMTString() : '') +
915                        ((path) ? ';path=' + path : '') +
916                        ((domain) ? ';domain=' + domain : '') +
917                        ((secure) ? ';secure' : '');
918}
919
920function getcookie(name) {
921    var start = document.cookie.indexOf(name + "=");
922    var len = start + name.length + 1;
923    if ((!start) && (name != document.cookie.substring(0, name.length))) {
924        return null;
925    }
926    if (start == -1) {
927        return null;
928    }
929    var end = document.cookie.indexOf(';', len);
930    if (end == -1) {
931        end = document.cookie.length;
932    }
933    return unescape(document.cookie.substring(len, end));
934}
935
936function delcookie(name, path, domain) {
937    var exp = new Date();
938    exp.setTime(exp.getTime() - 1);
939    var cval = getcookie(name);
940    document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString() +
941                        ((path) ? ';path' + path : '') +
942                        ((domain) ? ';domain=' + domain : '');
943}
944
945
946function LazyPhoto(obj, loadimgUrl) {
947    try {
948        obj.lazyload(); //多一行。這樣失效的下面就不會跑
949        obj.one('change', function () { $(this).attr('data-original', $(this).attr('src')); });
950        obj.change();
951        obj.attr('src', loadimgUrl);
952        obj.lazyload(/*{ effect : "fadeIn"}*/);
953    } catch (err) { }
954}
955
956String.format = function (src) {
957    if (arguments.length == 0) return null;
958    var args = Array.prototype.slice.call(arguments, 1);
959    return src.replace(/\{(\d+)\}/g, function (m, i) {
960        return args[i];
961    });
962};
963
964function ShObj(obj) {
965    var msg = "";
966    if (obj == undefined) { alert(obj); }
967    else {
968        for (var i = 0; i < obj.length; i++) {
969            msg += GetJQStr($(obj[i])) + "\r\n";
970        }
971        alert(msg);
972    }
973}
974
975function GetJQStr(obj) {
976    var msg = "";
977    msg += String.format("obj:{0} length:{4} <{1} id={2} class={3}> ,", obj, obj[0].tagName, obj.attr("id"), obj.attr("class"), obj.length);
978    if (obj.length > 1) {
979        for (var i = 0; i < obj.length; i++) {
980            msg += "‧" + GetJQStr($(obj[i])) + "\r\n";
981        }
982    }
983    return msg;
984}
985
986function SetDisabled(sender, word) {
987    var obj = $(sender);
988    obj.attr('disabled', 'disabled');
989    obj.val(word);
990}
991function GetTrCss(no) {
992    if (no % 2 == 0) { return "CustomTable1Col"; }
993    else { return "CustomTable2Col"; }
994}
995
996function BindMobile(checkValue) {    
997    if (checkValue == undefined) checkValue = 767;
998    var currW = ($(window).width());
999    var oL = $(".leftBar");   
1000    //if ((currW <= checkValue) || (($("#pList").attr("rwd") == "1") && (currW < 768))) {
1001    
1002    if (currW <= checkValue)  {
1003        var oTopClass = $("#tpc");
1004        //if (oL.attr("t") != "m") {
1005        if ($("#pList").attr("rwd") == "1") { //766 will be hide nav-bar
1006            if (oTopClass.length <= 0) { oTopClass = $("<table>").attr("id", "tpc").css("width", "100%"); }
1007            oTopClass.append(oL.addClass("mobile").css("width", "100%").attr("t", "m"));
1008            $("#content").prepend(oTopClass);
1009            $("#groupBarBox").unbind("scroll.portamento");               
1010            //rwd Mobild
1011            $("#groupBarBox,#pList").css({ "width": "100%" });
1012            var oList = $("#pList");
1013            if (oList.length > 0) {
1014                oList.append($("#groupBarMsg")).append($("#groupBarMyCart"))
1015                           .append($("#litMsgBtn"));
1016            }
1017        } else {
1018            $("#tdIlRight,#tdIdRight").prepend($("#pListMain"));
1019            
1020        }
1021        $("#groupBarBox,#pList").css({ "width": "100%" });
1022        $("#portamento_container").removeAttr("style");
1023        $(".leftBar").css({ "width": "0" });
1024        
1025        setTimeout('$("#portamento_container").removeAttr("style");', 10);
1026    } else {
1027        /*
1028        if (oL.attr("t") == "m") {
1029            $($("#tbItemList  tr")[0]).prepend(oL.attr("t", "pc").removeClass("mobile"));
1030        }                
1031        $("#groupBarBox,#pList,.leftBar").css({ "width": "" });  */      
1032    }
1033    //$("#clTops *").css({ "max-width": currW });
1034
1035    $("#ctl00_ContentPlaceHolder1_divShoppingMoney,#mdTable *").css({ "max-width": "" });
1036    if (currW <= 400) {
1037        $("#mdTable .addr4,#mdTable #edtPs").css({ "max-width": currW - 90 });        
1038    }
1039
1040 
1041}
1042
1043function GoToTop() {
1044    $("html, body").animate({ scrollTop: 0 }, 400);
1045}
1046
1047
1048function _CreateHidden(id, name) {
1049    if (name == undefined) name = id;
1050    return $("<input type=\"hidden\">").attr({ "id": id, "name": name });
1051}
1052
1053
1054function _CreateCheck(id, name, aclass, title) {
1055
1056    return $("<input type=\"checkbox\">").attr({ "id": id, "name": name }).addClass(aclass)
1057           .after($("<label>").addClass("unCheck").attr("for", id).text(title));
1058}
1059
1060function _CreateRadio(id, name, value) {
1061    return $("<input>").attr({ "id": id, "name": name, "value": value, "type": "radio" });
1062}
1063
1064
1065function _CreateTextarea(name, aclass) {
1066    return $("<textarea>").attr({ "id": name, "name": name }).addClass(aclass);
1067}
1068
1069
1070function CheckFxBarcode(barcode, callback) {
1071    $.getJSON("../WorkPage/EcFx/check.aspx", { barcode: barcode }, callback);
1072}
1073
1074function ReloadLeftCartList() {
1075
1076    if ($("#groupBarMyCart").length <= 0) return;
1077    $.get("../Common/ajaxcartbag.aspx", function (html) {
1078
1079        var oH = $(html).find("#groupBarMyCart");
1080        //alert(oHhtml);
1081        $("#groupBarMyCart").html(oH.html());
1082    });
1083}
1084
1085function htmlDecode(input) {
1086    if (input == undefined) return "";
1087    var e = document.createElement('div');
1088    e.innerHTML = input;
1089    var v = e.childNodes.length === 0 ? "" : e.childNodes[0].nodeValue;
1090    if (v == undefined) return "";
1091    return v;
1092}
1093
1094$.fn.CenterDiv = function (parent) {
1095    if (parent == undefined) parent = $(this).parent();
1096    var ph = parent.height();
1097    var selfH = $(this).height();
1098    var padd = Math.round((ph / 2) - (selfH / 2));
1099    $(this).css({ "margin-top": padd });
1100    return $(this);
1101
1102}
1103
1104$.fn.SetHeight = function (parent) {
1105    if (parent == undefined) parent = $(this).parent();
1106    if (parent == "self") parent = $(this);
1107    $(this).css({ "height": parent.height() });
1108    return $(this);
1109
1110}
1111
1112$.fn.SetMaxWidth = function () {
1113    var currW = ($(window).width());
1114    $(this).find("*").css({ "max-width": "100%" });
1115    return $(this);
1116
1117}
1118
1119function GetUserAgent() {
1120    if (/ipad/i.test(navigator.userAgent.toLowerCase())) {
1121        return "ipad";    // 目前是用ipad瀏覽
1122    }
1123    else if (/iphone|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())) {
1124        return "mobile";  // 目前是用手機瀏覽
1125    }
1126    else {
1127        return "pc";      // 目前是用電腦瀏覽
1128    }
1129}
1130
1131
1132
1133var ShopClass = (function () {
1134    function ShopClass() {
1135        ShopClass._this = this;
1136    }
1137    ShopClass.prototype.BindMenu = function (obj, json, menuJson) {
1138        var dv = $("<div>").attr({ id: "navcontainer" });
1139        var data;
1140        try {
1141            //data = jQuery.parseJSON(json);
1142            data = ParseJSON(json);
1143        } catch (e) {
1144            alert(e + "\r\n" + "Menu Json錯誤:" + json);
1145            return;
1146        }
1147        obj.append(dv);
1148        var oUl = $("<ul>").addClass("nav");
1149        this.MenuJson = menuJson;
1150        this._CrLi(oUl, data);
1151        dv.append(oUl);
1152        //mainclass
1153    };
1154    ShopClass.prototype._CrLi = function (parent, data) {
1155        var oLi;
1156        var mitem;
1157        var crBtn = function (item) {
1158            //console.log(item);
1159            if (item.ImgSrc.length <= 5) { return item.Name; }
1160            else {
1161                return $("<img>").attr({ src: item.ImgSrc, s1: item.ImgSrc, s2: item.HoverImgSrc, alt: item.Name }).hover(
1162                    function () {
1163                        //$(this).attr({ src: "" });
1164                        var s = $(this).attr("s2");
1165                       // console.log(s);
1166                        $(this).attr({ src: s });
1167                        
1168                    },
1169                    function () { $(this).attr({ src: $(this).attr("s1") }); });
1170            };
1171        };
1172        for (var i = 0; i < data.length; i++) {
1173            mitem = data[i];
1174            if ((mitem.Name!=null) && (mitem.Name.toLowerCase() == "[mainclass]")) {
1175                if ((this.MenuJson != undefined) && (this.MenuJson.length > 0)) {
1176                    this._CrLi(parent, ParseJSON(this.MenuJson));
1177                }
1178            } else {
1179                oLi = $("<li>").append(
1180                                  $("<a>").attr({ href: mitem.Url, target: mitem.Target })
1181                                          .append(crBtn(mitem))
1182                                       ).addClass((mitem.ImgSrc.length <= 5) ? "liWord" : "liImg");
1183                parent.append(oLi);
1184            }
1185        }
1186    };
1187    return ShopClass;
1188})();
1189
1190
1191// base64Decode From http://www.programmer-club.com/ShowSameTitleN/javascript/8512.html
1192
1193var b64ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1194//var b64ch = "STUVWXYZabcdefghiABCDEFGHIJKLMNOPQRjklmnopqrst456789+/uvwxyz0123";
1195var hexch = "0123456789ABCDEF";
1196var ASCII = 0, UCLE = 1, UCBE = 2, UTF8 = 3, BIG5 = 4, BigEndian = false;
1197function base64Decode(b64, enc) {
1198    var i, j;
1199    var c = [0, 0, 0, 0];  // base64 index
1200    var cba = [];       // unicode byte array
1201    var ch;             // single character
1202    for (j = 0; ;) {
1203        for (i = 0; i < 4 && j < b64.length; j++) {
1204            ch = b64.charAt(j);
1205            if (ch == '=')
1206                c[i] = 0;
1207            else if (/[a-z0-9+/]/i.test(ch))
1208                c[i++] = b64ch.indexOf(ch);
1209        }
1210        if (i > 0) cba.push((c[0] << 2 | c[1] >>> 4) & 0xff);
1211        if (i > 1) cba.push((c[1] << 4 | c[2] >>> 2) & 0xff);
1212        if (i > 2) cba.push((c[2] << 6 | c[3]) & 0xff);
1213        if (i < 4) break;
1214    }
1215    return joinFromArray(cba, enc);
1216}
1217
1218function joinFromArray(cba, enc) {
1219    var ucb = [];  // unicode/utf8 bytes
1220    var b, u;      // the first byte
1221    while (cba.length > 0) {
1222        b = cba.shift();
1223        switch (enc) {
1224            case UTF8:
1225                if (b == 0) continue;
1226                u = b;  // 0xxxxxxx
1227                if (b > 0xc0) {  // 110xxxxx 10xxxxxx
1228                    u = (u & 0x1f) << 6 | cba.shift() & 0x3f;
1229                    if (b >= 0xe0) {  // 1110xxxx 10xxxxxx 10xxxxxx
1230                        u = (u & 0x3ff) << 6 | cba.shift() & 0x3f;
1231                        if (b >= 0xf0) {  // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
1232                            u = (u & 0x7fff) << 6 | cba.shift() & 0x3f;
1233                            if (b >= 0xf8) {  // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
1234                                u = (u & 0xfffff) << 6 | cba.shift() & 0x3f;
1235                                if (b >= 0xfc)  // 111111xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
1236                                    u = (u & 0x3ffffff) << 6 | cba.shift() & 0x3f;
1237                            }
1238                        }
1239                    }
1240                }
1241                break;
1242            case UCBE: u = b << 8 | cba.shift();
1243                break;
1244            case UCLE: u = b | cba.shift() << 8;
1245                break;
1246            case BIG5: if (b > 127) { b = b << 8 | cba.shift(); }
1247                u = big5char(b);
1248                break;
1249        }
1250        ucb.push(u);
1251    }
1252    return enc == BIG5 ? ucb.join('') : String.fromCharCode.apply(null, ucb);
1253}
1254
1255/*原shop.js*/
1256jQuery(function ($) {
1257    $("#ctl00_edtSearch").keypress(function (event) {
1258        if (event.keyCode == 13) {
1259            $("#ctl00_btnSearch").click();
1260        }
1261    })
1262});
1263
1264function GetEmptyA() {
1265    return '<a href="#" onclick="return false;">';
1266}
1267
1268function DetailMsg(type) {
1269    if (type == undefined) return;
1270    var msg = "";
1271    switch (type) {
1272        case 1:
1273            msg = "加入購物車完成!";
1274
1275            try {
1276                BoxyAlert(msg);
1277                return false;
1278            }
1279            catch (e) { }
1280            break;
1281        case 2:
1282            msg = "請選擇商品規格哦!";
1283            break;
1284        case 3:
1285            msg = "無法加入購物車!組合商品不能選這麼多組哦!";
1286            break;
1287    }
1288    if (msg != "") {
1289        setTimeout('alert("' + msg + '")', 400);
1290    }
1291}
1292
1293function notifyEnd() {
1294    alert('加入完成!我們會在貨到時寄電子郵件通知您哦!');
1295    try {
1296        $.colorbox.close();
1297    } catch (e) {
1298    }
1299    try {
1300        parent.$.fancybox.close();
1301    } catch (e) {
1302    }
1303}
1304
1305function BoxyAlert(msg) {
1306    Boxy.ask(GetAddCartMsg(),
1307        null, null, { modal: true, closeable: false, draggable: false });
1308}
1309
1310function GetAddCartMsg() {
1311    return '<div style="width:315px; margin:0 auto; background-color:#fff;">' +
1312        '<table width="100%" border="0" cellpadding="0" cellspacing="0">' +
1313        '<tr><td colspan="2"><img alt="" src="../UserFiles/Custom/ShopCommon/C03Wonder21/message.gif" /></td></tr>' +
1314        "<tr><td colspan=\"2\" style=\"padding:10px 0px;\"><img alt='' src=\"../UserFiles/Custom/ShopCommon/C03Wonder21/addMsg.gif\" /></td></tr>" +
1315        "<tr><td style=\"text-align:left; padding:5px 0px 5px 10px;\"><a href='#' onclick='Boxy.get(this).hide();'><img alt='' src=\"../UserFiles/Custom/ShopCommon/C03Wonder21/btnGoSelect.gif\" style=\"border:0 none;\" /></a></td>" +
1316        "    <td style=\"text-align:right; padding:5px 10px 5px 0px;\"><a href=\"../Shop/cartList.aspx?lm=0\"><img alt='' src=\"../UserFiles/Custom/ShopCommon/C03Wonder21/btnGotoPay.gif\" style=\"border:0 none;\" /></a></td></tr>" +
1317        '</table></div>';
1318}
1319
1320function SetItemListPortamento() {
1321    try { $("#groupBarBox").portamento({ wrapper: $("#ctl00_ContentPlaceHolder1_tdLeft"), gap: 0, disableWorkaround: false }); } catch (e) { };
1322}
1323
1324//換圖 by小毛
1325function ImageMouseOver(idno, path1, path2) {
1326    var imageDetect = new Image();
1327    imageDetect.onload = function () {
1328        $("#aImg" + idno).hover(function () {
1329            $("#aImg" + idno + " img").attr("src", path2);
1330        }, function () {
1331            $("#aImg" + idno + " img").attr("src", path1);
1332        });
1333    }
1334    imageDetect.src = path2;
1335}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.