i?Math.floor(m/h*100):Math.floor(m/i*100)};$.getJSON(a.database,function(d){var e=new JQL(b(d)),f={hint:!0,highlight:!0,minLength:1},g={empty:" ",suggestion:function(a){return""+a.d+" » "+a.a+" » "+a.p+" » "+(a.z||"ไม่มีรหัสไปรษณีย์")+"
"}},h=function(b,c){a.$district&&a.$district.val(c.d).trigger("change"),a.$amphoe&&a.$amphoe.val(c.a).trigger("change"),a.$province&&a.$province.val(c.p).trigger("change"),a.$zipcode&&a.$zipcode.val(c.z).trigger("change"),"function"==typeof a.onDataFill&&a.onDataFill({district:c.d,amphoe:c.a,province:c.p,zipcode:c.z})};a.$district&&a.$district.typeahead(f,{limit:a.autocomplete_size,templates:g,source:function(a,b){var c=[];try{c=e.select("*").where("d").match("^"+a).orderBy("d").fetch()}catch(a){}b(c)},display:function(a){return a.d}}),a.$amphoe&&a.$amphoe.typeahead(f,{limit:a.autocomplete_size,templates:g,source:function(a,b){var c=[];try{c=e.select("*").where("a").match("^"+a).orderBy("a").fetch()}catch(a){}b(c)},display:function(a){return a.a}}),a.$province&&a.$province.typeahead(f,{limit:a.autocomplete_size,templates:g,source:function(a,b){var c=[];try{c=e.select("*").where("p").match("^"+a).orderBy("p").fetch()}catch(a){}b(c)},display:function(a){return a.p}}),a.$zipcode&&a.$zipcode.typeahead(f,{limit:a.autocomplete_size,templates:g,source:function(a,b){var c=[];try{c=e.select("*").where("z").match("^"+a).orderBy("z").fetch()}catch(a){}b(c)},display:function(a){return a.z}}),a.$search&&a.$search.typeahead(f,{limit:a.autocomplete_size,templates:g,source:function(a,b){var f,d=[];try{d=new JQL(d.concat(e.select("*").where("d").match(a).fetch()).concat(e.select("*").where("a").match(a).fetch()).concat(e.select("*").where("p").match(a).fetch()).concat(e.select("*").where("z").match(a).fetch()).filter(function(a,b,c){var d=!0;for(f=0;fg&&(g=l,e=j,f=k)}return m=g,m&&(e&&f&&(m+=c(a.substr(0,f),b.substr(0,f),!1)),e+gi?Math.floor(m/h*100):Math.floor(m/i*100)};$.getJSON(a.database,function(d){var e=new JQL(b(d)),f={hint:!0,highlight:!0,minLength:1},g={empty:" ",suggestion:function(a){return""+a.d+" » "+a.a+" » "+a.p+" » "+(a.z||"ไม่มีรหัสไปรษณีย์")+"
"}},h=function(b,c){a.$district&&a.$district.val(c.d).trigger("change"),a.$amphoe&&a.$amphoe.val(c.a).trigger("change"),a.$province&&a.$province.val(c.p).trigger("change"),a.$zipcode&&a.$zipcode.val(c.z).trigger("change"),"function"==typeof a.onDataFill&&a.onDataFill({district:c.d,amphoe:c.a,province:c.p,zipcode:c.z})};a.$district&&a.$district.typeahead(f,{limit:a.autocomplete_size,templates:g,source:function(a,b){var c=[];try{c=e.select("*").where("d").match("^"+a).orderBy("d").fetch()}catch(a){}b(c)},display:function(a){return a.d}}),a.$amphoe&&a.$amphoe.typeahead(f,{limit:a.autocomplete_size,templates:g,source:function(a,b){var c=[];try{c=e.select("*").where("a").match("^"+a).orderBy("a").fetch()}catch(a){}b(c)},display:function(a){return a.a}}),a.$province&&a.$province.typeahead(f,{limit:a.autocomplete_size,templates:g,source:function(a,b){var c=[];try{c=e.select("*").where("p").match("^"+a).orderBy("p").fetch()}catch(a){}b(c)},display:function(a){return a.p}}),a.$zipcode&&a.$zipcode.typeahead(f,{limit:a.autocomplete_size,templates:g,source:function(a,b){var c=[];try{c=e.select("*").where("z").match("^"+a).orderBy("z").fetch()}catch(a){}b(c)},display:function(a){return a.z}}),a.$search&&a.$search.typeahead({hint:!0,highlight:!0,minLength:2},{limit:a.autocomplete_size,templates:g,source:function(a,b){var f,d=[];try{d=new JQL(d.concat(e.select("*").where("d").match(a).fetch()).concat(e.select("*").where("a").match(a).fetch()).concat(e.select("*").where("p").match(a).fetch()).concat(e.select("*").where("z").match(a).fetch()).filter(function(a,b,c){var d=!0;for(f=0;f