/******************************************************************************
* 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($,undefined){if(!window.console){window.console={log:function(){},info:function(){},debug:function(){},warn:function(){},error:function(){}};}
$.suggest=function(name,prototype){$.fn[name]=function(options){if(!this.length){console.warn('Suggest: invoked on empty element set');}
return this.each(function(){if(this.nodeName){if(this.nodeName.toUpperCase()==='INPUT'){if(this.type&&this.type.toUpperCase()!=='TEXT'){console.warn('Suggest: unsupported INPUT type: '+this.type);}}else{console.warn('Suggest: unsupported DOM element: '+this.nodeName);}}
var instance=$.data(this,name);if(instance){instance._destroy();}
$.data(this,name,new $.suggest[name](this,options))._init();});};$.fn.placeholder=function(){return this.each(function(){var $this=$(this);if($this.attr("placeholder")&&!("placeholder"in this)){$this.unbind(".placeholder").bind("focus.placeholder",function(e){var self=$(this);if(self.val()===self.attr("placeholder")){self.val("");}
else{self.select();}
self.removeClass("fbs-placeholder");}).bind("blur.placeholder",function(e){var self=$(this);if(self.val()===""){self.val(self.attr("placeholder")).addClass("fbs-placeholder");}});if($this.val()===''){$this.val($this.attr("placeholder")).addClass("fbs-placeholder");}}});};$.suggest[name]=function(input,options){var self=this,o=this.options=$.extend(true,{},$.suggest.defaults,$.suggest[name].defaults,options),p=o.css_prefix=o.css_prefix||"",css=o.css;this.name=name;$.each(css,function(k,v){css[k]=p+css[k];});o.ac_param={};$.each(["type","type_strict","mql_filter","as_of_time","exclude_guids","category"],function(i,n){var v=o[n];if(v===null||v===""){return;}
if(typeof v==="object"){if(typeof JSON==="undefined"){init_JSON();}
v=JSON.stringify(v);}
o.ac_param[n]=v;});if(o.ac_param.type){this.options._type=$.map(o.ac_param.type.split(/[, ]/),function(n,i){return n.replace(/[\"\[\]]/g,"");});};this._status={START:"",LOADING:"",SELECT:""};if(o.status&&o.status instanceof Array&&o.status.length==3){this._status.START=o.status[0]||"";this._status.LOADING=o.status[1]||"";this._status.SELECT=o.status[2]||"";}
var s=this.status=$('