
var Observer=new Class({Implements:[Options,Events],options:{periodical:false,delay:1000},initialize:function(el,onFired,options){this.element=$(el)||$$(el);this.addEvent('onFired',onFired);this.setOptions(options);this.bound=this.changed.bind(this);this.resume();},changed:function(){var value=this.element.get('value');if($equals(this.value,value))return;this.clear();this.value=value;this.timeout=this.onFired.delay(this.options.delay,this);},setValue:function(value){this.value=value;this.element.set('value',value);return this.clear();},onFired:function(){this.fireEvent('onFired',[this.value,this.element]);},clear:function(){$clear(this.timeout||null);return this;},pause:function(){if(this.timer)$clear(this.timer);else this.element.removeEvent('keyup',this.bound);return this.clear();},resume:function(){this.value=this.element.get('value');if(this.options.periodical)this.timer=this.changed.periodical(this.options.periodical,this);else this.element.addEvent('keyup',this.bound);return this;}});var $equals=function(obj1,obj2){return(obj1==obj2||JSON.encode(obj1)==JSON.encode(obj2));};
var Autocompleter=new Class({Implements:[Options,Events],options:{onOver:$empty,onSelect:$empty,onSelection:$empty,onShow:$empty,onHide:$empty,onBlur:$empty,onFocus:$empty,minLength:1,markQuery:true,width:'inherit',maxChoices:10,injectChoice:null,customChoices:null,emptyChoices:null,visibleChoices:true,className:'autocompleter-choices',zIndex:42,delay:400,observerOptions:{},fxOptions:{},autoSubmit:false,overflow:false,overflowMargin:25,selectFirst:false,filter:null,filterCase:false,filterSubset:false,forceSelect:false,selectMode:true,choicesMatch:null,multiple:false,separator:', ',separatorSplit:/\s*[,;]\s*/,autoTrim:false,allowDupes:false,cache:true,relative:false},initialize:function(element,options){this.element=$(element);this.setOptions(options);this.build();this.observer=new Observer(this.element,this.prefetch.bind(this),$merge({'delay':this.options.delay},this.options.observerOptions));this.queryValue=null;if(this.options.filter)this.filter=this.options.filter.bind(this);var mode=this.options.selectMode;this.typeAhead=(mode=='type-ahead');this.selectMode=(mode===true)?'selection':mode;this.cached=[];},build:function(){if($(this.options.customChoices)){this.choices=this.options.customChoices;}else{this.choices=new Element('ul',{'class':this.options.className,'styles':{'zIndex':this.options.zIndex}}).inject(document.body);this.relative=false;if(this.options.relative){this.choices.inject(this.element,'after');this.relative=this.element.getOffsetParent();}
this.fix=new OverlayFix(this.choices);}
if(!this.options.separator.test(this.options.separatorSplit)){this.options.separatorSplit=this.options.separator;}
this.fx=(!this.options.fxOptions)?null:new Fx.Tween(this.choices,$merge({'property':'opacity','link':'cancel','duration':200},this.options.fxOptions)).addEvent('onStart',Chain.prototype.clearChain).set(0);this.element.setProperty('autocomplete','off').addEvent((Browser.Engine.trident||Browser.Engine.webkit)?'keydown':'keypress',this.onCommand.bind(this)).addEvent('click',this.onCommand.bind(this,[false])).addEvent('focus',this.toggleFocus.create({bind:this,arguments:true,delay:100})).addEvent('blur',this.toggleFocus.create({bind:this,arguments:false,delay:100}));},destroy:function(){if(this.fix)this.fix.destroy();this.choices=this.selected=this.choices.destroy();},toggleFocus:function(state){this.focussed=state;if(!state)this.hideChoices(true);this.fireEvent((state)?'onFocus':'onBlur',[this.element]);},onCommand:function(e){if(!e&&this.focussed)return this.prefetch();if(e&&e.key&&!e.shift){switch(e.key){case'enter':if(this.element.value!=this.opted)return true;if(this.selected&&this.visible){this.choiceSelect(this.selected);return!!(this.options.autoSubmit);}
break;case'up':case'down':if(!this.prefetch()&&this.queryValue!==null){var up=(e.key=='up');this.choiceOver((this.selected||this.choices)[(this.selected)?((up)?'getPrevious':'getNext'):((up)?'getLast':'getFirst')](this.options.choicesMatch),true);}
return false;case'esc':case'tab':this.hideChoices(true);break;}}
return true;},setSelection:function(finish){var input=this.selected.inputValue,value=input;var start=this.queryValue.length,end=input.length;if(input.substr(0,start).toLowerCase()!=this.queryValue.toLowerCase())start=0;if(this.options.multiple){var split=this.options.separatorSplit;value=this.element.value;start+=this.queryIndex;end+=this.queryIndex;var old=value.substr(this.queryIndex).split(split,1)[0];value=value.substr(0,this.queryIndex)+input+value.substr(this.queryIndex+old.length);if(finish){var tokens=value.split(this.options.separatorSplit).filter(function(entry){return this.test(entry);},/[^\s,]+/);if(!this.options.allowDupes)tokens=[].combine(tokens);var sep=this.options.separator;value=tokens.join(sep)+sep;end=value.length;}}
this.observer.setValue(value);this.opted=value;if(finish||this.selectMode=='pick')start=end;this.element.selectRange(start,end);this.fireEvent('onSelection',[this.element,this.selected,value,input]);},showChoices:function(){var match=this.options.choicesMatch,first=this.choices.getFirst(match);this.selected=this.selectedValue=null;if(this.fix){var pos=this.element.getCoordinates(this.relative),width=this.options.width||'auto';this.choices.setStyles({'left':pos.left,'top':pos.bottom,'width':(width===true||width=='inherit')?pos.width:width});}
if(!first)return;if(!this.visible){this.visible=true;this.choices.setStyle('display','');if(this.fx)this.fx.start(1);this.fireEvent('onShow',[this.element,this.choices]);}
if(this.options.selectFirst||this.typeAhead||first.inputValue==this.queryValue)this.choiceOver(first,this.typeAhead);var items=this.choices.getChildren(match),max=this.options.maxChoices;var styles={'overflowY':'hidden','height':''};this.overflown=false;if(items.length>max){var item=items[max-1];styles.overflowY='scroll';styles.height=item.getCoordinates(this.choices).bottom;this.overflown=true;};this.choices.setStyles(styles);this.fix.show();if(this.options.visibleChoices){var scroll=document.getScroll(),size=document.getSize(),coords=this.choices.getCoordinates();if(coords.right>scroll.x+size.x)scroll.x=coords.right-size.x;if(coords.bottom>scroll.y+size.y)scroll.y=coords.bottom-size.y;window.scrollTo(Math.min(scroll.x,coords.left),Math.min(scroll.y,coords.top));}},hideChoices:function(clear){if(clear){var value=this.element.value;if(this.options.forceSelect)value=this.opted;if(this.options.autoTrim){value=value.split(this.options.separatorSplit).filter($arguments(0)).join(this.options.separator);}
this.observer.setValue(value);}
if(!this.visible)return;this.visible=false;if(this.selected)this.selected.removeClass('autocompleter-selected');this.observer.clear();var hide=function(){this.choices.setStyle('display','none');this.fix.hide();}.bind(this);if(this.fx)this.fx.start(0).chain(hide);else hide();this.fireEvent('onHide',[this.element,this.choices]);},prefetch:function(){var value=this.element.value,query=value;if(this.options.multiple){var split=this.options.separatorSplit;var values=value.split(split);var index=this.element.getSelectedRange().start;var toIndex=value.substr(0,index).split(split);var last=toIndex.length-1;index-=toIndex[last].length;query=values[last];}
if(query.length<this.options.minLength){this.hideChoices();}else{if(query===this.queryValue||(this.visible&&query==this.selectedValue)){if(this.visible)return false;this.showChoices();}else{this.queryValue=query;this.queryIndex=index;if(!this.fetchCached())this.query();}}
return true;},fetchCached:function(){return false;if(!this.options.cache||!this.cached||!this.cached.length||this.cached.length>=this.options.maxChoices||this.queryValue)return false;this.update(this.filter(this.cached));return true;},update:function(tokens){this.choices.empty();this.cached=tokens;var type=tokens&&$type(tokens);if(!type||(type=='array'&&!tokens.length)||(type=='hash'&&!tokens.getLength())){(this.options.emptyChoices||this.hideChoices).call(this);}else{if(this.options.maxChoices<tokens.length&&!this.options.overflow)tokens.length=this.options.maxChoices;tokens.each(this.options.injectChoice||function(token){var choice=new Element('li',{'html':this.markQueryValue(token)});choice.inputValue=token;this.addChoiceEvents(choice).inject(this.choices);},this);this.showChoices();}},choiceOver:function(choice,selection){if(!choice||choice==this.selected)return;if(this.selected)this.selected.removeClass('autocompleter-selected');this.selected=choice.addClass('autocompleter-selected');this.fireEvent('onSelect',[this.element,this.selected,selection]);if(!this.selectMode)this.opted=this.element.value;if(!selection)return;this.selectedValue=this.selected.inputValue;if(this.overflown){var coords=this.selected.getCoordinates(this.choices),margin=this.options.overflowMargin,top=this.choices.scrollTop,height=this.choices.offsetHeight,bottom=top+height;if(coords.top-margin<top&&top)this.choices.scrollTop=Math.max(coords.top-margin,0);else if(coords.bottom+margin>bottom)this.choices.scrollTop=Math.min(coords.bottom-height+margin,bottom);}
if(this.selectMode)this.setSelection();},choiceSelect:function(choice){if(choice)this.choiceOver(choice);this.setSelection(true);this.queryValue=false;this.hideChoices();},filter:function(tokens){return(tokens||this.tokens).filter(function(token){return this.test(token);},new RegExp(((this.options.filterSubset)?'':'^')+this.queryValue.escapeRegExp(),(this.options.filterCase)?'':'i'));},markQueryValue:function(str){return(!this.options.markQuery||!this.queryValue)?str:str.replace(new RegExp('('+((this.options.filterSubset)?'':'^')+this.queryValue.escapeRegExp()+')',(this.options.filterCase)?'':'i'),'<span class="autocompleter-queried">$1</span>');},addChoiceEvents:function(el){return el.addEvents({'mouseover':this.choiceOver.bind(this,[el]),'click':this.choiceSelect.bind(this,[el])});}});var OverlayFix=new Class({initialize:function(el){if(Browser.Engine.trident){this.element=$(el);this.relative=this.element.getOffsetParent();this.fix=new Element('iframe',{'frameborder':'0','scrolling':'no','src':'javascript:false;','styles':{'position':'absolute','border':'none','display':'none','filter':'progid:DXImageTransform.Microsoft.Alpha(opacity=0)'}}).inject(this.element,'after');}},show:function(){if(this.fix){var coords=this.element.getCoordinates(this.relative);delete coords.right;delete coords.bottom;this.fix.setStyles($extend(coords,{'display':'','zIndex':(this.element.getStyle('zIndex')||1)-1}));}
return this;},hide:function(){if(this.fix)this.fix.setStyle('display','none');return this;},destroy:function(){if(this.fix)this.fix=this.fix.destroy();}});Element.implement({getSelectedRange:function(){if(!Browser.Engine.trident)return{start:this.selectionStart,end:this.selectionEnd};var pos={start:0,end:0};var range=this.getDocument().selection.createRange();if(!range||range.parentElement()!=this)return pos;var dup=range.duplicate();if(this.type=='text'){pos.start=0-dup.moveStart('character',-100000);pos.end=pos.start+range.text.length;}else{var value=this.value;var offset=value.length-value.match(/[\n\r]*$/)[0].length;dup.moveToElementText(this);dup.setEndPoint('StartToEnd',range);pos.end=offset-dup.text.length;dup.setEndPoint('StartToStart',range);pos.start=offset-dup.text.length;}
return pos;},selectRange:function(start,end){if(Browser.Engine.trident){var diff=this.value.substr(start,end-start).replace(/\r/g,'').length;start=this.value.substr(0,start).replace(/\r/g,'').length;var range=this.createTextRange();range.collapse(true);range.moveEnd('character',start+diff);range.moveStart('character',start);range.select();}else{this.focus();this.setSelectionRange(start,end);}
return this;}});Autocompleter.Base=Autocompleter;
Autocompleter.Request=new Class({Extends:Autocompleter,options:{postData:{},ajaxOptions:{},postVar:'value'},query:function(){var data=$unlink(this.options.postData)||{};data[this.options.postVar]=this.queryValue;var indicator=$(this.options.indicator);if(indicator)indicator.setStyle('display','');var cls=this.options.indicatorClass;if(cls)this.element.addClass(cls);this.fireEvent('onRequest',[this.element,this.request,data,this.queryValue]);this.request.send({'data':data});},queryResponse:function(){var indicator=$(this.options.indicator);if(indicator)indicator.setStyle('display','none');var cls=this.options.indicatorClass;if(cls)this.element.removeClass(cls);return this.fireEvent('onComplete',[this.element,this.request]);}});Autocompleter.Request.JSON=new Class({Extends:Autocompleter.Request,initialize:function(el,url,options){this.parent(el,options);this.request=new Request.JSON($merge({'url':url,'link':'cancel'},this.options.ajaxOptions)).addEvent('onComplete',this.queryResponse.bind(this));},queryResponse:function(response){this.parent();this.update(response);}});Autocompleter.Request.HTML=new Class({Extends:Autocompleter.Request,initialize:function(el,url,options){this.parent(el,options);this.request=new Request.HTML($merge({'url':url,'link':'cancel','update':this.choices},this.options.ajaxOptions)).addEvent('onComplete',this.queryResponse.bind(this));},queryResponse:function(tree,elements){this.parent();if(!elements||!elements.length){this.hideChoices();}else{this.choices.getChildren(this.options.choicesMatch).each(this.options.injectChoice||function(choice){var value=choice.innerHTML;choice.inputValue=value;this.addChoiceEvents(choice.set('html',this.markQueryValue(value)));},this);this.showChoices();}}});Autocompleter.Ajax={Base:Autocompleter.Request,Json:Autocompleter.Request.JSON,Xhtml:Autocompleter.Request.HTML};
Autocompleter.Local=new Class({Extends:Autocompleter,options:{minLength:0,delay:200},initialize:function(element,tokens,options){this.parent(element,options);this.tokens=tokens;},query:function(){this.update(this.filter());}});
LatLon.distHaversine=function(lat1,lon1,lat2,lon2){var R=6371;var dLat=(lat2-lat1).toRad();var dLon=(lon2-lon1).toRad();lat1=lat1.toRad();lat2=lat2.toRad();var a=Math.sin(dLat/2)*Math.sin(dLat/2)+
Math.cos(lat1)*Math.cos(lat2)*Math.sin(dLon/2)*Math.sin(dLon/2);var c=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));var d=R*c;return d;}
LatLon.distCosineLaw=function(lat1,lon1,lat2,lon2){var R=6371;var d=Math.acos(Math.sin(lat1.toRad())*Math.sin(lat2.toRad())+
Math.cos(lat1.toRad())*Math.cos(lat2.toRad())*Math.cos((lon2-lon1).toRad()))*R;return d;}
LatLon.bearing=function(lat1,lon1,lat2,lon2){lat1=lat1.toRad();lat2=lat2.toRad();var dLon=(lon2-lon1).toRad();var y=Math.sin(dLon)*Math.cos(lat2);var x=Math.cos(lat1)*Math.sin(lat2)-
Math.sin(lat1)*Math.cos(lat2)*Math.cos(dLon);return Math.atan2(y,x).toBrng();}
LatLon.prototype.destPoint=function(brng,d){var R=6371;var lat1=this.lat.toRad(),lon1=this.lon.toRad();brng=brng.toRad();var lat2=Math.asin(Math.sin(lat1)*Math.cos(d/R)+
Math.cos(lat1)*Math.sin(d/R)*Math.cos(brng));var lon2=lon1+Math.atan2(Math.sin(brng)*Math.sin(d/R)*Math.cos(lat1),Math.cos(d/R)-Math.sin(lat1)*Math.sin(lat2));lon2=(lon2+Math.PI)%(2*Math.PI)-Math.PI;if(isNaN(lat2)||isNaN(lon2))return null;return new LatLon(lat2.toDeg(),lon2.toDeg());}
function LatLon(lat,lon){this.lat=lat;this.lon=lon;}
LatLon.prototype.toString=function(){return this.lat.toLat()+', '+this.lon.toLon();}
String.prototype.parseDeg=function(){if(!isNaN(this))return Number(this);var degLL=this.replace(/^-/,'').replace(/[NSEW]/i,'');var dms=degLL.split(/[^0-9.]+/);for(var i in dms)if(dms[i]=='')dms.splice(i,1);switch(dms.length){case 3:var deg=dms[0]/1+dms[1]/60+dms[2]/3600;break;case 2:var deg=dms[0]/1+dms[1]/60;break;case 1:if(/[NS]/i.test(this))degLL='0'+degLL;var deg=dms[0].slice(0,3)/1+dms[0].slice(3,5)/60+dms[0].slice(5)/3600;break;default:return NaN;}
if(/^-/.test(this)||/[WS]/i.test(this))deg=-deg;return deg;}
Number.prototype.toRad=function(){return this*Math.PI/180;}
Number.prototype.toDeg=function(){return this*180/Math.PI;}
Number.prototype.toBrng=function(){return(this.toDeg()+360)%360;}
Number.prototype.toDMS=function(){var d=Math.abs(this);d+=1/7200;var deg=Math.floor(d);var min=Math.floor((d-deg)*60);var sec=Math.floor((d-deg-min/60)*3600);if(deg<100)deg='0'+deg;if(deg<10)deg='0'+deg;if(min<10)min='0'+min;if(sec<10)sec='0'+sec;return deg+'\u00B0'+min+'\u2032'+sec+'\u2033';}
Number.prototype.toLat=function(){return this.toDMS().slice(1)+(this<0?'S':'N');}
Number.prototype.toLon=function(){return this.toDMS()+(this>0?'E':'W');}
Number.prototype.toPrecision=function(fig){if(this==0)return 0;var scale=Math.ceil(Math.log(this)*Math.LOG10E);var mult=Math.pow(10,fig-scale);return Math.round(this*mult)/mult;}
var _atd="http://www.addthis.com/",_atr="http://s7.addthis.com/",_euc=encodeURIComponent,_atu="undefined",_ath="",_atc={sec:_atr.indexOf("https")===0,ver:200,enote:"",cwait:500,samp:0.01,vamp:1,addr:-1,addt:1,xfl:!!window.addthis_disable_flash};try{_ath=document.location.hostname;}catch(e){}if(typeof(addthis_conf)===_atu){var addthis_conf={};}for(i in addthis_conf){_atc[i]=addthis_conf[i];}if(typeof(_ate)===_atu){(function(){var ua=navigator.userAgent.toLowerCase(),d=document,w=window,wa=w.addEventListener,we=w.attachEvent,dl=d.location,b={win:/windows/.test(ua),chr:/chrome/.test(ua),saf:(/webkit/.test(ua))&&!(/chrome/.test(ua)),opr:/opera/.test(ua),msi:(/msie/.test(ua))&&(!/opera/.test(ua)),ie6:/msie 6.0/.test(ua)},_8={isBound:false,isReady:false,readyList:[],onReady:function(){if(!_8.isReady){_8.isReady=true;var l=_8.readyList;for(var fn=0;fn<l.length;fn++){l[fn].call(window,[]);}_8.readyList=[];}},addLoad:function(_b){var _c=w.onload;if(typeof w.onload!="function"){w.onload=_b;}else{w.onload=function(){if(_c){_c();}_b();};}},bindReady:function(){if(r.isBound){return;}r.isBound=true;if(d.addEventListener&&!b.opr){d.addEventListener("DOMContentLoaded",r.onReady,false);}if(b.msi&&window==top){(function(){if(r.isReady){return;}try{d.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}r.onReady();})();}if(b.opr){d.addEventListener("DOMContentLoaded",function(){if(r.isReady){return;}for(var i=0;i<d.styleSheets.length;i++){if(d.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}}r.onReady();},false);}if(b.saf){var _e;(function(){if(r.isReady){return;}if(d.readyState!="loaded"&&d.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(_e===undefined){var _10=d.getElementsByTagName("link");for(var i=0;i<_10.length;i++){if(_10[i].getAttribute("rel")=="stylesheet"){_e++;}}var _12=d.getElementsByTagName("style");_e+=_12.length;}if(d.styleSheets.length!=_e){setTimeout(arguments.callee,0);return;}r.onReady();})();}r.addLoad(r.onReady);},append:function(fn,_14){r.bindReady();if(r.isReady){fn.call(window,[]);}else{r.readyList.push(function(){return fn.call(window,[]);});}}},r=_8,_15={rev:"$Rev: 60199 $",ab:"-",bro:b,clck:1,show:1,dl:dl,samp:_atc.samp-Math.random(),vamp:_atc.vamp-Math.random(),scnt:1,seq:1,inst:1,wait:500,tmo:null,cvt:[],svt:[],sttm:new Date().getTime(),max:268435455,pix:"tev",sid:0,sub:typeof(at_sub)!==_atu,uid:null,swf:"http://bin.clearspring.com/at/v/1/button1.swf",evu:"http://e1.clearspring.com/at/",mun:function(s){var mv=291;if(s){for(var i=0;i<s.length;i++){mv=(mv*(s.charCodeAt(i)+i)+3)&1048575;}}return(mv&16777215).toString(32);},off:function(){return Math.floor((new Date().getTime()-_15.sttm)/100).toString(16);},ran:function(){return Math.floor(Math.random()*4294967295).toString(36);},cst:function(c){return"CXNID=2000001.521545608054043907"+(c||2)+"NXC";},img:function(i,c){if(typeof(at_sub)===_atu){new Image().src=_atr+"live/t00/"+i+".gif?"+_15.ran()+"&"+_15.cst(c);}},cuid:function(){return(_15.sttm&_15.max).toString(16)+(Math.floor(Math.random()*_15.max)).toString(16);},ssid:function(){if(_15.sid===0){_15.sid=_15.cuid();}return _15.sid;},sev:function(id,_1d){_15.pix="sev-"+(typeof(id)!=="number"?_euc(id):id);_15.svt.push(id+";"+_15.off());if(_1d===1){_15.xmi(true);}else{_15.sxm(true);}},cev:function(k,v){_15.pix="cev-"+_euc(k);_15.cvt.push(_euc(k)+"="+_euc(v)+";"+_15.off());_15.sxm(true);},sxm:function(b){if(_15.tmo!==null){clearTimeout(_15.tmo);}if(b){_15.tmo=_15.sto("_ate.xmi(false)",_15.wait);}},sto:function(c,t){return setTimeout(c,t);},sta:function(){var a=_15;return"AT-"+(typeof(addthis_pub)!==_atu?_euc(addthis_pub):"unknown")+"/-/"+a.ab+"/"+a.ssid()+"/"+(a.seq++)+(a.uid!==null?"/"+a.uid:"");},xmi:function(_24){var a=_15,h=a.dl?a.dl.hostname:"";if(!a.uid){a.dck("X"+a.cuid());}if(a.cvt.length+a.svt.length>0){a.sxm(false);if(a.seq===1){a.cev("pin",a.inst);}var urp=a.pix+"-"+a.ran()+".png?ev="+_15.sta()+"&se="+a.svt.join(",")+"&ce="+a.cvt.join(","),url=a.evu+urp,atk=a.evu.replace(1,2)+urp;a.cvt=[];a.svt=[];if(_atc.xtr||h.indexOf(".gov")>-1||h.indexOf(".mil")>-1){_atc.xtr=1;return;}if(_24){var d=document,i=d.ce("iframe");i.id="_atf";i.src=url;_15.opp(i.style);d.body.appendChild(i);i=d.getElementById("_atf");}else{(new Image()).src=url;(new Image()).src=atk;}}},loc:function(){try{var l=window.location;return(l.protocol.indexOf("file")===0||l.hostname.indexOf("localhost")!=-1);}catch(e){}return false;},opp:function(st){st.width="1px";st.height="1px";st.position="absolute";st.zIndex=100000;},pub:function(){return typeof(addthis_pub)!==_atu?_euc(addthis_pub):"";},lad:function(x){_15.plo.push(x);},plo:[],jlo:function(){try{var d=document,al=(window.addthis_language||(_15.bro.msi?navigator.userLanguage:navigator.language));if(al&&(al.toLowerCase()).indexOf("en")!==0&&!_15.pll){var o=d.ce("script");o.src=_atr+"static/r05/lang02.js";d.gn("head")[0].appendChild(o);_15.pll=o;}if(!_15.pld){var m=d.ce("script");m.src=_atr+"static/r05/menu16.js";d.gn("head")[0].appendChild(m);_15.pld=m;}}catch(e){}},lod:function(arg){try{var a=_15,hp=0,f=arg===1,dr=d.referer||d.referrer,du=dl?dl.href:null,si=du?du.indexOf("sms_ss"):-1;if(!f){if(a.samp>=0&&!a.sub){a.sev("20");a.cev("plo",Math.round(1/_atc.samp));if(dr){a.cev("pre",dr);hp=1;}}if(si>-1){var sm=du.substr(si),am=sm.indexOf("&");if(am>-1){sm=sm.substr(0,am);}sm=(sm.split("="))[1];if(a.vamp>=0&&!a.sub&&sm.length){a.cev("plv",Math.round(1/_atc.vamp));a.cev("rsc",sm);}}a.img(_atc.ver+"lo","2");}if(a.plo.length>0){a.jlo();}if(_15.samp>=0){try{var z=d.gn("a");if(z){for(var y in z){y=z[y];if(y.toString().indexOf("/bookmark.php")>0&&!y.onmouseover){y.onmouseover=function(){return addthis_open(this,"","","");};y.onmouseout=function(){addthis_close();};}}}}catch(e){}}if(!_atc.xfl&&!(a.loc())&&(f||a.uid===null)&&a.swf){var _3e=function(o,n,v){var c=d.createElement("param");c.name=n;c.value=v;o.appendChild(c);};var o=d.createElement("object");a.opp(o.style);o.id="atff";if(b.msi){o.classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";_3e(o,"movie",a.swf);}else{o.data=a.swf;o.quality="high";o.type="application/x-shockwave-flash";}_3e(o,"wmode","transparent");_3e(o,"allowScriptAccess","always");d.body.insertBefore(o,d.body.firstChild);if(b.msi){o.outerHTML+=" ";}}}catch(e){}},unl:function(){var a=_15;if(a.samp>=0&&!a.sub){a.sev("21",1);a.cev("pun",1/_atc.samp);}return true;},dck:function(c){_15.uid=c;var h=_15.dl?_15.dl.hostname:"";if(h.indexOf(".gov")>-1||h.indexOf(".mil")>-1){_atc.xtr=1;return;}var p=_15.pub(),x="dodpubweb,usarmymedia,usagov,disamil,education,gobiernousa,loc_webservices,massgov,govgab1".split(",");for(i in x){if(p==x[i]){return;}}if(!_atc.xck){document.cookie="_csuid="+c+"; expires=Wed, 04 Oct 2028 03:19:53 GMT; path=/";}},fcl:null,asetup:function(x){var a=_15;try{if(x!==null&&x!==_atu){a.dck(x);}if(a.fcl){a.fcl();}}catch(e){}return x;},ao:function(elt,_4d,_4e,_4f){_15.lad(["open",elt,_4d,_4e,_4f]);_15.jlo();return false;},ac:function(){},as:function(s){_15.lad(["send",s]);_15.jlo();}},a=_15;w._ate=a;w._adr=r;d.ce=d.createElement;d.gn=d.getElementsByTagName;r.bindReady();if(wa){wa("unload",a.unl,false);}else{if(we){we("onunload",a.unl);}else{w.onunload=a.unl;}}r.append(a.lod);if(d.cookie){var ck=d.cookie.split(";");for(var i=0;i<ck.length;i++){var c=ck[i],x=c.indexOf("_csuid=");if(x>=0){_15.uid=c.substring(x+7);}}}try{var l=d.ce("link");l.rel="stylesheet";l.type="text/css";l.href=_atr+"static/r05/widget08.css";l.media="all";d.gn("head")[0].appendChild(l);}catch(e){}})();function addthis_to(s){return addthis_sendto(s);}function addthis_onmouseover(elt,e,_59,_5a,_5b,_5c,_5d){if(_5b){addthis_pub=_5b;}if(_5c){addthis_language=_5c;}addthis_content=_5d||"";return addthis_open(elt,"share",_59,_5a);}function addthis_onmouseout(){addthis_close();}function addthis_open(elt,_5f,_60,_61){return _ate.ao(elt,_5f,_60,_61);}function addthis_close(){_ate.ac();}function addthis_invoke(s,u,t,p){addthis_pub=p||_ate.pub();addthis_url=(u||w.addthis_url);addthis_title=(t||w.addthis_title);var w=window,lu=addthis_url.toLowerCase(),lt=addthis_title.toLowerCase();if(lu===""||lu==="[url]"){addthis_url=location.href;}if(lt===""||lt==="[title]"){addthis_title=document.title;}_ate.as(s);return false;}function addthis_sendto(s){_ate.as(s);return false;}}else{_ate.inst++;}try{if(_atc.ver===120){function x(v,n){return eval("("+v+"=(typeof "+v+" === '"+_atu+"' ? '"+(n||"")+"' : "+v+"))");}var r="atb"+_ate.cuid();document.write("<span id=\""+r+"\"></span>");_ate.lad(["span",r,x("addthis_url",""),x("addthis_title","")]);}if(window.addthis_clickout){_ate.lad(["cout"]);}}catch(e){}
function ordenarResultados(parametro)
{var listitems=jQuery('li.result-list').get();listitems.sort(function(a,b){var compA=jQuery(a).attr(parametro);var compB=jQuery(b).attr(parametro);return(compA<compB)?-1:(compA>compB)?1:0;});jQuery.each(listitems,function(idx,itm){jQuery('#main ul.results').append(itm);});}
function startExtInfoWindow(){function ExtInfoWindow(marker,windowId,html,opt_opts){this.html_=html;this.marker_=marker;this.infoWindowId_=windowId;this.options_=opt_opts==null?{}:opt_opts;this.ajaxUrl_=this.options_.ajaxUrl==null?null:this.options_.ajaxUrl;this.callback_=this.options_.ajaxCallback==null?null:this.options_.ajaxCallback;this.borderSize_=this.options_.beakOffset==null?0:this.options_.beakOffset;this.paddingX_=this.options_.paddingX==null?0+this.borderSize_:this.options_.paddingX+this.borderSize_;this.paddingY_=this.options_.paddingY==null?0+this.borderSize_:this.options_.paddingY+this.borderSize_;this.map_=null;this.container_=document.createElement('div');this.container_.style.position='relative';this.container_.style.display='none';this.contentDiv_=document.createElement('div');this.contentDiv_.id=this.infoWindowId_+'_contents';this.contentDiv_.innerHTML=this.html_;this.contentDiv_.style.display='block';this.contentDiv_.style.visibility='hidden';this.wrapperDiv_=document.createElement('div');};ExtInfoWindow.prototype=new GOverlay();ExtInfoWindow.prototype.initialize=function(map){this.map_=map;this.defaultStyles={containerWidth:this.map_.getSize().width/2,borderSize:1};this.wrapperParts={tl:{t:0,l:0,w:0,h:0,domElement:null},t:{t:0,l:0,w:0,h:0,domElement:null},tr:{t:0,l:0,w:0,h:0,domElement:null},l:{t:0,l:0,w:0,h:0,domElement:null},r:{t:0,l:0,w:0,h:0,domElement:null},bl:{t:0,l:0,w:0,h:0,domElement:null},b:{t:0,l:0,w:0,h:0,domElement:null},br:{t:0,l:0,w:0,h:0,domElement:null},beak:{t:0,l:0,w:0,h:0,domElement:null},close:{t:0,l:0,w:0,h:0,domElement:null}};for(var i in this.wrapperParts){var tempElement=document.createElement('div');tempElement.id=this.infoWindowId_+'_'+i;tempElement.style.visibility='hidden';document.body.appendChild(tempElement);tempElement=document.getElementById(this.infoWindowId_+'_'+i);var tempWrapperPart=eval('this.wrapperParts.'+i);tempWrapperPart.w=parseInt(this.getStyle_(tempElement,'width'));tempWrapperPart.h=parseInt(this.getStyle_(tempElement,'height'));document.body.removeChild(tempElement);}
for(var i in this.wrapperParts){if(i=='close'){this.wrapperDiv_.appendChild(this.contentDiv_);}
var wrapperPartsDiv=null;if(this.wrapperParts[i].domElement==null){wrapperPartsDiv=document.createElement('div');this.wrapperDiv_.appendChild(wrapperPartsDiv);}else{wrapperPartsDiv=this.wrapperParts[i].domElement;}
wrapperPartsDiv.id=this.infoWindowId_+'_'+i;wrapperPartsDiv.style.position='absolute';wrapperPartsDiv.style.width=this.wrapperParts[i].w+'px';wrapperPartsDiv.style.height=this.wrapperParts[i].h+'px';wrapperPartsDiv.style.top=this.wrapperParts[i].t+'px';wrapperPartsDiv.style.left=this.wrapperParts[i].l+'px';this.wrapperParts[i].domElement=wrapperPartsDiv;}
this.map_.getPane(G_MAP_FLOAT_PANE).appendChild(this.container_);this.container_.id=this.infoWindowId_;var containerWidth=this.getStyle_(document.getElementById(this.infoWindowId_),'width');this.container_.style.width=(containerWidth==null?this.defaultStyles.containerWidth:containerWidth);this.map_.getContainer().appendChild(this.contentDiv_);this.contentWidth=this.getDimensions_(this.container_).width;this.contentDiv_.style.width=this.contentWidth+'px';this.contentDiv_.style.position='absolute';this.container_.appendChild(this.wrapperDiv_);GEvent.bindDom(this.container_,'mousedown',this,this.onClick_);GEvent.bindDom(this.container_,'dblclick',this,this.onClick_);GEvent.bindDom(this.container_,'DOMMouseScroll',this,this.onClick_);GEvent.trigger(this.map_,'extinfowindowopen');if(this.ajaxUrl_!=null){this.ajaxRequest_(this.ajaxUrl_);}};ExtInfoWindow.prototype.onClick_=function(e){if(navigator.userAgent.toLowerCase().indexOf('msie')!=-1&&document.all){window.event.cancelBubble=true;window.event.returnValue=false;}else{e.stopPropagation();}};ExtInfoWindow.prototype.remove=function(){if(this.map_.getExtInfoWindow()!=null){GEvent.trigger(this.map_,'extinfowindowbeforeclose');GEvent.clearInstanceListeners(this.container_);if(this.container_.outerHTML){this.container_.outerHTML='';}
if(this.container_.parentNode){this.container_.parentNode.removeChild(this.container_);}
this.container_=null;GEvent.trigger(this.map_,'extinfowindowclose');this.map_.setExtInfoWindow_(null);}};ExtInfoWindow.prototype.copy=function(){return new ExtInfoWindow(this.marker_,this.infoWindowId_,this.html_,this.options_);};ExtInfoWindow.prototype.redraw=function(force){if(!force||this.container_==null)return;var contentHeight=this.contentDiv_.offsetHeight;this.contentDiv_.style.height=contentHeight+'px';this.contentDiv_.style.left=this.wrapperParts.l.w+'px';this.contentDiv_.style.top=this.wrapperParts.tl.h+'px';this.contentDiv_.style.visibility='visible';this.wrapperParts.tl.t=0;this.wrapperParts.tl.l=0;this.wrapperParts.t.l=this.wrapperParts.tl.w;this.wrapperParts.t.w=(this.wrapperParts.l.w+this.contentWidth+this.wrapperParts.r.w)-this.wrapperParts.tl.w-this.wrapperParts.tr.w;this.wrapperParts.t.h=this.wrapperParts.tl.h;this.wrapperParts.tr.l=this.wrapperParts.t.w+this.wrapperParts.tl.w;this.wrapperParts.l.t=this.wrapperParts.tl.h;this.wrapperParts.l.h=contentHeight;this.wrapperParts.r.l=this.contentWidth+this.wrapperParts.l.w;this.wrapperParts.r.t=this.wrapperParts.tr.h;this.wrapperParts.r.h=contentHeight;this.wrapperParts.bl.t=contentHeight+this.wrapperParts.tl.h;this.wrapperParts.b.l=this.wrapperParts.bl.w;this.wrapperParts.b.t=contentHeight+this.wrapperParts.tl.h;this.wrapperParts.b.w=(this.wrapperParts.l.w+this.contentWidth+this.wrapperParts.r.w)-this.wrapperParts.bl.w-this.wrapperParts.br.w;this.wrapperParts.b.h=this.wrapperParts.bl.h;this.wrapperParts.br.l=this.wrapperParts.b.w+this.wrapperParts.bl.w;this.wrapperParts.br.t=contentHeight+this.wrapperParts.tr.h;this.wrapperParts.close.l=this.wrapperParts.tr.l+this.wrapperParts.tr.w-this.wrapperParts.close.w-this.borderSize_;this.wrapperParts.close.t=this.borderSize_;this.wrapperParts.beak.l=this.borderSize_+(this.contentWidth/2)-(this.wrapperParts.beak.w/2);this.wrapperParts.beak.t=this.wrapperParts.bl.t+this.wrapperParts.bl.h-this.borderSize_;for(var i in this.wrapperParts){if(i=='close'){this.wrapperDiv_.insertBefore(this.contentDiv_,this.wrapperParts[i].domElement);}
var wrapperPartsDiv=null;if(this.wrapperParts[i].domElement==null){wrapperPartsDiv=document.createElement('div');this.wrapperDiv_.appendChild(wrapperPartsDiv);}else{wrapperPartsDiv=this.wrapperParts[i].domElement;}
wrapperPartsDiv.id=this.infoWindowId_+'_'+i;wrapperPartsDiv.style.position='absolute';wrapperPartsDiv.style.width=this.wrapperParts[i].w+'px';wrapperPartsDiv.style.height=this.wrapperParts[i].h+'px';wrapperPartsDiv.style.top=this.wrapperParts[i].t+'px';wrapperPartsDiv.style.left=this.wrapperParts[i].l+'px';this.wrapperParts[i].domElement=wrapperPartsDiv;}
var currentMarker=this.marker_;var thisMap=this.map_;GEvent.addDomListener(this.wrapperParts.close.domElement,'click',function(){thisMap.closeExtInfoWindow();});var pixelLocation=this.map_.fromLatLngToDivPixel(this.marker_.getPoint());this.container_.style.position='absolute';var markerIcon=this.marker_.getIcon();this.container_.style.left=(pixelLocation.x
-(this.contentWidth/2)
-markerIcon.iconAnchor.x
+markerIcon.infoWindowAnchor.x)+'px';this.container_.style.top=(pixelLocation.y
-this.wrapperParts.bl.h
-contentHeight
-this.wrapperParts.tl.h
-this.wrapperParts.beak.h
-markerIcon.iconAnchor.y
+markerIcon.infoWindowAnchor.y
+this.borderSize_)+'px';this.container_.style.display='block';if(this.map_.getExtInfoWindow()!=null){this.repositionMap_();}};ExtInfoWindow.prototype.resize=function(){var tempElement=this.contentDiv_.cloneNode(true);tempElement.id=this.infoWindowId_+'_tempContents';tempElement.style.visibility='hidden';tempElement.style.height='auto';document.body.appendChild(tempElement);tempElement=document.getElementById(this.infoWindowId_+'_tempContents');var contentHeight=tempElement.offsetHeight;document.body.removeChild(tempElement);this.contentDiv_.style.height=contentHeight+'px';var contentWidth=this.contentDiv_.offsetWidth;var pixelLocation=this.map_.fromLatLngToDivPixel(this.marker_.getPoint());var oldWindowHeight=this.wrapperParts.t.domElement.offsetHeight+this.wrapperParts.l.domElement.offsetHeight+this.wrapperParts.b.domElement.offsetHeight;var oldWindowPosTop=this.wrapperParts.t.domElement.offsetTop;this.wrapperParts.l.domElement.style.height=contentHeight+'px';this.wrapperParts.r.domElement.style.height=contentHeight+'px';var newPosTop=this.wrapperParts.b.domElement.offsetTop-contentHeight;this.wrapperParts.l.domElement.style.top=newPosTop+'px';this.wrapperParts.r.domElement.style.top=newPosTop+'px';this.contentDiv_.style.top=newPosTop+'px';windowTHeight=parseInt(this.wrapperParts.t.domElement.style.height);newPosTop-=windowTHeight;this.wrapperParts.close.domElement.style.top=newPosTop+this.borderSize_+'px';this.wrapperParts.tl.domElement.style.top=newPosTop+'px';this.wrapperParts.t.domElement.style.top=newPosTop+'px';this.wrapperParts.tr.domElement.style.top=newPosTop+'px';this.repositionMap_();};ExtInfoWindow.prototype.repositionMap_=function(){var mapNE=this.map_.fromLatLngToDivPixel(this.map_.getBounds().getNorthEast());var mapSW=this.map_.fromLatLngToDivPixel(this.map_.getBounds().getSouthWest());var markerPosition=this.map_.fromLatLngToDivPixel(this.marker_.getPoint());var panX=0;var panY=0;var paddingX=this.paddingX_;var paddingY=this.paddingY_;var infoWindowAnchor=this.marker_.getIcon().infoWindowAnchor;var iconAnchor=this.marker_.getIcon().iconAnchor;var windowT=this.wrapperParts.t.domElement;var windowL=this.wrapperParts.l.domElement;var windowB=this.wrapperParts.b.domElement;var windowR=this.wrapperParts.r.domElement;var windowBeak=this.wrapperParts.beak.domElement;var offsetTop=markerPosition.y-(-infoWindowAnchor.y+iconAnchor.y+this.getDimensions_(windowBeak).height+this.getDimensions_(windowB).height+this.getDimensions_(windowL).height+this.getDimensions_(windowT).height+this.paddingY_);if(offsetTop<mapNE.y){panY=mapNE.y-offsetTop;}else{var offsetBottom=markerPosition.y+this.paddingY_;if(offsetBottom>=mapSW.y){panY=-(offsetBottom-mapSW.y);}}
var offsetRight=Math.round(markerPosition.x+this.getDimensions_(this.container_).width/2+this.getDimensions_(windowR).width+this.paddingX_+infoWindowAnchor.x-iconAnchor.x);if(offsetRight>mapNE.x){panX=-(offsetRight-mapNE.x);}else{var offsetLeft=-(Math.round((this.getDimensions_(this.container_).width/2-this.marker_.getIcon().iconSize.width/2)+this.getDimensions_(windowL).width+this.borderSize_+this.paddingX_)-markerPosition.x-infoWindowAnchor.x+iconAnchor.x);if(offsetLeft<mapSW.x){panX=mapSW.x-offsetLeft;}}
if(panX!=0||panY!=0&&this.map_.getExtInfoWindow()!=null){this.map_.panBy(new GSize(panX,panY));}};ExtInfoWindow.prototype.ajaxRequest_=function(url){var thisMap=this.map_;var thisCallback=this.callback_;GDownloadUrl(url,function(response,status){var infoWindow=document.getElementById(thisMap.getExtInfoWindow().infoWindowId_+'_contents');if(response==null||status==-1){infoWindow.innerHTML='<span class="error">ERROR: The Ajax request failed to get HTML content from "'+url+'"</span>';}else{infoWindow.innerHTML=response;}
if(thisCallback!=null){thisCallback();}
thisMap.getExtInfoWindow().resize();GEvent.trigger(thisMap,'extinfowindowupdate');});};ExtInfoWindow.prototype.getDimensions_=function(element){var display=this.getStyle_(element,'display');if(display!='none'&&display!=null){return{width:element.offsetWidth,height:element.offsetHeight};}
var els=element.style;var originalVisibility=els.visibility;var originalPosition=els.position;var originalDisplay=els.display;els.visibility='hidden';els.position='absolute';els.display='block';var originalWidth=element.clientWidth;var originalHeight=element.clientHeight;els.display=originalDisplay;els.position=originalPosition;els.visibility=originalVisibility;return{width:originalWidth,height:originalHeight};};ExtInfoWindow.prototype.getStyle_=function(element,style){var found=false;style=this.camelize_(style);var value=element.style[style];if(!value){if(document.defaultView&&document.defaultView.getComputedStyle){var css=document.defaultView.getComputedStyle(element,null);value=css?css[style]:null;}else if(element.currentStyle){value=element.currentStyle[style];}}
if((value=='auto')&&(style=='width'||style=='height')&&(this.getStyle_(element,'display')!='none')){if(style=='width'){value=element.offsetWidth;}else{value=element.offsetHeight;}}
return(value=='auto')?null:value;};ExtInfoWindow.prototype.camelize_=function(element){var parts=element.split('-'),len=parts.length;if(len==1)return parts[0];var camelized=element.charAt(0)=='-'?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++){camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1);}
return camelized;};GMap.prototype.ExtInfoWindowInstance_=null;GMap.prototype.ClickListener_=null;GMap.prototype.InfoWindowListener_=null;GMarker.prototype.openExtInfoWindow=function(map,cssId,html,opt_opts){if(map==null){throw'Error in GMarker.openExtInfoWindow: map cannot be null';return false;}
if(cssId==null||cssId==''){throw'Error in GMarker.openExtInfoWindow: must specify a cssId';return false;}
map.closeInfoWindow();if(map.getExtInfoWindow()!=null){map.closeExtInfoWindow();}
if(map.getExtInfoWindow()==null){map.setExtInfoWindow_(new ExtInfoWindow(this,cssId,html,opt_opts));if(map.ClickListener_==null){map.ClickListener_=GEvent.addListener(map,'click',function(event){if(!event&&map.getExtInfoWindow()!=null){map.closeExtInfoWindow();}});}
if(map.InfoWindowListener_==null){map.InfoWindowListener_=GEvent.addListener(map,'infowindowopen',function(event){if(map.getExtInfoWindow()!=null){map.closeExtInfoWindow();}});}
map.addOverlay(map.getExtInfoWindow());}};GMarker.prototype.closeExtInfoWindow=function(map){if(map.getExtInfWindow()!=null){map.closeExtInfoWindow();}};GMap2.prototype.getExtInfoWindow=function(){return this.ExtInfoWindowInstance_;};GMap2.prototype.setExtInfoWindow_=function(extInfoWindow){this.ExtInfoWindowInstance_=extInfoWindow;}
GMap2.prototype.closeExtInfoWindow=function(){if(this.getExtInfoWindow()!=null){this.ExtInfoWindowInstance_.remove();}};}
(function($){var map=new Array();$.Watermark={ShowAll:function(){for(var i=0;i<map.length;i++){if(map[i].obj.val()==""){map[i].obj.val(map[i].text);map[i].obj.css("color",map[i].WatermarkColor);}else{map[i].obj.css("color",map[i].DefaultColor);}}},HideAll:function(){for(var i=0;i<map.length;i++){if(map[i].obj.val()==map[i].text)
map[i].obj.val("");}}};$.fn.Watermark=function(text,color){if(!color)
color="#212121";return this.each(function(){var input=$(this);var defaultColor=input.css("color");map[map.length]={text:text,obj:input,DefaultColor:defaultColor,WatermarkColor:color};function clearMessage(){if(input.val()==text)
input.val("");input.css("color",defaultColor);}
function insertMessage(){if(input.val().length==0||input.val()==text){input.val(text);input.css("color",color);}else
input.css("color",defaultColor);}
input.focus(clearMessage);input.blur(insertMessage);input.change(insertMessage);insertMessage();});};})(jQuery);
jQuery.autocomplete=function(input,options){var me=this;var $input=jQuery(input).attr("autocomplete","off");if(options.inputClass)$input.addClass(options.inputClass);var results=document.createElement("div");var $results=jQuery(results);$results.hide().addClass(options.resultsClass).css("position","absolute");if(options.width>0)$results.css("width",options.width);jQuery("body").append(results);input.autocompleter=me;var timeout=null;var prev="";var active=-1;var cache={};var keyb=false;var hasFocus=false;var lastKeyPressCode=null;var httpEnCurso=false;var isMouseOver=false;var isClicked=false;var el;function flushCache(){cache={};cache.data={};cache.length=0;};flushCache();if(options.data!=null){var sFirstChar="",stMatchSets={},row=[];if(typeof options.url!="string")options.cacheLength=1;for(var i=0;i<options.data.length;i++){row=((typeof options.data[i]=="string")?[options.data[i]]:options.data[i]);if(row[0].length>0){sFirstChar=row[0].substring(0,1).toLowerCase();if(!stMatchSets[sFirstChar])stMatchSets[sFirstChar]=[];stMatchSets[sFirstChar].push(row);}}
for(var k in stMatchSets){options.cacheLength++;addToCache(k,stMatchSets[k]);}}
$input.keydown(function(e){lastKeyPressCode=e.keyCode;switch(e.keyCode){case 38:e.preventDefault();moveSelect(-1);break;case 40:e.preventDefault();moveSelect(1);break;case 9:case 13:if(selectCurrent()){$input.get(0).blur();e.preventDefault();}
break;default:active=-1;if(timeout)clearTimeout(timeout);timeout=setTimeout(function(){onChange();},options.delay);break;}}).focus(function(){hasFocus=true;}).blur(function(){hasFocus=false;var v=$input.val();if((lastKeyPressCode==13)||(options.mustMatchOnBlur&&!isMouseOver)){var v=$input.val();if(v!=input.lastSelected){selectItem(null);}}
isMouseOver=false;if(options.onBlur)options.onBlur();hideResults();});hideResultsNow();function onChange(){if(lastKeyPressCode==46||(lastKeyPressCode>8&&lastKeyPressCode<32))return $results.hide();jQuery('#suggestions').hide();var v=$input.val();if(v==prev)return;prev=v;if(v.length>=options.minChars){$input.addClass(options.loadingClass);requestData(v);}else{$input.removeClass(options.loadingClass);$results.hide();}};function moveSelect(step){var lis=jQuery("li",results);if(!lis)return;active+=step;if(active<0){active=0;}else if(active>=lis.size()){active=lis.size()-1;}
lis.removeClass("ac_over");jQuery(lis[active]).addClass("ac_over");};function selectCurrent(){var li=jQuery("li.ac_over",results)[0];if(!li){var $li=jQuery("li",results);if(options.selectOnly){if($li.length==1)li=$li[0];}else if(options.selectFirst){li=$li[0];}}
if(li){selectItem(li);return true;}else{return false;}};function selectItem(li){if(!li){li=document.createElement("li");li.extra=[];li.selectValue="";}
var v=jQuery.trim(li.selectValue?li.selectValue:li.innerHTML);input.lastSelected=v;prev=v;$results.html("");$input.val(v);hideResultsNow();if(options.onItemSelect)setTimeout(function(){options.onItemSelect(li)},1);};function createSelection(start,end){var field=$input.get(0);if(field.createTextRange){var selRange=field.createTextRange();selRange.collapse(true);selRange.moveStart("character",start);selRange.moveEnd("character",end);selRange.select();}else if(field.setSelectionRange){field.setSelectionRange(start,end);}else{if(field.selectionStart){field.selectionStart=start;field.selectionEnd=end;}}
field.focus();};function autoFill(sValue){if(lastKeyPressCode!=8){$input.val($input.val()+sValue.substring(prev.length));createSelection(prev.length,sValue.length);}};function showResults(){var pos=findPos(input);var iWidth=(options.width>0)?options.width:$input.width();$results.css({width:parseInt(iWidth)+"px",top:(pos.y+input.offsetHeight)+"px",left:pos.x+"px"}).show();};function hideResults(){if(timeout)clearTimeout(timeout);timeout=setTimeout(hideResultsNow,200);};function hideResultsNow(){if(timeout)clearTimeout(timeout);$input.removeClass(options.loadingClass);if($results.is(":visible")){$results.hide();}
if(options.mustMatch){var v=$input.val();if(v!=input.lastSelected){selectItem(null);}}
isMouseOver=false;if(options.onHide)setTimeout(function(){options.onHide()},1);};function receiveData(q,data){if(data){$input.removeClass(options.loadingClass);results.innerHTML="";if(data.length==0)return hideResultsNow();if(jQuery.browser.msie){$results.append(document.createElement('iframe'));}
results.appendChild(dataToDom(data));if(options.autoFill&&($input.val().toLowerCase()==q.toLowerCase()))autoFill(data[0][0]);showResults();}else{hideResultsNow();}};function parseData(data){if(!data)return null;var parsed=[];var rows=data.split(options.lineSeparator);for(var i=0;i<rows.length;i++){var row=jQuery.trim(rows[i]);if(row){parsed[parsed.length]=row.split(options.cellSeparator);}}
return parsed;};function dataToDom(data){var ul=document.createElement("ul");var num=data.length;if((options.maxItemsToShow>0)&&(options.maxItemsToShow<num))num=options.maxItemsToShow;for(var i=0;i<num;i++){var row=data[i];if(!row)continue;var li=document.createElement("li");if(options.formatItem){li.innerHTML=options.formatItem(row,i,num);li.selectValue=row[0];}else{li.innerHTML=row[0];li.selectValue=row[0];}
var extra=null;if(row.length>1){extra=[];for(var j=1;j<row.length;j++){extra[extra.length]=row[j];}}
li.extra=extra;ul.appendChild(li);jQuery(li).hover(function(){isMouseOver=true;jQuery("li",ul).removeClass("ac_over");jQuery(this).addClass("ac_over");active=jQuery("li",ul).indexOf(jQuery(this).get(0));},function(){isMouseOver=false
jQuery(this).removeClass("ac_over");}).click(function(e){e.preventDefault();e.stopPropagation();selectItem(this);});}
ul.setAttribute('id','ul-autocomplete-suggestions')
return ul;};function requestData(q){if(!options.matchCase)q=q.toLowerCase();var data=options.cacheLength?loadFromCache(q):null;if(data){receiveData(q,data);}else if((typeof options.url=="string")&&(options.url.length>0)){if(!httpEnCurso){httpEnCurso=true;jQuery.get(makeUrl(q),function(data){data=parseData(data);addToCache(q,data);receiveData(q,data);httpEnCurso=false;showResults();});}else{return;}}else{$input.removeClass(options.loadingClass);}};function makeUrl(q){var letra=q.substr(0,1).toUpperCase();var url=options.url+letra+".txt";return url;};function loadFromCache(q){if(!q)return null;if(cache.data[q])return cache.data[q];if(options.matchSubset){for(var i=q.length-1;i>=options.minChars;i--){var qs=q.substr(0,i);var c=cache.data[qs];if(c){var csub=[];for(var j=0;j<c.length;j++){var x=c[j];var x0=x[0];if(matchSubset(x0,q)){csub[csub.length]=x;}}
return csub;}}}
return null;};function matchSubset(s,sub){if(!options.matchCase)s=s.toLowerCase();var i=s.indexOf(sub);if(i==-1)return false;return i==0||options.matchContains;};this.flushCache=function(){flushCache();};this.setExtraParams=function(p){options.extraParams=p;};this.findValue=function(){var q=$input.val();if(!options.matchCase)q=q.toLowerCase();var data=options.cacheLength?loadFromCache(q):null;if(data){findValueCallback(q,data);}else if((typeof options.url=="string")&&(options.url.length>0)){$input.addClass(options.loadingClass);jQuery.get(makeUrl(q),function(data){data=parseData(data)
addToCache(q,data);findValueCallback(q,data);});}else{findValueCallback(q,null);}}
function findValueCallback(q,data){if(data)$input.removeClass(options.loadingClass);var num=(data)?data.length:0;var li=null;for(var i=0;i<num;i++){var row=data[i];if(row[0].toLowerCase()==q.toLowerCase()){li=document.createElement("li");if(options.formatItem){li.innerHTML=options.formatItem(row,i,num);li.selectValue=row[0];}else{li.innerHTML=row[0];li.selectValue=row[0];}
var extra=null;if(row.length>1){extra=[];for(var j=1;j<row.length;j++){extra[extra.length]=row[j];}}
li.extra=extra;}}
if(options.onFindValue)setTimeout(function(){options.onFindValue(li)},1);}
function addToCache(q,data){if(!data||!q||!options.cacheLength)return;if(!cache.length||cache.length>options.cacheLength){flushCache();cache.length++;}else if(!cache[q]){cache.length++;}
cache.data[q]=data;};function findPos(obj){var curleft=obj.offsetLeft||0;var curtop=obj.offsetTop||0;while(obj=obj.offsetParent){curleft+=obj.offsetLeft
curtop+=obj.offsetTop}
return{x:curleft,y:curtop};}}
jQuery.fn.autocomplete=function(url,options,data){options=options||{};options.url=url;options.data=((typeof data=="object")&&(data.constructor==Array))?data:null;options.inputClass=options.inputClass||"ac_input";options.resultsClass=options.resultsClass||"ac_results";options.lineSeparator=options.lineSeparator||"\n";options.cellSeparator=options.cellSeparator||"|";options.minChars=options.minChars||1;options.delay=options.delay||400;options.matchCase=options.matchCase||0;options.matchSubset=options.matchSubset||1;options.matchContains=options.matchContains||0;options.cacheLength=options.cacheLength||1;options.mustMatch=options.mustMatch||0;options.mustMatchOnBlur=options.mustMatchOnBlur||0;options.extraParams=options.extraParams||{};options.loadingClass=options.loadingClass||"ac_loading";options.selectFirst=options.selectFirst||false;options.selectOnly=options.selectOnly||false;options.maxItemsToShow=options.maxItemsToShow||-1;options.autoFill=options.autoFill||false;options.width=parseInt(options.width,10)||0;this.each(function(){var input=this;new jQuery.autocomplete(input,options);});return this;}
jQuery.fn.autocompleteArray=function(data,options){return this.autocomplete(null,options,data);}
jQuery.fn.indexOf=function(e){for(var i=0;i<this.length;i++){if(this[i]==e)return i;}
return-1;}