/******************************************************************************** // This is a collection of JavaScript code to allow easy integration of // postcode lookup functionality into JShop Server // // Parts are compacted by ScriptingMagic.com to speed up load time, if you want the full version, // please email us. **********************************************************************************/ var _cp_hide_button_for_non_uk_country = 0; // set this to 1 to make the button respond to the coutry drop down list function crafty_postcode_object_init(form,formElements,resultTagId) { var cp_obj = CraftyPostcodeCreate(); cp_obj.set("access_token", "bdf05-cd119-67f06-0008a"); cp_obj.set("busy_img_url", "/resources/crafty/crafty_postcode_busy.gif"); cp_obj.set("res_autoselect", "0"); // auto select the first result cp_obj.set("max_width", "400px"); cp_obj.set("max_lines", "1"); // max vertical height of the result box in number of lines, 0 & 1 give the same result cp_obj.set("traditional_county", 0); // 0 - postal county, 1 - traditional county name cp_obj.set("delimiter", ", "); // separator to use in the dropdown list cp_obj.set("lookup_timeout", "10000"); // im miliseconds - 10 seconds default cp_obj.set("first_res_line", "--- please select your address ---"); /* msg1 - a well formatted postcode, but not found in database */ // cp_obj.set("err_msg1", "This postcode could not be found, please try again or enter your address manually"); /* msg2 - a missformatted postcode, i.e. wrong number of character/digits etc. - no attempt to communicate with craftyclicks server */ // cp_obj.set("err_msg2", "This postcode is not valid, please try again or enter your address manually"); /* msg3 - connection problem, could not get a lookup response from server within specified timeout */ // cp_obj.set("err_msg3", "Unable to connect to address lookup server, please enter your address manually"); /* msg4 - unlikely - covers any other problem */ // cp_obj.set("err_msg4", "An unexpected error occured, please enter your address manually"); // cp_obj.set("debug_mode", 1); cp_obj.set("form", form); cp_obj.set("elements", formElements); cp_obj.set("result_elem_id", resultTagId); return (cp_obj); } function crafty_postcode_country_changed() { if (!_cp_hide_button_for_non_uk_country) { return; } var cp_obj = _cp_instances[1]; var cl = cp_obj.get_elem(7); var cb = document.getElementById("crafty_postcode_button"); if (cl && cb) { var country_id = cl.options[cl.selectedIndex].value; switch (country_id) { case '222': cb.style.display = "inline"; break; default: cb.style.display = "none"; break; } cp_obj.update_res(null); } } function crafty_postcode_country_init() { var cp_obj = _cp_instances[1]; var cl = cp_obj.get_elem(7); var oldonchange = cl.onchange; if ("function" == typeof(cl.onchange)) { cl.onchange = function () {oldonchange(); crafty_postcode_country_changed();} } else { cl.onchange = function(){crafty_postcode_country_changed();}; } crafty_postcode_country_changed(); } eval((function(){var a="sËÞfðæreate(++;ÿ=newÿLÕÿ.obj=;ÿ}ß=ò;fð _cpÃÿBre(a,bzc;d;ÿ4a[é&&ÿ4éÿEÚ(5,a[ÿ2ÕèÁÂÚ(5,ÿ2)ÿEÕèÁÂØc>dÿ:1ØcÂÿ:1Ø(-1ØfðÿLÿ={Çurlþpcls1.craftyís.co.uk/Çjs.phpòacÿF_tokenþòÿ ÿ#ÿþ%p_busy.gifòÿIÿ#org#:1,Ï#:1,Ä#ÿ#addr#ÿ#ÿ:ò òmsg1þPle× wait wöe we find theÿAòÀ1ÿcould not be founÜ2ÿis not valiÜ3þUnable to connect toÿA lookup serverÿÀ4þAn unexpected error occuredÿ_autoÅ:1,ú:1,ÿÿ#ñ:10000,formþòeÍsþ%ÝÿBnyüã1üã2üã3üÏüÄ,%in_Ý_pòÿþ400pxòïÿ#î_Ñþòÿþ};xmlhttpÔÿ5ÔëÃÔÿ5Þÿ6ÞùÔclean_pcÖñÔobj_nameÖsetûÿ[a]=b};ùíedaÛ6++;ùÅed(a)Û9 ÿI&&((2>= ï&&1<ÿ6)||(2< ï))È(ÿÕÿ6=0}}};ùÿ/a,ezb;!eze=window.ev}ÿb=ÿÿ,b=ÿ,}}b==13Û6=1;ùíed(aØ};ùÅedaÛ00==a0a--}}bËc= ÿ;ÿHiÞi<6;i++i]=get_eÍ(iØa=ëÃ[a][inâx;èÿ5[a];0]0d[org}e=d[ã1;f=d[ã2;g=f+(f=Ìe;h=ÿ;j=@;qg&&Ág)==gqhhÿhjÿj}gÖe=}k=h+(h=Ìj;l=ÿ-;ÿ&&3]q7||!=ÿ;Î}ÿ@ÆeÉÆfÉeÿKóÆgÉk}ÿKhÎjÿ3ÎhõjÉ}ÿ@Îeÿ3ÿÉ}fÎe;óhÛÉjg= ïÛ& ïÿ&e}d~cÕÈ(dØ};ÈañclearTimeÝ(ñØtry{Òzb=Ò( ÿÕb.hasCödNoâs()wöeÿ!b.removeCödÿ!Ø}ÿ==aa=Êxa0Øb~aØ}catch(er}};ÿszlÞr=s-1;wöe(ll&&s[rÿ%r-=1}sÚing(l,r+1Ø;ÿ7aPCêa||UKêa||EUêaÿ:aØb=ABCDEFGHIJKLMNOPQRSTUVWXYZ;cÖè1;eÞÿHfÞf=a&&'êè0(ÿ )ÿMf+3<áÿ=1e=1})êÿ=1-ÿ -ÿM(-1!=á&&f+3>=á)||f+3>=aÿ=0eÞè1}f+2=è0è1}}}}}}ÿ1leading_capsûÛ9b||2>aÿ:aØcÖèaô ÕÿHeÞe=0;)a=a.replace(new RegExp(c[b],"g"),("\\\042\n].value=this.}else{config.resdocument.createif(_cp_instanced[housename]localityvar =function(){.lengtha.charAt(f)entb[ er your adds manuallyostcodereturn ==_idx_uppercasecrafty_d[pobox]_[]=leading_caps(!=.appendChild(;break;case err_msgparseInt(str]_arrcountyselect2lookup_update_;3TextNode(=new Array();=?:c)+lem1tion.indexOf(_linedocum.getEÍByIds[+obj+]._=null;);=;ase)}:e= :: .substrAttributed, ple× try again or,Àout=0;_cpÃ_sort_dlultclosedestreetc=EÍ(opÏÕc~Êa)Õ%p_Çà_opÏ+obj CraftyPC.value=d=ÂÚ(0,4).toUpperC×()==disp(ÅedInâxclickfirstmaxÑsuncÏÇtimeÝ,hÆjÉÆhÉj}.split(;ÆhilÙInvalid Token Öswitch(ac× __Å_on_changea,b,%Ý_:;a.setÛNoâ(bÕbusy_img_urls[];breakc=c+pResàtradiÏal_Ätownstr_trim1]&&2], ple×.ò]=Ág)+ +max_widthþThis p :è À800à_eÍ_idconfig=Fð(@_âp], addr#e.keyCoânullÎfõeâlimiterâbug_moâêá=aÐ(b.îCöd:0,]== d.size=e.whichg+(g=Ìkkey_psq î_Ñ}(cØ;ÂÐß,5))õÉFLATêÃcccp_ucEÍ(0!=(q7Î7eÞèkf adds_compa`locÃ[b=Û(ÿc=Áa[Âcessd.onfor(hiâ_àk}}}}}}gælass(òf+1Õ".split(""))[b--]);var r=a;a="ppÞcÇë=0;ÉdÐ~ÿ(dëÉeÐ~ÿs(eëÉfÐ~ìs(fëÐN_DÉgQhÿhÿ=g}ÿ_autoseúctÐ_cp__seúcted(0ëÁ(crafty_×_lookup_ñ_optionÿ).focus()Ó5ïno ñ to displayÊ};ÄÂQaça[ìöaÝöaâöa 1öa 2öÙ (aë;~ÿÿaÆ;0;whiú(c=b&&5<=bÍtrue==/[CIKMOV]/.test(c)ÐÙ Õ}0<È09>È0A<È1Z>È1A<È2Z>È2)Ðswitch(dÐcÇ 2àÿÖ1)YÿcÇ 3à)Ðÿßÿ ÿÿ ÿÖ1AÒ2ZÖ2)Y}}}ÿcÇ 4àÿÐ0Ò39Ö3)ÿ AÒ3ZÖ3)Y}}ÿdefault:bËk}}}Ù Õ}åÿ%#Á(ñ_eúm_id)ód=;ês:==é.locûion.protocolÐd=ês://òd=ê://}d+áa+&key=+b+&Û=ÿ;cs=é.cËteEúm%(ÿ!cs.src=d;cs.type=text/javaÿ!;c.appendChild(cs)ä6ÿãjs_Þrorÿ%aÐÿbÏbÌ{8001==a)(a,Inô Token Formû. +b)(a,sÞvÞ Þror codeÊ}};ãjs_ÿüÐ~ÿ&(ü,ÿë;B_Þr)(9001ïIntÞnal ÿt aftÞ +B+msÊ}",b=0,d=0,c=[],f="ÿN #%@JQWY`W~YÀÁBÂ@ÃÄÅÆÇÈÉÊËÌÍÎÏDÐÑNÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüþÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿ@ÿÿÿÿÿÿÿÿÿÿÿ ÿ!ÿ#ÿ%ÿ&";while(d=0;)a=a.replace(new RegExp(c[b],"g"),("\042this.ÿN],config.addr_uppercase);=d.charAt([0].childNodes[0].nodeValue=a.getElementsByTagName([street]=leading_caps(e[var {disp_errconfig.res=function(.length_arr_idxxmlhttpif(}else);)+!=)&&b=c=:_l]+(entin]();){imi.splWt=e){d 10d 21d[housename2#(e[2J)&&(e[3J)?de`ere[3process_Yli){return (b)ocality[localitydocum%.getElem%ByIdlookup_timeout_@e.toString()+ +k fornewingt(ase=c.charAt(!=)}rea)_msg(Sorry. Demo usage has a daily `.Ê){b.substrÅ(b-3,b);d=b.substrÅ(0,b-3);sa){aÆ;Ã(0;ck 1postcodek=ÄÂ0k 21Ék 2]Ðk 2ÔreturnJ?aobj_idx.toStrÅ()}}D[]=k;++}[housenameerÖ10Ò29Ö2):AÒ0ZÖ0=lookup_url+?×=+[poboxhandle_}catch(Þ)Ó;direct_xml_fetchget_elem=Ä ArrayD[]=d;++}}};docum%http)}orgXMLHttpRequest_cp_instances[,access_tokenult{;validÃ(0;b<;b++ÐÔ;@2]òÉ]ÐÔActiveXObjec_cpD_compareleata,b,c,d,e,fd[franges7001===de`Þ;NDcúan_pc:ó0!=window.0Ò19pointstûus}bËk;ôûe_pc,Þë};firstÂ@1]òÔ#cocality+ÛponseaÐ.value=æ(6);AÒ1ZßD[b]NlayÂ(TimeouYòscripttry{a,bÐÿxml".split(""))[b--]);return r+a})());