function setupMainTheme(n){$.ajax({type:"POST",url:n,success:function(n){var r=$.grep(n,function(n){return n.Code=="Favicon"}),t,i;$(".favicon").attr("href",r[0].Value);t=$.grep(n,function(n){return n.Code=="HeaderIogo"});$(".headericon").attr("src",t[0].Value);i=$.grep(n,function(n){return n.Code=="Mainlogo"});$(".mainlogo").attr("src",i[0].Value)},error:function(n){alert(jQuery.parseJSON(n.responseText).ErrorMessage)}})}function showMessenger(n,t,i){i=typeof i=="undefined"?"messenger-fixed messenger-on-top":i;t=typeof t=="undefined"?"success":t;n!==""&&(Messenger.options={extraClasses:i,theme:"flat"},Messenger().post({message:n,type:t,showCloseButton:!0}))}function handleError(n){showMessenger(n.responseJSON.ErrorMessage,"error")}function popupWindow(n,t,i,r){var u=screen.width/2-i/2,f=screen.height/2-r/2;return window.open(n,t,"toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+i+", height="+r+", top="+f+", left="+u)}function postForm(n,t){"use strict";var i;i=$("<form />",{action:n,method:t,style:"display: none;"});i.appendTo("body").submit()}function popupModal(n,t,i,r){$.ajax({url:n,type:"POST",cache:!1,dataType:"html",data:JSON.stringify(r),contentType:"application/json; charset=utf-8",success:function(n){$("#popup-modal-container").html(n);$("#popup-modal-container").css({height:"auto",width:"auto","max-height":t+"px","max-width":i+"px",position:"relative",padding:"15px","margin-left":"auto","margin-right":"auto"});$("#popup-modal-container").find(".tab-content").css("min-height",t*.65).css("height",t*.65).css("max-height",t*.65);$("#popup-modal").modal("show")},complete:function(){$("form").each(function(){$.data($(this)[0],"validator",!1)});$.validator.unobtrusive.parse("form")},error:function(n){showMessenger(n.statusText,"error")}})}function spin_start(){$(target).fadeIn();spinner.spin(target)}function spin_stop(){$(target).fadeOut();spinner.stop()}function trimText(n,t){t=typeof t=="undefined"?!1:t;t&&(n=n.replace(/\s+/g,""));return $.trim(n)}function addNoOfClick(n){$.ajax({url:n,type:"POST",dataType:"json",contentType:"application/json; charset=utf-8",success:function(){},error:function(n){alert(jQuery.parseJSON(n.responseText).ErrorMessage)}})}function closeModal(n,t){$("#popup-modal").modal("hide");typeof t!="undefined"&&showMessenger(t,"success");n&&($(".search").click(),$(".dataTables_filter .input-sm").val(""))}function getCbm(n,t,i,r){var u=0;return r>0&&(u=n*t*i/r),u}function getRt(n,t,i,r,u){var f=getCbm(n,t,i,u);return GetRt(f,r)}function getRt(n,t){var i=0;return $.isNumeric(n)&&$.isNumeric(t)?i=parseFloat(n)>parseFloat(t)?n:t:($.isNumeric(n)&&(i=parseFloat(n)),$.isNumeric(t)&&(i=parseFloat(t))),i}function getMonthSel(n){for(var i="<option value>"+n+"<\/option>",t=1;t<=12;t++)i+="<option value='"+t+"'>"+t+"<\/option>";return i}function getDaySel(n,t){var i;var u=t,f=[31,29,31,30,31,30,31,31,30,31,30,31][u-1],r="<option value>"+n+"<\/option>";for(i=1;i<=f;i++)r+="<option value='"+i+"'>"+i+"<\/option>";return r}function isLeapYear(n){return n%4==0||n%100==0&&n%400==0}function lbsAndOzToK(n){return n*.45359237}function kgToLb(n){return n*2.2046}function exqDateTime(n){var t=n.getFullYear()+"-"+(n.getMonth()+1).padLeft()+"-"+n.getDate().padLeft();return t+(" "+n.getHours().padLeft()+":"+n.getMinutes().padLeft()+":"+n.getSeconds().padLeft())}function exqDate(n){return n.getFullYear()+"-"+(n.getMonth()+1).padLeft()+"-"+n.getDate().padLeft()}function exqDateString(n){return n.getFullYear()+"-"+(n.getMonth()+1).padLeft()+"-"+n.getDate().padLeft()}function jsonDateToExqDate(n){var t=new Date(n.match(/\d+/)[0]*1);return exqDate(t)}function jsonDateToExqDateTime(n){var t=new Date(n.match(/\d+/)[0]*1);return exqDateTime(t)}function jsonToDate(n){var t=new Date(parseInt(n.substr(6)));return exqDate(t)}function postForm(n,t){"use strict";var i;i=$("<form />",{action:n,method:t,style:"display: none;"});i.appendTo("body").submit()}function getStringFormatPlaceHolderRegEx(n){return new RegExp("({)?\\{"+n+"\\}(?!})","gm")}function cleanStringFormatResult(n){return n==null?"":n.replace(getStringFormatPlaceHolderRegEx("\\d+"),"")}var AccAmountType={Money:1,Point:2},CouponAmountType={Cash:1,Percentage:2},ParcelStatus={Cancel:-1,Pending:0,Claimed:199,PrepShippment:250,Shipped:300},ParcelDetailStatus={Cancel:-1,Pending:0,Arrive2WH:100,Measured:110,AssignedBoxId:120,Putaway:199,PrepShippment:250,Shipped:300},PaymentMethod={NoNeed2Pay:0,CashOnDelivery:1,Octupus:2,CreditCard:3,Paypal:4,Alipay:5,ATM:6,UnionPay:7},PaymentStatus={NotPaid:0,PayCashOnDelivery:1,UnderApprove:2,Paid:10},Shop4UStatus={Cancel:-1,AwaitingOffer:1,Offered:100,ConfirmOrder:199,Shipped:300,Arrive2WH:400,ConsolOrderPlaced:500},Shop4UDetailStatus={Cancel:-1,AwaitingOffer:1,Offered:100,AwaitingBuy:200,Bought:210,AwaitingReceive:220,Received:300},RedeemType={Cash:1,Gift:2},RedeemStatus={Cancel:-1,Processing:10,AwaitingRedeem:50,Redeemed:100},SystemServiceType={Consol:1,Shop4U:2},modal_popup_opts={height:900,width:1200};$(".button_container").on("click",".button_popup",function(n){var t;n.preventDefault();var i=$(this).data("height"),r=$(this).data("width"),u=modal_popup_opts.height;i!==undefined&&(u=parseFloat(i));t=modal_popup_opts.width;r!==undefined&&(t=parseFloat(r));popupModal($(this).attr("href"),u,t)});$(".table_container").on("click",".table_popup",function(n){var t,i;n.preventDefault();t=modal_popup_opts.height;$(this).data("height")!==undefined&&(t=parseFloat($(this).data("height")));i=modal_popup_opts.width;$(this).data("width")!==undefined&&(i=parseFloat($(this).data("width")));popupModal($(this).attr("href"),t,i)});$(".table_container").on("click",".notpaid",function(n){n.preventDefault();postForm($(this).attr("href"),"post",{})});var opts={lines:12,length:7,width:4,radius:10,color:"#000",speed:1,trail:60,shadow:!1,hwaccel:!1},target=document.getElementById("spin-loading"),spinner=new Spinner(opts);$(".d4_spin_form").submit(function(){spin_start()});Number.prototype.padLeft=function(n,t){var i=String(n||10).length-String(this).length+1;return i>0?new Array(i).join(t||"0")+this:this};String.format=function(){var t=arguments[0],n,i;if(t==null)return"";for(n=0;n<arguments.length-1;n++)i=getStringFormatPlaceHolderRegEx(n),t=t.replace(i,arguments[n+1]==null?"":arguments[n+1]);return cleanStringFormatResult(t)};String.prototype.format=function(){for(var i,t=this.toString(),n=0;n<arguments.length;n++)i=getStringFormatPlaceHolderRegEx(n),t=t.replace(i,arguments[n]==null?"":arguments[n]);return cleanStringFormatResult(t)};jQuery(function(n){n.extend({form:function(t,i,r){var e,u,f;r==null&&(r="POST");i==null&&(i={});e=n("<form>").attr({method:r,action:t}).css({display:"none"});u=function(t,i){var r,o,f;if(n.isArray(i))for(r=0;r<i.length;r++)o=i[r],u(t+"[]",o);else if(typeof i=="object")for(f in i)i.hasOwnProperty(f)&&u(t+"["+f+"]",i[f]);else i!=null&&e.append(n("<input>").attr({type:"hidden",name:String(t),value:String(i)}))};for(f in i)i.hasOwnProperty(f)&&u(f,i[f]);return e.appendTo("body")}})})