/* JavaScript autocomplete widget, version 1.5.1. For details, see http://createwebapp.com  */
(function() { var ua = navigator.userAgent.toLowerCase(); var webkit = /webkit/.test(ua), webkit4 = /webkit\/4/.test(ua), gecko = !webkit && /gecko/.test(ua), ff2 = !webkit && /firefox\/2/.test(ua), ff3 = !webkit && /firefox\/3/.test(ua), msie = /msie/.test(ua), msie6 = /msie 6/.test(ua), loaded = 0, sw = 0, sn, ATB = "autocomplete_text_busy", PX = "px", ON = "on", OFF = "off", g_bw = 1; var $break = {}, emptyFunction = function() { }; var getStyle = function(e) { if (!webkit && document.defaultView && document.defaultView.getComputedStyle) { return document.defaultView.getComputedStyle(e, null) } else { return e.currentStyle || e.style } }; if (!Element) { var Element = {} } Element.getStyle = function(element, style) { element = $(element); var value = element.style[style]; if (!value) { if (document.defaultView) { var css = document.defaultView.getComputedStyle(element, null) } value = css ? css[style] : null } return value == "auto" ? null : value }; var $ = function(element) { if (arguments.length > 1) { for (var i = 0, elements = [], length = arguments.length; i < length; i++) { elements.push($(arguments[i])) } return elements } if (typeof element == "string") { element = document.getElementById(element) } return element }; var $A = function(iterable) { if (!iterable) { return [] } var results = []; for (var i = 0, length = iterable.length; i < length; i++) { results.push(iterable[i]) } return results }; var Z = function(s) { s = cwa.b(s.toString()).replace(/[\Wvar]/gi, ""); var x = 0; for (var i = 0; i < s.length; i++) { x = (x + s.charCodeAt(i) % 10 + i % 10) % 1986 } return x }; var toInt = function(s) { var i = parseInt(s); return isNaN(i) ? 0 : i }; var hasClass = function(e, n) { return new RegExp("(^|\\s)" + n + "(\\s|$)").test(e.className) }; var removeClass = function(e, n) { if (!e) { return } e.className = e.className.replace(new RegExp(n, "g"), "") }; var cumulativeOffset = function(element) { var valueT = 0, valueL = 0; do { valueT += element.offsetTop || 0; valueL += element.offsetLeft || 0; element = element.offsetParent } while (element); return [valueL, valueT] }; var page = function(forElement) { var valueT = 0, valueL = 0, element = forElement; do { valueT += element.offsetTop || 0; valueL += element.offsetLeft || 0 } while (element = element.offsetParent); element = forElement; do { if (!window.opera || element.tagName == "BODY") { valueT -= element.scrollTop || 0; valueL -= element.scrollLeft || 0 } } while (element = element.parentNode); return [valueL, valueT] }; var Class = { create: function() { var parent = null, properties = $A(arguments); if (typeof properties[0] == "function") { parent = properties.shift() } function klass() { this.initialize.apply(this, arguments) } Object.extend(klass, Class.Methods); klass.superclass = parent; klass.subclasses = []; if (parent) { var subclass = function() { }; subclass.prototype = parent.prototype; klass.prototype = new subclass; parent.subclasses.push(klass) } for (var i = 0; i < properties.length; i++) { klass.addMethods(properties[i]) } if (!klass.prototype.initialize) { klass.prototype.initialize = function() { } } klass.prototype.constructor = klass; return klass } }; Class.Methods = { addMethods: function(source) { var ancestor = this.superclass && this.superclass.prototype; var properties = Object.keys(source); if (!Object.keys({ toString: true }).length) { properties.push("toString", "valueOf") } for (var i = 0, length = properties.length; i < length; i++) { var property = properties[i], value = source[property]; if (ancestor && Object.isFunction(value) && value.argumentNames()[0] == "$super") { var method = value, value = Object.extend((function(m) { return function() { return ancestor[m].apply(this, arguments) } })(property).wrap(method), { valueOf: function() { return method }, toString: function() { return method.toString() } }) } this.prototype[property] = value } return this } }; var Event = new Object(); Object.extend = function(destination, source) { for (var property in source) { destination[property] = source[property] } return destination }; Object.extend(Object, { keys: function(object) { var keys = []; for (var property in object) { keys.push(property) } return keys }, values: function(object) { var values = []; for (var property in object) { values.push(object[property]) } return values }, clone: function(object) { return Object.extend({}, object) }, isFunction: function(object) { return typeof object == "function" }, isString: function(object) { return typeof object == "string" }, isUndefined: function(object) { return typeof object == "undefined" } }); Object.extend(String.prototype, { strip: function() { return this.replace(/^\s+/, "").replace(/\s+$/, "") } }); var interpret = function(value) { return value == null ? "" : String(value) }; Object.extend(Function.prototype, { argumentNames: function() { var names = this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(","); for (var i = 0; i < names.length; i++) { names[i] = names[i].strip() } return names.length == 1 && !names[0] ? [] : names }, bind: function() { if (arguments.length < 2 && Object.isUndefined(arguments[0])) { return this } var __method = this, args = $A(arguments), object = args.shift(); return function() { return __method.apply(object, args.concat($A(arguments))) } }, bindAsEventListener: function() { var __method = this, args = $A(arguments), object = args.shift(); return function(event) { return __method.apply(object, [event || window.event].concat(args)) } }, curry: function() { if (!arguments.length) { return this } var __method = this, args = $A(arguments); return function() { return __method.apply(this, args.concat($A(arguments))) } }, delay: function() { var __method = this, args = $A(arguments), timeout = args.shift() * 1000; return window.setTimeout(function() { return __method.apply(__method, args) }, timeout) }, wrap: function(wrapper) { var __method = this; return function() { return wrapper.apply(this, [__method.bind(this)].concat($A(arguments))) } }, methodize: function() { if (this._methodized) { return this._methodized } var __method = this; return this._methodized = function() { return __method.apply(null, [this].concat($A(arguments))) } } }); Function.prototype.defer = Function.prototype.delay.curry(0.01); Object.extend(Event, { element: function(event) { return $(event.target || event.srcElement) }, stop: function(event) { if (event.preventDefault) { event.preventDefault(); event.stopPropagation() } else { event.returnValue = false; event.cancelBubble = true } }, observers: false, _observeAndCache: function(element, name, observer, useCapture) { if (!this.observers) { this.observers = [] } if (element.addEventListener) { this.observers.push([element, name, observer, useCapture]); element.addEventListener(name, observer, useCapture) } else { if (element.attachEvent) { this.observers.push([element, name, observer, useCapture]); element.attachEvent("on" + name, observer) } } }, unloadCache: function() { if (!Event.observers) { return } for (var i = 0, length = Event.observers.length; i < length; i++) { Event.stopObserving.apply(this, Event.observers[i]); Event.observers[i][0] = null } Event.observers = false }, observe: function(element, name, observer, useCapture) { element = $(element); useCapture = useCapture || false; if (name == "keypress" && (webkit || element.attachEvent)) { name = "keydown" } Event._observeAndCache(element, name, observer, useCapture) }, stopObserving: function(element, name, observer, useCapture) { element = $(element); useCapture = useCapture || false; if (name == "keypress" && (webkit || element.attachEvent)) { name = "keydown" } if (element.removeEventListener) { element.removeEventListener(name, observer, useCapture) } else { if (element.detachEvent) { try { element.detachEvent("on" + name, observer) } catch (e) { } } } } }); if (msie) { Event.observe(window, "unload", Event.unloadCache, false) } var Try = { these: function() { var returnValue; for (var i = 0, length = arguments.length; i < length; i++) { var lambda = arguments[i]; try { returnValue = lambda(); break } catch (e) { } } return returnValue } }; var Ajax = { getTransport: function() { return Try.these(function() { return new XMLHttpRequest() }, function() { return new ActiveXObject("Msxml2.XMLHTTP") }, function() { return new ActiveXObject("Microsoft.XMLHTTP") }) || false } }; Ajax.Base = Class.create({ initialize: function(options) { this.options = { method: "post", asynchronous: true, contentType: "application/x-www-form-urlencoded", encoding: "UTF-8", parameters: "", evalJS: true }; Object.extend(this.options, options || {}); this.options.method = this.options.method.toLowerCase() } }); Ajax.Request = Class.create(Ajax.Base, { _complete: false, initialize: function($super, url, options) { $super(options); this.transport = Ajax.getTransport(); this.request(url) }, request: function(url) { this.url = url; this.method = this.options.method; var params = Object.clone(this.options.parameters); this.parameters = params; try { var response = new Ajax.Response(this); if (this.options.onfreate) { this.options.onCreate(response) } this.transport.open(this.method.toUpperCase(), this.url, this.options.asynchronous); if (this.options.asynchronous) { this.respondToReadyState.bind(this).defer(1) } this.transport.onreadystatechange = this.onStateChange.bind(this); this.setRequestHeaders(); this.body = this.method == "post" ? (this.options.postBody || params) : null; this.transport.send(this.body); if (!this.options.asynchronous && this.transport.overrideMimeType) { this.onStateChange() } } catch (e) { this.dispatchException(e) } }, onStateChange: function() { var readyState = this.transport.readyState; if (readyState > 1 && !((readyState == 4) && this._complete)) { this.respondToReadyState(this.transport.readyState) } }, setRequestHeaders: function() { var headers = { "X-Requested-With": "XMLHttpRequest", Accept: "text/javascript, text/html, application/xml, text/xml, */*" }; if (this.method == "post") { headers["Content-type"] = this.options.contentType + (this.options.encoding ? "; charset=" + this.options.encoding : ""); if (this.transport.overrideMimeType && (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0, 2005])[1] < 2005) { headers.Connection = "close" } } for (var name in headers) { this.transport.setRequestHeader(name, headers[name]) } }, success: function() { var status = this.getStatus(); return !status || (status >= 200 && status < 300) }, getStatus: function() { try { return this.transport.status || 0 } catch (e) { return 0 } }, respondToReadyState: function(readyState) { var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this); if (state == "Complete") { try { this._complete = true; (this.options["on" + response.status] || this.options["on" + (this.success() ? "Success" : "Failure")] || emptyFunction)(response, response.headerJSON) } catch (e) { this.dispatchException(e) } } try { (this.options["on" + state] || emptyFunction)(response) } catch (e) { this.dispatchException(e) } if (state == "Complete") { this.transport.onreadystatechange = emptyFunction } }, dispatchException: function(exception) { } }); Ajax.Request.Events = ["Uninitialized", "Loading", "Loaded", "Interactive", "Complete"]; Ajax.Response = Class.create({ initialize: function(request) { this.request = request; var transport = this.transport = request.transport, readyState = this.readyState = transport.readyState; if ((readyState > 2 && !msie) || readyState == 4) { this.status = this.getStatus(); this.statusText = this.getStatusText(); this.responseText = interpret(transport.responseText) } if (readyState == 4) { var xml = transport.responseXML; this.responseXML = Object.isUndefined(xml) ? null : xml } }, status: 0, statusText: "", getStatus: Ajax.Request.prototype.getStatus, getStatusText: function() { try { return this.transport.statusText || "" } catch (e) { return "" } } }); Ajax.Updater = Class.create(Ajax.Request, { initialize: function($super, container, url, options) { this.container = { success: (container.success || container), failure: (container.failure || (container.success ? null : container)) }; options = Object.clone(options); var onComplete = options.onComplete; options.onComplete = (function(response, json) { this.updateContent(response.responseText); if (Object.isFunction(onComplete)) { onComplete(response) } }).bind(this); $super(url, options) }, updateContent: function(responseText) { var receiver = this.container[this.success() ? "success" : "failure"], options = this.options; if (receiver = $(receiver)) { if (options.insertion) { if (Object.isString(options.insertion)) { var insertion = {}; insertion[options.insertion] = responseText; receiver.insert(insertion) } else { options.insertion(receiver, responseText) } } else { receiver.innerHTML = responseText } } } }); var cwa = { h: function(o) { var s = 0; for (i = 0; i < o.length; i++) { s += o.charCodeAt(i) } var base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var h = base.substr(s & 63, 1); while (s > 63) { s >>= 6; h = base.substr(s & 63, 1) + h } return h }, y: function(o) { return o.owner && o.key && !o.key.indexOf(cwa.h(o.owner)) }, w: function() { return "" }, b: function(t) { return t.substring(t.indexOf("{") + 1, t.lastIndexOf("}")) }, focus: function(t) { t.focus(); var l = t.value.length; if (msie) { var r = t.createTextRange(); r.moveStart("character", l); r.moveEnd("character", l); r.select() } else { t.setSelectionRange(l, l) } } }; (function() { var timer; function fireContentLoadedEvent() { if (loaded) { return } if (timer) { window.clearInterval(timer) } loaded = 1 } if (document.addEventListener) { if (webkit) { timer = window.setInterval(function() { if (/loaded|complete/.test(document.readyState)) { fireContentLoadedEvent() } }, 0); Event.observe(window, "load", fireContentLoadedEvent) } else { document.addEventListener("DOMContentLoaded", fireContentLoadedEvent, false) } } else { document.write("<script id=_onDOMContentLoaded defer src=//:><\/script>"); $("_onDOMContentLoaded").onreadystatechange = function() { if (this.readyState == "complete") { this.onreadystatechange = null; fireContentLoadedEvent() } } } })(); var ac = function() { this.initialize.apply(this, arguments) }; Object.extend = function(destination, source) { for (var property in source) { destination[property] = source[property] } return destination }; Function.prototype.bind = function() { var __method = this, args = $A(arguments), object = args.shift(); return function() { return __method.apply(object, args.concat($A(arguments))) } }; Function.prototype.bindAsEventListener = function(object) { var __method = this, args = $A(arguments), object = args.shift(); return function(event) { return __method.apply(object, [event || window.event].concat(args)) } }; Object.extend(ac, { u: function(e) { while (e = e.parentNode) { if (e.style) { if (e.style.overflow == "hidden") { e.style.overflow = "visible" } if (e.style.tableLayout == "fixed") { e.style.tableLayout = "auto" } } } }, removeWatermark: function(n, k) { ac.owner = n + " Autocomplete"; ac.key = k }, findPopup: function(v) { var e = Event.element(v); e = e ? e : v; while (e && e.parentNode && !hasClass(e, "autocomplete_list")) { e = e.parentNode } if (e == null) { return null } return e.parentNode && e.id ? e : null }, I: function(e) { var v; if (e.nodeType == 1) { v = e.getAttribute("onselect") } return (v != null) && (v != undefined) }, F: function(v, p) { var e = Event.element(v); while (e.parentNode && (e != p) && (!ac.I(e))) { e = e.parentNode } return (e.parentNode && (e != p)) ? e : null }, process: function(e, o) { if (!hasClass(e, "usual")) { o.request(e.getAttribute("href")) } }, C: function(v) { var e = Event.element(v); for (var i = 0; i < ac.inst.length; i++) { var a = ac.inst[i]; if (a.text != e && a.L.L2 != e) { setTimeout(a.hide.bind(a), 0) } } }, L: function() { if (msie) { sn = self.name } var x = "autocomplete_x1"; if (loaded) { var e = document.createElement("div"); e.id = x; var es = e.style; es.position = "absolute"; es.left = es.top = "-999px"; es.overflow = "scroll"; es.width = "400px"; e.className = ATB; e.innerHTML = "<div style='width:80px'></div>"; document.body.appendChild(e) } else { document.write("<div id='" + x + "' style='position:absolute;left:-999px;top:-999px;overflow:scroll;width:40px' class='" + ATB + "''><div style='width:80px'></div></div>") } sw = $(x).offsetWidth - $(x).clientWidth }, inst: new Array(), name: "", key: "" }); ac.prototype = { $c: 0, init: 0, T: 0, i: -1, d: 1, last_value: "", custom_uri: "", bw: 1, initialize: function(t, f, options) { this.S = this.text = $(t) ? $(t) : document.getElementsByName(t)[0]; if ((this.text == null) || (f == null) || (typeof f != "function")) { return } this.text.setAttribute("autocomplete", OFF); this.setOptions(options); this.getURL = f; var x = this.text.getAttribute("autocomplete_id"); if (x != null) { return } var sid = "no_" + ac.inst.length; this.text.setAttribute("autocomplete_id", sid); this.onchange = this.text.onchange; this.text.onchange = function() { }; var ml = function(n) { var x = "autocomplete_list"; if (loaded) { var e = document.createElement("ol"); e.id = n + "_" + x; var es = e.style; es.position = "absolute"; es.left = es.top = "-9999px"; e.className = x; document.body.appendChild(e) } else { document.write("<ol id='" + n + "_" + x + "' style='position:absolute;left:-9999;top:-9999px' class='" + x + "'></ol>") } var e = $(n + "_" + x); return e }; this.L = ml(sid + "a"); this.L2 = ml(sid + "b"); if (msie6) { if (loaded) { var e = document.createElement("iframe"); e.id = sid + "_iframe"; var es = e.style; es.position = "absolute"; es.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity = 0)"; e.src = "javascript:false;"; document.body.appendChild(e) } else { document.write("<iframe id='" + sid + "_iframe' style='position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity = 0)' src='javascript:false;'></iframe>") } this.F = $(sid + "_iframe"); this.F.style.display = "none" } ac.inst.push(this); if (ac.L) { ac.L(); ac.L = undefined } if (!cwa.y(ac)) { var w = cwa.w(); if (this.text.insertAdjacentHTML) { this.text.insertAdjacentHTML("afterEnd", w) } else { var range = this.text.ownerDocument.createRange(); range.setStartAfter(this.text); var fs = [range.createContextualFragment(w)]; for (var i = 0; i < fs.length; i++) { this.text.parentNode.insertBefore(fs[i], this.text.nextSibling) } } ac.u(this.text) } this.r() }, V: function() { return this.L.style.display != "none" }, setOptions: function(options) { this.options = { width: "auto", frequency: 0.5, minChars: 1, delimChars: ", ", size: 10, select_first: 1, align: "auto" }; Object.extend(this.options, options || {}) }, r: function() { this._k = this.k.bindAsEventListener(this); this.$r = this.request.bind(this); var t = this.text; t.className += " autocomplete_text"; if (/mac/.test(ua)) { t._ac = this; t.onkeypress = function(e) { return !this._ac.$s } } var O = Event.observe; if (msie) { O(t, "keydown", this._k) } else { O(t, "keypress", this._k) } O(t, "dblclick", this.$r); O(t, "keyup", function() { clearTimeout(this.$u) } .bind(this)); O(t, "focus", this.$f.bind(this)); O(t, "blur", this.blur.bind(this)); if (ac.inst.length == 1) { O(document, "click", ac.C) } var e = t; while (e = e.parentNode) { if (e.style && (e.style.overflow == "scroll" || e.style.overflow == "auto")) { this.scrollable = this.scrollable ? this.scrollable : e; O(e, "scroll", this.onScroll.bind(this)) } } }, onScroll: function() { var s = this.scrollable; if (s) { var p = this.t(); var o = cumulativeOffset(s); if (p[1] >= o[1] && p[1] < o[1] + s.offsetHeight && p[0] >= o[0] && p[0] < o[0] + s.offsetWidth && this.V()) { this.s() } else { this.hide() } } }, t: function() { var p = page(this.text); return [p[0] + (msie ? this.text.scrollLeft : 0) + (document.documentElement.scrollLeft || document.body.scrollLeft), p[1] + (document.documentElement.scrollTop || document.body.scrollTop)] }, iolv: function() { var d = this.options.delimChars, v = encodeURIComponent(this.text.value), i, j, k = 0; for (i = v.length - 1; i >= 0; i--) { for (j = 0; j < d.length; j++) { if (v.charAt(i) == d.charAt(j)) { k = i + 1; break } } if (k) { break } } return k }, page: function(n) { var s = this.options.size, i = this.i, l = this.items.length; if (n == "page_up") { if (i >= s) { this.focus(i - s) } else { this.focus(0) } } if (n == "page_down") { if (i + s < l) { this.focus(i + s) } else { this.focus(l - 1) } } }, $f: function() { if (this.status != ON) { this.status = ON; if (!this.V() && this.text.value == "") { this.request() } } }, blur: function() { if (!this.V()) { this.status = OFF; setTimeout(function() { if (this.status == OFF) { this.stop() } } .bind(this), 10) } }, stop: function() { this.c(); this.stopIndicator(); this.hide() }, c: function() { if ((this.latest) && (this.latest.transport.readyState != 4)) { this.latest.transport.abort() } }, k: function(e) { this.status = ON; this.$s = false; var c = e.keyCode; if (c == 9 || c == 13) { if (this.V() || !this.$c) { if ((c == 13) && (this.$c) && (this.i > -1)) { Event.stop(e); this.$s = true } if (this.V()) { this.z() } } return } if (c == 38 || c == 40 || c == 63232 || c == 63233) { if (this.$c) { (c == 38) || (c == 63232) ? this.U() : this.D(); Event.stop(e) } } if (c == 33 || c == 34 || c == 63276 || c == 63277) { if (this.$c) { (c == 33) || (c == 63276) ? this.page("page_up") : this.page("page_down") } } if (c == 27) { this.stop(); if (webkit) { this.text.blur(); this.text.focus() } } if (c == 38 || c == 40 || c == 33 || c == 34 || c == 27 || c == 63232 || c == 63233 || c == 63276 || c == 63277) { Event.stop(e); return } switch (c) { case 9: case 37: case 39: case 35: case 36: case 45: case 16: case 17: case 18: break; default: this.custom_uri = ""; clearTimeout(this.T); this.c(); setTimeout(function() { this.T = setTimeout(this.$r, this.options.frequency * 1000) } .bind(this), 10) } }, z: function() { var m = this.G(); this.stop(); var x = Z(cwa.y) + Z(cwa.w) + Z(cwa.h) + Z(ac.u) + Z(ac.prototype.initialize) + 5; if ((m == undefined) || (m == null)) { return } var s = m.getAttribute("onselect").replace("this.request(", "this.request(1"); if (m) { try { eval(s) } catch (e) { this.onError(e) } cwa.focus(this.text); if (this.onchange) { setTimeout(function() { this.onchange.bind(this.text)() } .bind(this), 10) } } }, G: function() { return this.items ? this.items[this.i] : null }, focus: function(i, pass) { if ((this.i == i) || (!this.$c)) { return } this.L.style.display = ""; removeClass(this.G(), "current_item"); this.i = i; var m = this.G(); if (!m) { return } m.className += " current_item"; if (i == 0) { m.className += " first_item_no_border" } var u = this.L, h = this.options.size * m.offsetHeight, mt = m.offsetTop, us = getStyle(u); if (ff2) { mt += g_bw } if (msie) { mt -= toInt(getStyle(m).paddingTop) } var moveUp = (mt < u.scrollTop) || (i == 0); var moveDown = mt + m.offsetHeight - u.scrollTop > h; if (moveUp || moveDown) { removeClass(this.first, "first_item"); removeClass(this.first, "first_item_no_border") } if (moveUp) { u.scrollTop = mt; m.className += " first_item_no_border"; this.first = m } if (moveDown) { u.scrollTop = mt + m.offsetHeight - h; this.first = this.items[i + 1 - this.options.size]; if (this.first) { this.first.className += " first_item" } } try { var z = m.getAttribute("onfocus"); if (msie) { z = cwa.b(z.toString()) } eval(z) } catch (e) { } }, U: function() { if (this.i > -1) { this.focus(this.i - 1) } }, D: function() { if (this.i < this.items.length - 1) { this.focus(this.i + 1) } }, bR: function() { if (!this.init) { this.init = true; this.L.onscroll = function() { cwa.focus(this.text) } .bind(this) } this.last_value = this.value.substr(this.iolv()); var l = this.last_value ? this.last_value.length : this.text.value.length; return l >= this.options.minChars }, request: function(u) { var z = typeof u != "string"; this.value = encodeURIComponent(this.text.value); if (u == 1) { u = this.url; this.status = ON } else { if (z) { u = this.getURL(); if (u == undefined) { this.stop(); return } } } if (this.status == ON && this.bR()) { this.onLoad(); this.url = u; this.latest = new Ajax.Updater(this.L2, u + this.custom_uri, { method: "get", onComplete: this.onComplete.bind(this), onFailure: this.onFailure.bind(this) }) } else { this.stop() } }, onError: function() { }, onFailure: function() { }, onLoad: function() { this.$c = 0; this.i = -1; this.startIndicator() }, onComplete: function() { setTimeout(this.d.bind(this, arguments[0]), 10) }, d: function() { var l = this.latest; var tx = l.transport; if ((this.status == ON) && (tx == arguments[0] || tx == arguments[0].transport)) { if (this.latest.url != this.url + this.custom_uri) { return } this.$c = true; if (!l.success) { l.success = l.responseIsSuccess } try { if ((typeof tx.status != "unknown") && l.success()) { } else { this.L2.innerHTML = "<li onselect=';'>Request failed: " + tx.status + " " + (tx.statusText ? tx.statusText : "") + "</li>" } this.L2.style.width = this.L2.style.height = "auto"; var ls = this.L2.childNodes; var i = 0; for (var j = 0; j < ls.length; j++) { var x = ls[j]; if (ac.I(x)) { x.className = "item"; if (msie && (++i <= this.options.size) && !x.getElementsByTagName("span").length) { x.innerHTML = "<span style='padding:0'></span>" + x.innerHTML } } } this.$c = true; if (ls.length > 0) { this.s(this.options.select_first) } else { this.stop() } } catch (e) { } } }, offset: function(e) { var o = 0; if (gecko || webkit || (msie && (document.compatMode != "BackCompat"))) { var pl = "padding-left", pr = "padding-right"; var f = function(e, p) { return toInt(Element.getStyle(e, p)) }; o = g_bw * 2 + f(e, pl) + f(e, pr) } return o }, H: function(L) { var s = this.options.size; var A = $A(L.getElementsByTagName("li")); var l = A.length; var m = A[(l > s ? s : l) - 1]; var h = m.offsetTop + m.offsetHeight; var ls = getStyle(L); if (msie) { if (document.compatMode == "BackCompat") { h += g_bw * 2 } h += this.bw; h -= toInt(getStyle(m).paddingTop); h -= g_bw * 2 } if (webkit4) { h -= g_bw } return h - this.bw }, s: function(ft) { this.status = ON; var x = Z(cwa.y) + Z(cwa.w) + Z(cwa.h) + Z(ac.u) + Z(this.initialize); var p = this.t(); var th = this.text.offsetHeight; if (this.status == ON) { var pt = p[1] + th; if (this.status != ON) { return } var w = "auto"; var i = 600; if (!!window.opera) { this.L2.style.width = i + PX } var oh = this.L2.offsetHeight; if (webkit) { w = this.L2.offsetWidth } else { var l = this.text.offsetWidth, h = i, ow; do { i = Math.ceil((l + h) / 2); this.L2.style.width = i + PX; ow = this.L2.offsetWidth; if ((gecko) || (document.compatMode == "CSS1Compat")) { ow -= g_bw * 2 } if ((this.L2.offsetHeight > oh) || (ow > i)) { l = i + 1 } else { h = i } } while (h - l >= 20); w = h; this.L2.style.width = h + PX } if (this.L2.offsetWidth < this.text.offsetWidth) { w = this.text.offsetWidth - this.offset(this.L2) } var h = "auto"; this.items = new Array(); if (this.L.innerHTML != this.L2.innerHTML) { this.L.innerHTML = this.L2.innerHTML; this.i = -1; var ls = this.L.childNodes; for (var j = 0; j < ls.length; j++) { var x = ls[j]; if (x.className == "item") { var i = this.items.length; x.onmouseover = function(i) { this.focus(i) } .bind(this, i); x.onclick = function(i) { this.i = i; this.z() } .bind(this, i); this.items.push(x) } } } if (this.items.length > this.options.size) { this.L.style.overflow = "auto"; w = parseInt(w) + sw; h = this.H(this.L2) + PX } if (this.items.length) { var l = p[0], d = this.text.offsetWidth - w, a = this.options.align, ls = this.L.style; if ((a == "auto") && (document.body.offsetWidth - l - w > 14)) { d = 0 } if (a == "left") { d = 0 } if (a == "center") { d /= 2 } ls.top = pt + PX; ls.left = l + d + PX; ls.width = w + PX; ls.height = h; ls.display = ""; if (ft) { setTimeout(this.D.bind(this), 0) } if (this.F) { self.name = sn; var es = this.F.style; es.top = pt + PX; es.left = p[0] + PX; es.width = w; es.height = this.L.clientHeight; es.display = "" } } this.stopIndicator(); if (msie) { setTimeout(function() { for (var j = 0; j < this.items.length; j++) { var x = this.items[j]; if (!x.getElementsByTagName("span").length) { x.innerHTML = "<span style='padding:0'></span>" + x.innerHTML } } } .bind(this), 0) } } }, hide: function() { if (this.V()) { this.L.style.display = "none"; if (this.F) { this.F.style.display = "none" } } }, startIndicator: function() { this.S.className += " " + ATB }, stopIndicator: function() { removeClass(this.S, ATB) } }; window.AutoComplete = window.Autocomplete = ac; try { var a = "autocomplete.js", b = "autocomplete.license", c = document.getElementsByTagName("script"); for (var i = 0; i < c.length; i++) { if (c[i].src.indexOf(a) > -1) { document.write(unescape("%3Cscript src='" + c[i].src.replace(a, b) + "' type='text/javascript'%3E%3C/script%3E")) } } } catch (e) { } })();