function TrackLLEvent(n,t,i,r){var r=r||!0,u;r&&(u=new EventModel(n,i,t),ll("tagEvent",u.Adj+" "+u.Noun,u.Attr))}function locationHashChanged(){window.location.hash&&window.location.hash!=="#"&&$("html, body").stop().animate({scrollTop:$(window.location.hash).offset().top-($(".navbar").first().outerHeight()-parseInt($(window.location.hash).css("margin-top")))},900,"swing")}function StationRating(){this.init=function(){$(".station-rating-badge").each(function(n,t){$(t).starRating&&$(t).children(".star-rating").starRating({readOnly:!0,starSize:15,initialRating:$(t).children(".star-rating").attr("star-value")})})};this.refresh=function(){this.init()}}var GasBuddy,ratings;typeof String.prototype.trim!="function"&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});GasBuddy={};GasBuddy.Token=GasBuddy.prototype={get:function(){return $('[name="__RequestVerificationToken"]').val()},generateHeader:function(){var n=this.get();return{__RequestVerificationToken:n}}};GasBuddy.User=GasBuddy.prototype={fuelId:null,updateFuel:function(n,t){GasBuddy.User.FuelId=n;var i=JSON.stringify({fuelId:parseInt(n)});$.ajax({type:"POST",url:"/User/Fuel",data:i,datatype:"json",contentType:"application/json; charset=utf-8",headers:GasBuddy.Token.generateHeader(),success:function(){t()},error:function(){GasBuddy.User.FuelId=1}})},getFuel:function(){return $.ajax({type:"GET",url:"/User/Fuel",datatype:"json",contentType:"application/json; charset=utf-8",headers:GasBuddy.Token.generateHeader(),success:function(n){GasBuddy.User.FuelId=n.fuelId},error:function(){GasBuddy.User.FuelId=1}}),GasBuddy.User.FuelId},getSortType:function(){return parseInt(GasBuddy.Cookie.GetCookie("SortType"))||0},updateSortType:function(n){GasBuddy.Cookie.SetCookie("SortType",n)}};GasBuddy.Stations=GasBuddy.prototype={addCurrentPrice:function(n){console.log({addCurrentPrice:n});for(var t=0;t<n.stations.length;t++)n.stations[t].currentPrice=GasBuddy.Stations.Price.getLowestByFuelId({fuels:n.stations[t].Fuels,fuelId:n.fuelId,country:n.stations[t].Country}),console.log(n.stations[t].currentPrice.Time),console.log(new Date(n.stations[t].currentPrice.Time.match(/\d+/)[0]*1).toUTCString()),console.log(new Date(n.serverTime.match(/\d+/)[0]*1)),console.log({"o.stations[x].currentPrice":n.stations[t].currentPrice})}};GasBuddy.Stations.Fuel=GasBuddy.prototype={getById:function(n){var t=[];for(x=0;x<n.fuels.length;x++)if(n.fuels[x].Id==n.fuelId)for(y=0;y<n.fuels[x].Prices.length;y++)t.push(n.fuels[x].Prices[y]);return t}};GasBuddy.Stations.Price=GasBuddy.prototype={getLowestByFuelId:function(n){var f=9999,t=null,u=0,i=0,r=GasBuddy.Stations.Fuel.getById({fuels:n.fuels,fuelId:n.fuelId});if(r==null)return{Amount:"---",CarIcon:"",Comment:"",FuelId:n.fuelId,Id:1,MaxPrice:0,MinValidPrice:0,SmId:0,Time:new Date};for(i=0;i<r.length;i++)u=r[i].Amount,u<f&&u>0&&(f=u,t=r[i][i]);return t==null&&n.fuels.length>0&&(t=r[0]),typeof n.country!="undefined"&&(t.Amount=GasBuddy.Format.Price.ByCountry({price:t.Amount,country:n.country})),t}};GasBuddy.Cookie=GasBuddy.prototype={GetCookie:function(n){for(var t,r=document.cookie.split(";"),i=0;i<r.length;i++){for(t=r[i];t.charAt(0)===" ";)t=t.substring(1);if(t.indexOf(n+"=")===0)return t.substring(n.length+1,t.length)}return""},SetCookie:function(n,t,i){document.cookie=n+"="+t+(i?";expires="+i.toString():"")}};GasBuddy.Cookie.MobileSite=GasBuddy.prototype={CookieName:"PreferMobileSite",IsPreferred:function(){return GasBuddy.Cookie.GetCookie(GasBuddy.Cookie.MobileSite.CookieName)},SetPreferred:function(n){GasBuddy.Cookie.SetCookie(GasBuddy.Cookie.MobileSite.CookieName,n)}};GasBuddy.Cookie.LegacySite=GasBuddy.prototype={CookieName:"PreferLegacySite",IsPreferred:function(){return GasBuddy.Cookie.GetCookie(GasBuddy.Cookie.LegacySite.CookieName)},SetPreferred:function(n){GasBuddy.Cookie.SetCookie(GasBuddy.Cookie.LegacySite.CookieName,n)}};GasBuddy.Format=GasBuddy.prototype={};GasBuddy.Format.Number=GasBuddy.prototype={Thousands:function(n){return n.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")}};GasBuddy.Format.Price=GasBuddy.prototype={defaultPrice:"--",ByCountry:function(n){if(typeof n.price=="undefined")return this.defaultPrice;if(typeof n.price=="string")return n.price;if(n.price==0||n.price==9999)return this.defaultPrice;switch(n.country){case"CAN":return n.price.toFixed(1);default:return n.price.toFixed(2)}}};GasBuddy.Enums=GasBuddy.prototype={};GasBuddy.Enums.SortType=GasBuddy.prototype={CLOSEST:0,TOP_TIER:1};var ClickModel=function(n,t){var i=$(n).is(":only-child");this.ID=n.id||"NotSpecified";this.Description=(n.id.replace(/-/g," ")+" "+(t.toLowerCase()||"")).trim();this.Type=i?"Simple":t||"Unknown";this.CTA_Name=i?n.text:$(n).children("img:only-child").attr("src");this.CTA_Link=n.href},StationSearchModel=function(n){this.Search_Term=n;this.Fuel_Type=GasBuddy.Cookie.GetCookie("PreferredFuelType");this.ToLL=function(){var n={};for(var t in this)n[t.replace(/_/g," ")]=this[t];return n}},EventModel=function(n,t,i){n&&(this.Noun=n,this.Adj=i||"Viewed",this.Attr=typeof t=="object"?t:{Context:n})};$(function(){$(".AppDownload").click(function(n){var t=n.currentTarget;ll("tagEvent","Clicked Link",new ClickModel(t,"Button"))});$("a:not(.AppDownload) > img:only-child").parent().click(function(n){var t=n.currentTarget;ll("tagEvent","Clicked Link",new ClickModel(t,"Button"))});$("a:only-child:not([href='javascript:void(0)'],[href='#'])").click(function(n){var t=n.currentTarget;ll("tagEvent","Clicked Link",new ClickModel(t,"Simple"))})});$(function(){function n(n){var r=null,u=null,f=$(n),t=$(".dropdown-menu",n),i=f.parents("ul.nav");return i.size()>0&&(r=i.data("dropdown-in")||null,u=i.data("dropdown-out")||null),{target:n,dropdown:f,dropdownMenu:t,effectIn:t.data("dropdown-in")||r,effectOut:t.data("dropdown-out")||u}}function t(n,t){t&&(n.dropdown.addClass("dropdown-animating"),n.dropdownMenu.addClass("animated"),n.dropdownMenu.addClass(t))}function i(n,t){n.dropdown.one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){n.dropdown.removeClass("dropdown-animating");n.dropdownMenu.removeClass("animated");n.dropdownMenu.removeClass(n.effectIn);n.dropdownMenu.removeClass(n.effectOut);typeof t=="function"&&t()})}var r=$(".dropdown, .dropup");r.on({"show.bs.dropdown":function(){var i=n(this);t(i,i.effectIn)},"shown.bs.dropdown":function(){var t=n(this);t.effectIn&&t.effectOut&&i(t,function(){})},"hide.bs.dropdown":function(r){var u=n(this);u.effectOut&&(r.preventDefault(),t(u,u.effectOut),i(u,function(){u.dropdown.removeClass("open")}))}})});"onhashchange"in window||console.log("This browser does not supports the hashchange event.");$(function(){window.onhashchange=locationHashChanged;locationHashChanged()});!function(n){"use strict";var t="starRating",i=function(){},r={totalStars:5,useFullStars:!1,starShape:"straight",emptyColor:"#d1d3d5",hoverColor:"orange",activeColor:"#f6cc1c",useGradient:!1,readOnly:!1,disableAfterRate:!0,baseUrl:!1,starGradient:{start:"#FEF7CD",end:"#FF9511"},strokeWidth:4,strokeColor:"black",initialRating:0,starSize:40,callback:i,onHover:i,onLeave:i},u=function(i,u){var f;this.element=i;this.$el=n(i);this.settings=n.extend({},r,u);f=this.$el.data("rating")||this.settings.initialRating;this._state={rating:(Math.round(2*f)/2).toFixed(1)};this._uid=Math.floor(999*Math.random());u.starGradient||this.settings.useGradient||(this.settings.starGradient.start=this.settings.starGradient.end=this.settings.activeColor);this._defaults=r;this._name=t;this.init()},e={init:function(){this.renderMarkup();this.addListeners();this.initRating()},addListeners:function(){this.settings.readOnly||(this.$stars.on("mouseover",this.hoverRating.bind(this)),this.$stars.on("mouseout",this.restoreState.bind(this)),this.$stars.on("click",this.handleRating.bind(this)))},hoverRating:function(n){var t=this.getIndex(n);this.paintStars(t,"hovered");this.settings.onHover(t+1,this._state.rating,this.$el)},handleRating:function(n){var i=this.getIndex(n),t=i+1;this.applyRating(t,this.$el);this.executeCallback(t,this.$el);this.settings.disableAfterRate&&this.$stars.off()},applyRating:function(n){var t=n-1;this.paintStars(t,"active");this._state.rating=t+1},restoreState:function(n){var t=this.getIndex(n),i=this._state.rating||-1;this.paintStars(i-1,"active");this.settings.onLeave(t+1,this._state.rating,this.$el)},getIndex:function(t){var r=n(t.currentTarget),f=r.width(),i=n(t.target).attr("data-side"),u;return i=i?i:this.getOffsetByPixel(t,r,f),i=this.settings.useFullStars?"right":i,u=r.index()-("left"===i?.5:0),.5>u&&t.offsetX<f/4?-1:u},getOffsetByPixel:function(n,t,i){var r=n.pageX-t.offset().left;return i/2>=r&&!this.settings.useFullStars?"left":"right"},initRating:function(){this.paintStars(this._state.rating-1,"active")},paintStars:function(t,i){var u,f,r,e;n.each(this.$stars,function(o,s){u=n(s).find('[data-side="left"]');f=n(s).find('[data-side="right"]');r=e=t>=o?i:"empty";r=o-t==.5?i:r;u.attr("class","svg-"+r+"-"+this._uid);f.attr("class","svg-"+e+"-"+this._uid)}.bind(this))},renderMarkup:function(){for(var n=this.settings,t=n.baseUrl?location.href.split("#")[0]:"",u='<div class="jq-star" style="width:'+n.starSize+"px;  height:"+n.starSize+'px;"><svg version="1.0" class="jq-star-svg" shape-rendering="geometricPrecision" xmlns="http://www.w3.org/2000/svg" '+this.getSvgDimensions(n.starShape)+" stroke-width:"+n.strokeWidth+'px;" xml:space="preserve"><style type="text/css">.svg-empty-'+this._uid+"{fill:url("+t+"#"+this._uid+"_SVGID_1_);}.svg-hovered-"+this._uid+"{fill:url("+t+"#"+this._uid+"_SVGID_2_);}.svg-active-"+this._uid+"{fill:url("+t+"#"+this._uid+"_SVGID_3_);}<\/style>"+this.getLinearGradient(this._uid+"_SVGID_1_",n.emptyColor,n.emptyColor,n.starShape)+this.getLinearGradient(this._uid+"_SVGID_2_",n.hoverColor,n.hoverColor,n.starShape)+this.getLinearGradient(this._uid+"_SVGID_3_",n.starGradient.start,n.starGradient.end,n.starShape)+this.getVectorPath(this._uid,{starShape:n.starShape,strokeWidth:n.strokeWidth,strokeColor:n.strokeColor})+"<\/svg><\/div>",i="",r=0;r<n.totalStars;r++)i+=u;this.$el.append(i);this.$stars=this.$el.find(".jq-star")},getVectorPath:function(n,t){return"rounded"===t.starShape?this.getRoundedVectorPath(n,t):this.getSpikeVectorPath(n,t)},getSpikeVectorPath:function(n,t){return'<polygon data-side="center" class="svg-empty-'+n+'" points="281.1,129.8 364,55.7 255.5,46.8 214,-59 172.5,46.8 64,55.4 146.8,129.7 121.1,241 212.9,181.1 213.9,181 306.5,241 " style="fill: transparent; stroke: '+t.strokeColor+';" /><polygon data-side="left" class="svg-empty-'+n+'" points="281.1,129.8 364,55.7 255.5,46.8 214,-59 172.5,46.8 64,55.4 146.8,129.7 121.1,241 213.9,181.1 213.9,181 306.5,241 " style="stroke-opacity: 0;" /><polygon data-side="right" class="svg-empty-'+n+'" points="364,55.7 255.5,46.8 214,-59 213.9,181 306.5,241 281.1,129.8 " style="stroke-opacity: 0;" />'},getRoundedVectorPath:function(n,t){var i="M520.9,336.5c-3.8-11.8-14.2-20.5-26.5-22.2l-140.9-20.5l-63-127.7 c-5.5-11.2-16.8-18.2-29.3-18.2c-12.5,0-23.8,7-29.3,18.2l-63,127.7L28,314.2C15.7,316,5.4,324.7,1.6,336.5S1,361.3,9.9,370 l102,99.4l-24,140.3c-2.1,12.3,2.9,24.6,13,32c5.7,4.2,12.4,6.2,19.2,6.2c5.2,0,10.5-1.2,15.2-3.8l126-66.3l126,66.2 c4.8,2.6,10,3.8,15.2,3.8c6.8,0,13.5-2.1,19.2-6.2c10.1-7.3,15.1-19.7,13-32l-24-140.3l102-99.4 C521.6,361.3,524.8,348.3,520.9,336.5z";return'<path data-side="center" class="svg-empty-'+n+'" d="'+i+'" style="stroke: '+t.strokeColor+'; fill: transparent; " /><path data-side="right" class="svg-empty-'+n+'" d="'+i+'" style="stroke-opacity: 0;" /><path data-side="left" class="svg-empty-'+n+'" d="M121,648c-7.3,0-14.1-2.2-19.8-6.4c-10.4-7.6-15.6-20.3-13.4-33l24-139.9l-101.6-99 c-9.1-8.9-12.4-22.4-8.6-34.5c3.9-12.1,14.6-21.1,27.2-23l140.4-20.4L232,164.6c5.7-11.6,17.3-18.8,30.2-16.8c0.6,0,1,0.4,1,1 v430.1c0,0.4-0.2,0.7-0.5,0.9l-126,66.3C132,646.6,126.6,648,121,648z" style="stroke: '+t.strokeColor+'; stroke-opacity: 0;" />'},getSvgDimensions:function(n){return"rounded"===n?'width="550px" height="500.2px" viewBox="0 146.8 550 500.2" style="enable-background:new 0 0 550 500.2;':'x="0px" y="0px" width="305px" height="305px" viewBox="60 -62 309 309" style="enable-background:new 64 -59 305 305;'},getLinearGradient:function(n,t,i,r){var u="rounded"===r?500:250;return'<linearGradient id="'+n+'" gradientUnits="userSpaceOnUse" x1="0" y1="-50" x2="0" y2="'+u+'"><stop  offset="0" style="stop-color:'+t+'"/><stop  offset="1" style="stop-color:'+i+'"/> <\/linearGradient>'},executeCallback:function(n,t){var i=this.settings.callback;i(n,t)}},f={unload:function(){var i="plugin_"+t,r=n(this),u=r.data(i).$stars;u.off();r.removeData(i).remove()},setRating:function(i,r){var f="plugin_"+t,e=n(this),u=e.data(f);i>u.settings.totalStars||0>i||(r&&(i=Math.round(i)),u.applyRating(i))},getRating:function(){var i="plugin_"+t,r=n(this),u=r.data(i);return u._state.rating},resize:function(i){var u="plugin_"+t,f=n(this),e=f.data(u),r=e.$stars;return 1>=i||i>200?void console.log("star size out of bounds"):(r=Array.prototype.slice.call(r),void r.forEach(function(t){n(t).css({width:i+"px",height:i+"px"})}))},setReadOnly:function(i){var u="plugin_"+t,f=n(this),r=f.data(u);i===!0?r.$stars.off("mouseover mouseout click"):(r.settings.readOnly=!1,r.addListeners())}};n.extend(u.prototype,e);n.fn[t]=function(i){if(!n.isPlainObject(i)){if(f.hasOwnProperty(i))return f[i].apply(this,Array.prototype.slice.call(arguments,1));n.error("Method "+i+" does not exist on "+t+".js")}return this.each(function(){n.data(this,"plugin_"+t)||n.data(this,"plugin_"+t,new u(this,i))})}}(jQuery,window,document);ratings=new StationRating;ratings.init()