/******************************************************************************
* All source and examples in this project are subject to the
* following copyright, unless specifically stated otherwise
* in the file itself:
*
* Copyright (c) 2007-2009, Metaweb Technologies, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY METAWEB TECHNOLOGIES ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL METAWEB TECHNOLOGIES BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
(function(c,q){if(!("console"in window)){var n=window.console={};n.log=n.warn=n.error=n.debug=function(){}}c.suggest=function(a,b){c.fn[a]=function(e){this.length||console.warn("Suggest: invoked on empty element set");return this.each(function(){if(this.nodeName)if(this.nodeName.toUpperCase()==="INPUT")this.type&&this.type.toUpperCase()!=="TEXT"&&console.warn("Suggest: unsupported INPUT type: "+this.type);else console.warn("Suggest: unsupported DOM element: "+this.nodeName);var i=c.data(this,a);i&&
i._destroy();c.data(this,a,new c.suggest[a](this,e))._init()})};c.suggest[a]=function(e,i){var d=this,g=this.options=c.extend(true,{},c.suggest.defaults,c.suggest[a].defaults,i),f=g.css_prefix=g.css_prefix||"",j=g.css;this.name=a;c.each(j,function(h){j[h]=f+j[h]});g.ac_param={};c.each(["type","type_strict","mql_filter","as_of_time","exclude_guids","category","all_types"],function(h,k){h=g[k];if(!(h===null||h==="")){if(typeof h==="object")h=JSON.stringify(h);g.ac_param[k]=h}});if(g.ac_param.type)this.options._type=
c.map(g.ac_param.type.split(/[, ]/),function(h){return h.replace(/[\"\[\]]/g,"")});this._status={START:"",LOADING:"",SELECT:"",ERROR:""};if(g.status&&g.status instanceof Array&&g.status.length>=3){this._status.START=g.status[0]||"";this._status.LOADING=g.status[1]||"";this._status.SELECT=g.status[2]||"";if(g.status.length===4)this._status.ERROR=g.status[3]||""}i=this.status=c('