/*
 * jQuery UI 1.8.14
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI
 */
(function(A,D){A.ui=A.ui||{};if(A.ui.version){return }A.extend(A.ui,{version:"1.8.14",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});A.fn.extend({_focus:A.fn.focus,focus:function(E,F){return typeof E==="number"?this.each(function(){var G=this;setTimeout(function(){A(G).focus();if(F){F.call(G)}},E)}):this._focus.apply(this,arguments)},scrollParent:function(){var E;if((A.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){E=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(A.curCSS(this,"position",1))&&(/(auto|scroll)/).test(A.curCSS(this,"overflow",1)+A.curCSS(this,"overflow-y",1)+A.curCSS(this,"overflow-x",1))
}).eq(0)}else{E=this.parents().filter(function(){return(/(auto|scroll)/).test(A.curCSS(this,"overflow",1)+A.curCSS(this,"overflow-y",1)+A.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!E.length?A(document):E},zIndex:function(H){if(H!==D){return this.css("zIndex",H)}if(this.length){var F=A(this[0]),E,G;while(F.length&&F[0]!==document){E=F.css("position");if(E==="absolute"||E==="relative"||E==="fixed"){G=parseInt(F.css("zIndex"),10);if(!isNaN(G)&&G!==0){return G}}F=F.parent()}}return 0},disableSelection:function(){return this.bind((A.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(E){E.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});A.each(["Width","Height"],function(G,E){var F=E==="Width"?["Left","Right"]:["Top","Bottom"],H=E.toLowerCase(),J={innerWidth:A.fn.innerWidth,innerHeight:A.fn.innerHeight,outerWidth:A.fn.outerWidth,outerHeight:A.fn.outerHeight};function I(M,L,K,N){A.each(F,function(){L-=parseFloat(A.curCSS(M,"padding"+this,true))||0;
if(K){L-=parseFloat(A.curCSS(M,"border"+this+"Width",true))||0}if(N){L-=parseFloat(A.curCSS(M,"margin"+this,true))||0}});return L}A.fn["inner"+E]=function(K){if(K===D){return J["inner"+E].call(this)}return this.each(function(){A(this).css(H,I(this,K)+"px")})};A.fn["outer"+E]=function(K,L){if(typeof K!=="number"){return J["outer"+E].call(this,K)}return this.each(function(){A(this).css(H,I(this,K,true,L)+"px")})}});function C(G,E){var J=G.nodeName.toLowerCase();if("area"===J){var I=G.parentNode,H=I.name,F;if(!G.href||!H||I.nodeName.toLowerCase()!=="map"){return false}F=A("img[usemap=#"+H+"]")[0];return !!F&&B(F)}return(/input|select|textarea|button|object/.test(J)?!G.disabled:"a"==J?G.href||E:E)&&B(G)}function B(E){return !A(E).parents().andSelf().filter(function(){return A.curCSS(this,"visibility")==="hidden"||A.expr.filters.hidden(this)}).length}A.extend(A.expr[":"],{data:function(G,F,E){return !!A.data(G,E[3])},focusable:function(E){return C(E,!isNaN(A.attr(E,"tabindex")))},tabbable:function(G){var E=A.attr(G,"tabindex"),F=isNaN(E);
return(F||E>=0)&&C(G,!F)}});A(function(){var E=document.body,F=E.appendChild(F=document.createElement("div"));A.extend(F.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});A.support.minHeight=F.offsetHeight===100;A.support.selectstart="onselectstart" in F;E.removeChild(F).style.display="none"});A.extend(A.ui,{plugin:{add:function(F,G,I){var H=A.ui[F].prototype;for(var E in I){H.plugins[E]=H.plugins[E]||[];H.plugins[E].push([G,I[E]])}},call:function(E,G,F){var I=E.plugins[G];if(!I||!E.element[0].parentNode){return }for(var H=0;H<I.length;H++){if(E.options[I[H][0]]){I[H][1].apply(E.element,F)}}}},contains:function(F,E){return document.compareDocumentPosition?F.compareDocumentPosition(E)&16:F!==E&&F.contains(E)},hasScroll:function(H,F){if(A(H).css("overflow")==="hidden"){return false}var E=(F&&F==="left")?"scrollLeft":"scrollTop",G=false;if(H[E]>0){return true}H[E]=1;G=(H[E]>0);H[E]=0;return G},isOverAxis:function(F,E,G){return(F>E)&&(F<(E+G))},isOver:function(J,F,I,H,E,G){return A.ui.isOverAxis(J,I,E)&&A.ui.isOverAxis(F,H,G)
}})})(jQuery);/*
 * jQuery UI Widget 1.8.14
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Widget
 */
(function(B,D){if(B.cleanData){var C=B.cleanData;B.cleanData=function(E){for(var F=0,G;(G=E[F])!=null;F++){B(G).triggerHandler("remove")}C(E)}}else{var A=B.fn.remove;B.fn.remove=function(E,F){return this.each(function(){if(!F){if(!E||B.filter(E,[this]).length){B("*",this).add([this]).each(function(){B(this).triggerHandler("remove")})}}return A.call(B(this),E,F)})}}B.widget=function(F,H,E){var G=F.split(".")[0],J;F=F.split(".")[1];J=G+"-"+F;if(!E){E=H;H=B.Widget}B.expr[":"][J]=function(K){return !!B.data(K,F)};B[G]=B[G]||{};B[G][F]=function(K,L){if(arguments.length){this._createWidget(K,L)}};var I=new H();I.options=B.extend(true,{},I.options);B[G][F].prototype=B.extend(true,I,{namespace:G,widgetName:F,widgetEventPrefix:B[G][F].prototype.widgetEventPrefix||F,widgetBaseClass:J},E);
B.widget.bridge(F,B[G][F])};B.widget.bridge=function(F,E){B.fn[F]=function(I){var G=typeof I==="string",H=Array.prototype.slice.call(arguments,1),J=this;I=!G&&H.length?B.extend.apply(null,[true,I].concat(H)):I;if(G&&I.charAt(0)==="_"){return J}if(G){this.each(function(){var K=B.data(this,F),L=K&&B.isFunction(K[I])?K[I].apply(K,H):K;if(L!==K&&L!==D){J=L;return false}})}else{this.each(function(){var K=B.data(this,F);if(K){K.option(I||{})._init()}else{B.data(this,F,new E(I,this))}})}return J}};B.Widget=function(E,F){if(arguments.length){this._createWidget(E,F)}};B.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(F,G){B.data(G,this.widgetName,this);this.element=B(G);this.options=B.extend(true,{},this.options,this._getCreateOptions(),F);var E=this;this.element.bind("remove."+this.widgetName,function(){E.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return B.metadata&&B.metadata.get(this.element[0])[this.widgetName]
},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(F,G){var E=F;if(arguments.length===0){return B.extend({},this.options)}if(typeof F==="string"){if(G===D){return this.options[F]}E={};E[F]=G}this._setOptions(E);return this},_setOptions:function(F){var E=this;B.each(F,function(G,H){E._setOption(G,H)});return this},_setOption:function(E,F){this.options[E]=F;if(E==="disabled"){this.widget()[F?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",F)}return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(F,G,H){var J=this.options[F];G=B.Event(G);G.type=(F===this.widgetEventPrefix?F:this.widgetEventPrefix+F).toLowerCase();
H=H||{};if(G.originalEvent){for(var E=B.event.props.length,I;E;){I=B.event.props[--E];G[I]=G.originalEvent[I]}}this.element.trigger(G,H);return !(B.isFunction(J)&&J.call(this.element[0],G,H)===false||G.isDefaultPrevented())}}})(jQuery);(function(F,G){F.ui=F.ui||{};var D=/left|center|right/,E=/top|center|bottom/,A="center",B=F.fn.position,C=F.fn.offset;F.fn.position=function(I){if(!I||!I.of){return B.apply(this,arguments)}I=F.extend({},I);var M=F(I.of),L=M[0],O=(I.collision||"flip").split(" "),N=I.offset?I.offset.split(" "):[0,0],K,H,J;if(L.nodeType===9){K=M.width();H=M.height();J={top:0,left:0}}else{if(L.setTimeout){K=M.width();H=M.height();J={top:M.scrollTop(),left:M.scrollLeft()}}else{if(L.preventDefault){I.at="left top";K=H=0;J={top:I.of.pageY,left:I.of.pageX}}else{K=M.outerWidth();H=M.outerHeight();J=M.offset()}}}F.each(["my","at"],function(){var P=(I[this]||"").split(" ");if(P.length===1){P=D.test(P[0])?P.concat([A]):E.test(P[0])?[A].concat(P):[A,A]}P[0]=D.test(P[0])?P[0]:A;P[1]=E.test(P[1])?P[1]:A;I[this]=P});if(O.length===1){O[1]=O[0]}N[0]=parseInt(N[0],10)||0;if(N.length===1){N[1]=N[0]}N[1]=parseInt(N[1],10)||0;if(I.at[0]==="right"){J.left+=K}else{if(I.at[0]===A){J.left+=K/2}}if(I.at[1]==="bottom"){J.top+=H}else{if(I.at[1]===A){J.top+=H/2
}}J.left+=N[0];J.top+=N[1];return this.each(function(){var S=F(this),U=S.outerWidth(),R=S.outerHeight(),T=parseInt(F.curCSS(this,"marginLeft",true))||0,Q=parseInt(F.curCSS(this,"marginTop",true))||0,W=U+T+(parseInt(F.curCSS(this,"marginRight",true))||0),X=R+Q+(parseInt(F.curCSS(this,"marginBottom",true))||0),V=F.extend({},J),P;if(I.my[0]==="right"){V.left-=U}else{if(I.my[0]===A){V.left-=U/2}}if(I.my[1]==="bottom"){V.top-=R}else{if(I.my[1]===A){V.top-=R/2}}V.left=Math.round(V.left);V.top=Math.round(V.top);P={left:V.left-T,top:V.top-Q};F.each(["left","top"],function(Z,Y){if(F.ui.position[O[Z]]){F.ui.position[O[Z]][Y](V,{targetWidth:K,targetHeight:H,elemWidth:U,elemHeight:R,collisionPosition:P,collisionWidth:W,collisionHeight:X,offset:N,my:I.my,at:I.at})}});if(F.fn.bgiframe){S.bgiframe()}S.offset(F.extend(V,{using:I.using}))})};F.ui.position={fit:{left:function(H,I){var K=F(window),J=I.collisionPosition.left+I.collisionWidth-K.width()-K.scrollLeft();H.left=J>0?H.left-J:Math.max(H.left-I.collisionPosition.left,H.left)
},top:function(H,I){var K=F(window),J=I.collisionPosition.top+I.collisionHeight-K.height()-K.scrollTop();H.top=J>0?H.top-J:Math.max(H.top-I.collisionPosition.top,H.top)}},flip:{left:function(I,K){if(K.at[0]===A){return }var M=F(window),L=K.collisionPosition.left+K.collisionWidth-M.width()-M.scrollLeft(),H=K.my[0]==="left"?-K.elemWidth:K.my[0]==="right"?K.elemWidth:0,J=K.at[0]==="left"?K.targetWidth:-K.targetWidth,N=-2*K.offset[0];I.left+=K.collisionPosition.left<0?H+J+N:L>0?H+J+N:0},top:function(I,K){if(K.at[1]===A){return }var M=F(window),L=K.collisionPosition.top+K.collisionHeight-M.height()-M.scrollTop(),H=K.my[1]==="top"?-K.elemHeight:K.my[1]==="bottom"?K.elemHeight:0,J=K.at[1]==="top"?K.targetHeight:-K.targetHeight,N=-2*K.offset[1];I.top+=K.collisionPosition.top<0?H+J+N:L>0?H+J+N:0}}};if(!F.offset.setOffset){F.offset.setOffset=function(L,I){if(/static/.test(F.curCSS(L,"position"))){L.style.position="relative"}var K=F(L),N=K.offset(),H=parseInt(F.curCSS(L,"top",true),10)||0,M=parseInt(F.curCSS(L,"left",true),10)||0,J={top:(I.top-N.top)+H,left:(I.left-N.left)+M};
if("using" in I){I.using.call(L,J)}else{K.css(J)}};F.fn.offset=function(H){var I=this[0];if(!I||!I.ownerDocument){return null}if(H){return this.each(function(){F.offset.setOffset(this,H)})}return C.call(this)}}}(jQuery));(function(A,B){var C=0;A.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var D=this,F=this.element[0].ownerDocument,E;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(G){if(D.options.disabled||D.element.attr("readonly")){return }E=false;var H=A.ui.keyCode;switch(G.keyCode){case H.PAGE_UP:D._move("previousPage",G);break;case H.PAGE_DOWN:D._move("nextPage",G);break;case H.UP:D._move("previous",G);G.preventDefault();break;case H.DOWN:D._move("next",G);G.preventDefault();break;case H.ENTER:case H.NUMPAD_ENTER:if(D.menu.active){E=true;G.preventDefault()}case H.TAB:if(!D.menu.active){return }D.menu.select(G);break;case H.ESCAPE:D.element.val(D.term);D.close(G);break;default:clearTimeout(D.searching);D.searching=setTimeout(function(){if(D.term!=D.element.val()){D.selectedItem=null;
D.search(null,G)}},D.options.delay);break}}).bind("keypress.autocomplete",function(G){if(E){E=false;G.preventDefault()}}).bind("focus.autocomplete",function(){if(D.options.disabled){return }D.selectedItem=null;D.previous=D.element.val()}).bind("blur.autocomplete",function(G){if(D.options.disabled){return }clearTimeout(D.searching);D.closing=setTimeout(function(){D.close(G);D._change(G)},150)});this._initSource();this.response=function(){return D._response.apply(D,arguments)};this.menu=A("<ul></ul>").addClass("ui-autocomplete").appendTo(A(this.options.appendTo||"body",F)[0]).mousedown(function(G){var H=D.menu.element[0];if(!A(G.target).closest(".ui-menu-item").length){setTimeout(function(){A(document).one("mousedown",function(I){if(I.target!==D.element[0]&&I.target!==H&&!A.ui.contains(H,I.target)){D.close()}})},1)}setTimeout(function(){clearTimeout(D.closing)},13)}).menu({focus:function(H,I){var G=I.item.data("item.autocomplete");if(false!==D._trigger("focus",H,{item:G})){if(/^key/.test(H.originalEvent.type)){D.element.val(G.value)
}}},selected:function(I,J){var H=J.item.data("item.autocomplete"),G=D.previous;if(D.element[0]!==F.activeElement){D.element.focus();D.previous=G;setTimeout(function(){D.previous=G;D.selectedItem=H},1)}if(false!==D._trigger("select",I,{item:H})){D.element.val(H.value)}D.term=D.element.val();D.close(I);D.selectedItem=H},blur:function(G,H){if(D.menu.element.is(":visible")&&(D.element.val()!==D.term)){D.element.val(D.term)}}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");if(A.fn.bgiframe){this.menu.element.bgiframe()}},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();A.Widget.prototype.destroy.call(this)},_setOption:function(D,E){A.Widget.prototype._setOption.apply(this,arguments);if(D==="source"){this._initSource()}if(D==="appendTo"){this.menu.element.appendTo(A(E||"body",this.element[0].ownerDocument)[0])}if(D==="disabled"&&E&&this.xhr){this.xhr.abort()
}},_initSource:function(){var D=this,F,E;if(A.isArray(this.options.source)){F=this.options.source;this.source=function(H,G){G(A.ui.autocomplete.filter(F,H.term))}}else{if(typeof this.options.source==="string"){E=this.options.source;this.source=function(H,G){if(D.xhr){D.xhr.abort()}D.xhr=A.ajax({url:E,data:H,dataType:"json",autocompleteRequest:++C,success:function(J,I){if(this.autocompleteRequest===C){G(J)}},error:function(){if(this.autocompleteRequest===C){G([])}}})}}else{this.source=this.options.source}}},search:function(E,D){E=E!=null?E:this.element.val();this.term=this.element.val();if(E.length<this.options.minLength){return this.close(D)}clearTimeout(this.closing);if(this._trigger("search",D)===false){return }return this._search(E)},_search:function(D){this.pending++;this.element.addClass("ui-autocomplete-loading");this.source({term:D},this.response)},_response:function(D){if(!this.options.disabled&&D&&D.length){D=this._normalize(D);this._suggest(D);this._trigger("open")}else{this.close()
}this.pending--;if(!this.pending){this.element.removeClass("ui-autocomplete-loading")}},close:function(D){clearTimeout(this.closing);if(this.menu.element.is(":visible")){this.menu.element.hide();this.menu.deactivate();this._trigger("close",D)}},_change:function(D){if(this.previous!==this.element.val()){this._trigger("change",D,{item:this.selectedItem})}},_normalize:function(D){if(D.length&&D[0].label&&D[0].value){return D}return A.map(D,function(E){if(typeof E==="string"){return{label:E,value:E}}return A.extend({label:E.label||E.value,value:E.value||E.label},E)})},_suggest:function(D){var E=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(E,D);this.menu.deactivate();this.menu.refresh();E.show();this._resizeMenu();E.position(A.extend({of:this.element},this.options.position));if(this.options.autoFocus){this.menu.next(new A.Event("mouseover"))}},_resizeMenu:function(){var D=this.menu.element;D.outerWidth(Math.max(D.width("").outerWidth(),this.element.outerWidth()))
},_renderMenu:function(F,E){var D=this;A.each(E,function(G,H){D._renderItem(F,H)})},_renderItem:function(D,E){return A("<li></li>").data("item.autocomplete",E).append(A("<a></a>").text(E.label)).appendTo(D)},_move:function(E,D){if(!this.menu.element.is(":visible")){this.search(null,D);return }if(this.menu.first()&&/^previous/.test(E)||this.menu.last()&&/^next/.test(E)){this.element.val(this.term);this.menu.deactivate();return }this.menu[E](D)},widget:function(){return this.menu.element}});A.extend(A.ui.autocomplete,{escapeRegex:function(D){return D.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},filter:function(F,D){var E=new RegExp(A.ui.autocomplete.escapeRegex(D),"i");return A.grep(F,function(G){return E.test(G.label||G.value||G)})}})}(jQuery));(function(A){A.widget("ui.menu",{_create:function(){var B=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(C){if(!A(C.target).closest(".ui-menu-item a").length){return 
}C.preventDefault();B.select(C)});this.refresh()},refresh:function(){var C=this;var B=this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem");B.children("a").addClass("ui-corner-all").attr("tabindex",-1).mouseenter(function(D){C.activate(D,A(this).parent())}).mouseleave(function(){C.deactivate()})},activate:function(E,D){this.deactivate();if(this.hasScroll()){var F=D.offset().top-this.element.offset().top,B=this.element.scrollTop(),C=this.element.height();if(F<0){this.element.scrollTop(B+F)}else{if(F>=C){this.element.scrollTop(B+F-C+D.height())}}}this.active=D.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",E,{item:D})},deactivate:function(){if(!this.active){return }this.active.children("a").removeClass("ui-state-hover").removeAttr("id");this._trigger("blur");this.active=null},next:function(B){this.move("next",".ui-menu-item:first",B)},previous:function(B){this.move("prev",".ui-menu-item:last",B)
},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(E,D,C){if(!this.active){this.activate(C,this.element.children(D));return }var B=this.active[E+"All"](".ui-menu-item").eq(0);if(B.length){this.activate(C,B)}else{this.activate(C,this.element.children(D))}},nextPage:function(D){if(this.hasScroll()){if(!this.active||this.last()){this.activate(D,this.element.children(".ui-menu-item:first"));return }var E=this.active.offset().top,C=this.element.height(),B=this.element.children(".ui-menu-item").filter(function(){var F=A(this).offset().top-E-C+A(this).height();return F<10&&F>-10});if(!B.length){B=this.element.children(".ui-menu-item:last")}this.activate(D,B)}else{this.activate(D,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))}},previousPage:function(C){if(this.hasScroll()){if(!this.active||this.first()){this.activate(C,this.element.children(".ui-menu-item:last"));
return }var D=this.active.offset().top,B=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var E=A(this).offset().top-D+B-A(this).height();return E<10&&E>-10});if(!result.length){result=this.element.children(".ui-menu-item:first")}this.activate(C,result)}else{this.activate(C,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))}},hasScroll:function(){return this.element.height()<this.element[A.fn.prop?"prop":"attr"]("scrollHeight")},select:function(B){this._trigger("selected",B,{item:this.active})}})}(jQuery));window.jsonp=function(A){searchAutoComplete.processAutoComplete(A)};var searchAutoComplete=function(){var C;var B;var A;return{processAutoComplete:function(H){var G=new Array();for(var E=0;E<H.length;E++){var F=H[E];var I=C[0].value.length;var D=F.toLowerCase().indexOf(C[0].value.toLowerCase());if(D>-1){F=F.substring(0,D)+"<b>"+F.substring(D,D+I)+"</b>"+F.substring(D+I);G[G.length]={label:F,value:H[E]}}if(G.length>=7){E=H.length+1}}B(G)},disableAutoComplete:function(D){$(C).autocomplete("close");$(C).autocomplete("disable")},initAutoComplete:function(D,G,E,F){A=G;C=$(D).autocomplete({appendTo:".kijiji-auto-complete",maxresults:7,minLength:1,maxChars:A,source:function(K,I){B=I;var M=E;var O=new Array();var H=K.term.length;if(H>A){H=A}for(var L=0;L<=H-1;L++){O[L]=encodeURIComponent(K.term.charAt(L)).toLowerCase()}for(var J=0;J<=O.length-1;J++){var P=O[J];if(P.length>1&&P.match("%")!=null){P=P.replace(/%/g,"_");if(P.indexOf("_")==0){O[J]=P.substr(1)}else{O[J]=P}}}var N=O.length;if(N==1){M+=O[0]+".js"
}else{if(N>1){for(var L=0;L<=N-1;L++){if(L!=N-1){M+=O[L]+"/"}if(L==N-1){M+=O[L]+".js"}}}else{return false}}$.ajax({type:"GET",url:M,cache:true,jsonpCallback:"jsonp",dataType:"jsonp",success:function(Q){}})},select:function(H,I){if(I.item.value!=""){$(this).val(I.item.value);this.form.submit()}},open:function(){$(this).removeClass("ui-corner-all").addClass("ui-corner-top");$("ul.ui-autocomplete li a").each(function(){$(this).html($(this).text())});$("ul.ui-autocomplete").append("<div class='autohide'><a href='#' onclick='searchAutoComplete.disableAutoComplete()'>"+F+"</a></div>")},close:function(){$(this).removeClass("ui-corner-top").addClass("ui-corner-all")}})}}}();
