Array.prototype.contains=function(c){for(var b=0;b<this.length;b++){if(this[b]==c){return true}}return false};Function.prototype.curry=function(){var c=this,b=Array.prototype.slice.call(arguments);return function(){return c.apply(this,b.concat(Array.prototype.slice.call(arguments)))}};Function.prototype.bind=function(c){var d=this,b=function(){return d.apply(c,arguments)};return b};function getElementsByTagNameAndId(c,d,e){var b=c.getElementsByTagName(d);for(i=0;i<b.length;i++){if(b[i].id==e){return b[i]}}return null}function parseLatLngFromPermalink(d){var e=d.split(";");var c=e[0].substring(e[0].indexOf(":")+1,e[0].length);var b=e[1].substring(e[1].indexOf(":")+1,e[1].length);return new GLatLng(c,b)}function _url(b){return APP_ROOT+b}function clearElement(b){while(b.hasChildNodes()){b.removeChild(b.firstChild)}return b}function logger(){if((typeof(IS_DEBUG_MODE)!="undefined")&&(IS_DEBUG_MODE=="true")){var b=new YAHOO.widget.LogReader("compact",{verboseOutput:false,newestOnTop:false});b.formatMsg=function(d){var c=d.category;return'<p><span class="'+c+'">'+c+"</span> "+d.msg+"</p>"}}}function showGoogleQueryReturnOnlyDebug(d,b){if((typeof(IS_DEBUG_MODE)!="undefined")&&(IS_DEBUG_MODE=="True")){var c;switch(d){case 400:c="G_GEO_BAD_REQUEST";break;case 500:c="G_GEO_SERVER_ERROR";case 601:c="G_GEO_MISSING_QUERY or G_GEO_MISSING_ADDRESS ";break;case 602:c="G_GEO_UNKNOWN_ADDRESS";break;case 603:c="G_GEO_UNAVAILABLE_ADDRESS";break;case 604:c="G_GEO_UNKNOWN_DIRECTIONS";break;case 610:c="G_GEO_BAD_KEY";break;case 620:c="G_GEO_TOO_MANY_QUERIES";break;default:c=""}YAHOO.log(d+" - "+c+" Message: "+b,"error")}}function showPopup(c,d,b){if(typeof(PopupPanel)!="undefined"){$get("popupTitle").innerHTML=d;$get("popupMessage").innerHTML=c;$get("popup").className=b;PopupPanel.show();YAHOO.lang.later(10000,null,function(){PopupPanel.hide()})}else{alert(c)}}function showPopupError(b){showPopup(b,I18n.termoErro,"popupError")}function showPopupSuccess(b){showPopup(b,I18n.termoSucesso,"popupSuccess")}function parseToHoursStr(f,e){var b=(f/1000)/e;var c=(b-Math.floor(b))*60;b=Math.floor(b);var d="";if(b>0){d=b+"h "}d+=Math.floor(c)+"min";return d}function getClientOS(){var b="Unknown OS";if(navigator.appVersion.indexOf("Win")!=-1){b="Windows"}if(navigator.appVersion.indexOf("Mac")!=-1){b="MacOS"}if(navigator.appVersion.indexOf("X11")!=-1){b="UNIX"}if(navigator.appVersion.indexOf("Linux")!=-1){b="Linux"}return b}qs=[];function loadQueryString(){variaveis=location.search.replace(/\x3F/,"").replace(/\x2B/g," ").split("&");if(variaveis!=""){for(i=0;i<variaveis.length;i++){nvar=variaveis[i].split("=");qs[nvar[0]]=decodeURIComponent(nvar[1])}}}function QueryString(b){return qs[b]}function getUrl(){url=window.location.href;var b=url.split("?");url=b[0].replace("comochegar","").replace("paradas","").replace("linhas","").replace("home","");return url}function createCookie(d,e,f){var b="";if(f){var c=new Date();c.setTime(c.getTime()+(f*24*60*60*1000));b="; expires="+c.toGMTString()}document.cookie=d+"="+e+b+"; path=/"}function readCookie(d){var f=d+"=";var b=document.cookie.split(";");for(var e=0;e<b.length;e++){var g=b[e];while(g.charAt(0)==" "){g=g.substring(1,g.length)}if(g.indexOf(f)==0){return g.substring(f.length,g.length)}}return null}function eraseCookie(b){createCookie(b,"",-1)}function toHoursAndMinutes(e){var d=e%60;var b=(e-d)/60;var c="";if(b>0){c+=b+"h "}c+=d+"min";return c}function toKmAndMeters(b){if(b>1000){return(b/1000).toFixed(1).replace(".",",")+"km"}else{return b+"m"}}function bookmark_us(b,d){if(window.sidebar){window.sidebar.addPanel(d,b,"")}else{if(window.opera&&window.print){var c=document.createElement("a");c.setAttribute("href",b);c.setAttribute("title",d);c.setAttribute("rel","sidebar");c.click()}else{if(document.all){window.external.AddFavorite(b,d)}}}}String.prototype.trim=function(){a=this.replace(/^\s+/,"");return a.replace(/\s+$/,"")};String.prototype.format=function(){var c="";var b=this.toString();for(i=0;i<arguments.length;i++){c="{"+(i)+"}";while(b.indexOf(c)>=0){b=b.replace(c,arguments[i])}}return b};function elementInViewport(d){var f=d.offsetTop;var e=d.offsetLeft;var c=d.offsetWidth;var b=d.offsetHeight;while(d.offsetParent){d=d.offsetParent;f+=d.offsetTop;e+=d.offsetLeft}return(f>=window.pageYOffset&&e>=window.pageXOffset&&(f+b)<=(window.pageYOffset+window.innerHeight)&&(e+c)<=(window.pageXOffset+window.innerWidth))}function onFail(b){if((typeof(IS_DEBUG_MODE)!="undefined")&&(IS_DEBUG_MODE=="true")){showPopupError(b.get_message())}else{showPopupError(I18n.termoErroBusca)}if(typeof(WaitDialog)!="undefined"){WaitDialog.hideLoading()}}function onFailOnlyDebug(b){if((typeof(IS_DEBUG_MODE)!="undefined")&&(IS_DEBUG_MODE=="true")){showPopupError(b.get_message())}if(typeof(WaitDialog)!="undefined"){WaitDialog.hideLoading()}}var ENTER_CODE=13;function getKeyCode(b){var c;if(window.event){c=b.keyCode}else{if(b.which){c=b.which}}return c}function onEnterKeyPress(c,b){var d=getKeyCode(b);if(d==ENTER_CODE){c();return false}}function dummy(){}var specificLocationListener=function(){loadQueryString();if(QueryString("specl")=="false"){window.name="speclOFF"}else{if(QueryString("specl")=="true"){window.name=""}}};var roundedCorners=function(){curvyCorners.redraw()};var applyForcedFocus=function(){var b=document.getElementsByTagName("input");for(i=0;i<b.length;i++){if(b[i].type=="text"){YAHOO.util.Event.addListener(b[i],"focus",function(){YAHOO.util.Dom.addClass(this,"forcedFocus")});YAHOO.util.Event.addListener(b[i],"blur",function(){YAHOO.util.Dom.removeClass(this,"forcedFocus")})}}};YAHOO.namespace("omnibus");YAHOO.omnibus.AutocompleteHelper={oDataSource:null,GetAutocompleteAddressDS:function(b){var a="";if(!b||typeof(b)==="undefined"){a=_url("/Webservices/Autocomplete.asmx/GetAddresses")}else{a=b+"/Webservices/Autocomplete.asmx/GetAddresses"}if(this.oDataSource===null){this.oDataSource=new YAHOO.widget.DS_XHR(a);this.oDataSource.responseType=YAHOO.widget.DS_XHR.TYPE_XML;this.oDataSource.responseSchema={resultNode:"Address",fields:["Street","District","City","AdditionalInfo","Latitude","Longitude"]}}return this.oDataSource},formatResult:function(e,h,d){var c=e.Street;var g=e.District;var b=e.City;var a=e.AdditionalInfo;var f="<strong>"+c+"</strong>";if(b!==""){f+='<br/><span class="autocompleteDistrict">'+g.trim()+", "+b.trim()+"</span>"}else{f+='<br/><span class="autocompleteDistrict">'+a.trim()+"</span>"}return(f)},formatAddress:function(b){var a=b.Street.trim();if(b.District!==""){a+=", "+b.District.trim()}if(b.City!==""){a+=", "+b.City.trim()}return a}};