function drawToAwardDetailsCanvas(n,t){var u,f="#0097A9",i,r;u=document.getElementById("AwardDetails_canvas");u.getContext&&(i=u.getContext("2d"),i.strokeStyle=f,i.fillStyle=f,i.beginPath(),i.arc(100,100,92,0,Math.PI*2,!0),i.closePath(),i.stroke(),i.fill(),r=new Image,r.onload=function(){i.drawImage(r,20,20,160,160)},r.src=buildLargeAwardImagePath(n,t))}function buildLargeAwardImagePath(n,t){strBuffer=[];strBuffer.push("https://images.gasbuddy.com/aw/ldpi/");strBuffer.push(n.ID.toString());t=="0"?strBuffer.push("/offbig.png"):strBuffer.push("/onbig.png");var i=strBuffer.join("");return i.toString()}function drawToAwardDetailsMeterCanvas(n){var i,r,u,f,e,t;r="#0097A9";u="#63666A";f=160;e=getNextLevelMeterWidth(n,f);i=document.getElementById("AwardDetails_meterCanvas");i.getContext&&(t=i.getContext("2d"),t.strokeStyle=u,t.fillStyle=u,t.fillRect(0,0,f,30),t.strokeStyle=r,t.fillStyle=r,t.fillRect(0,0,e,30))}function getNextLevelMeterWidth(n,t){var i=n.ProgressMessage.split("/"),r=parseFloat(i[0]),u=parseFloat(i[1]),f=r/u;return f*t}function buildAwardCanvs(n){var t=[],i;return t.push('<canvas id="awardCanvas'),t.push(n.ID),t.push('" gb-awardId="'),t.push(n.ID),t.push('" gb-award-level="'),t.push(n.Level),t.push('" width="100" height="100" '),t.push('onclick="GB_MemberAwardsPage.openAwardDetails(this)">'),t.push("<\/canvas>"),t.push("<br />"),t.push(buildAwardTitle(n)),i=t.join(""),i.toString()}function buildAchievementsImage(n){var t=[],i;return t.push("<div> "),t.push("<div><b>"+buildAwardTitle(n)+"<\/b><\/div>"),t.push('<div><img src="'+buildChallengesImagePath(n)+'">'),t.push("<div>Level <b>"+n.Level+"<\/b><\/div>"),t.push("<\/div><\/div>"),i=t.join(""),i.toString()}function buildAchievementsImagev2(n){var t=[],i;return t.push("<div> "),t.push("<div><b>"+buildAchievementTitle(n)+"<\/b><\/div>"),t.push('<div><img src="'+n.Content.ImageUrl+'?h=100">'),n.Info.HasLevels&&t.push("<div>Level <b>"+n.Status.LevelNumber+"<\/b><\/div>"),t.push("<\/div><\/div>"),i=t.join(""),i.toString()}function buildImagePath(n){var t=[],i;return t.push("https://images.gasbuddy.com/aw/mdpi/"),t.push(n.ID.toString()),n.Level.toString()!=="0"?t.push("/onsmall.png"):t.push("/offsmall.png"),i=t.join(""),i.toString()}function buildChallengesImagePath(n){var t=[],i;return t.push("https://images.gasbuddy.com/di/c/legacy-"),t.push(n.Title.toString().replace(/\s/g,"").toLowerCase()),t.push(".png?h=100"),i=t.join(""),i.toString()}function buildChallengesImagePathv2(n){var t=[],i;return t.push(n.Content.ImageUrl),t.push("?h=100"),i=t.join(""),i.toString()}function buildAwardTitle(n){var t=[],i;return t.push("<div>"),t.push(n.Title),t.push("<\/div>"),i=t.join(""),i.toString()}function buildAchievementTitle(n){var t=[],i;return t.push("<div>"),t.push(n.Content.Title),t.push("<\/div>"),i=t.join(""),i.toString()}function drawAwardsToCanvas(n){var i,t;$(n).each(function(){t="awardCanvas"+this.ID.toString();i=document.getElementById(t)})}function drawAward(n,t,i){var r=i.getContext("2d"),u;r.strokeStyle=n;r.fillStyle=n;r.beginPath();r.arc(50,50,46,0,Math.PI*2,!0);r.closePath();r.stroke();r.fill();u=new Image;u.onload=function(){drawAwardImage(r,u)};u.src=t}function drawAwardImage(n,t){n.drawImage(t,10,10,80,80)}function buildJoinedDate(n){var t=n.getMonth(),i=n.getDate(),r=n.getFullYear();return"Joined "+["January","February","March","April","May","June","July","August","September","October","November","December"][t]+" "+i+", "+r}function appendFeatureHtml(n,t,i){i.push('<div class="feature-grid-item">');i.push('<img src="https://images.gasbuddy.com/di/features/v2/');i.push(n);i.push('.png?h=50"/>');i.push("<div>");i.push(t);i.push("<\/div>");i.push("<\/div>")}function Geo(){this.watchId={};this.position={};this.status="Geolocation uninitialized.";this.options={enableHighAccuracy:!0,maximumAge:100,timeout:3e4};_this=this}var GB_GLOBAL={},spitItAllOut=!0,GB_AwardDetailsPage,GB_FeedbackDialog,GB_HomePage,GB_MemberAwardsPage,GB_MemberLoginPage,GB_MemberPage,GB_PrizeEntryFormDialog,GB_PrizeInfoPage,GB_RegisterPage,GB_ReportPriceDialog,GB_SettingsPage,GB_StationDetailsPage,GB_StationFeaturesPage,GB_StationListPage,GB_StationMapInfoPage,GB_StationPhotoDialog,GB_StationPhotosPage,GB_TicketsPage,_this,GB_Utility;GB_GLOBAL.stationDetails_cookieId="stationDetails_DATA";GB_GLOBAL.populateData=function(n,t){var i=JSON.stringify(t);$.cookie(n,i)};GB_GLOBAL.NUM_OF_FEATURES=16;GB_GLOBAL.FUELSETTINGS_COOKIE="fuelSettings";GB_GLOBAL.displayLocation=function(){$("#Home_geoResults").html("");var n=[],t={};t=GB_GLOBAL.geoHandler.position;n.push(GB_GLOBAL.geoHandler.status);t.coords&&(n.push("lat: "+t.coords.latitude),n.push("long: "+t.coords.longitude));n.push(Date());$("#Home_geoResults").html(n.join("<br />"))};GB_GLOBAL.goToPage=function(n){$.mobile.changePage($("#"+n),"slide")};GB_GLOBAL.openDialog=function(n){$.mobile.changePage($("#"+n),{transition:"flip",role:"dialog"})};GB_GLOBAL.reloadPage=function(){window.location.reload()};GB_GLOBAL.animateHeader=function(n,t,i){var r="#"+n;r=$(r);r.css("color","#ff0000");r.html(t);r.animate({opacity:0},2500,function(){r.html(i);r.css("color","#ffffff");r.animate({opacity:100},2e4)})};GB_GLOBAL.isToastDisplayed=!1;GB_GLOBAL.displayToastMessage=function(n){if(!GB_GLOBAL.isToastDisplayed){var t=$("#Toast_banner");GB_GLOBAL.isToastDisplayed=!0;$("#Toast_message").html("");$("#Toast_message").html(n);t.css({top:"0px"},{"z-index":"9998"});t.animate({top:"0px"},2e3,function(){t.animate({top:"-50px"},1500,function(){GB_GLOBAL.isToastDisplayed=!1;$("#Toast_message").html("")})})}};GB_GLOBAL.forceCloseToast=function(){if(GB_GLOBAL.isToastDisplayed){var n=$("#Toast_banner");n.stop();GB_GLOBAL.isToastDisplayed=!1;n.css({top:"-50px"});$("#Toast_message").html("")}};GB_GLOBAL.menuIsOpen=!1;GB_GLOBAL.animateOpenMenu=function(n){$(n).slideDown("fast");GB_GLOBAL.menuIsOpen=!0};GB_GLOBAL.animateCloseMenu=function(n){$(n).slideUp("fast");GB_GLOBAL.menuIsOpen=!1};GB_GLOBAL.closeMenu=function(n){$(n).slideUp(0);GB_GLOBAL.menuIsOpen=!1};GB_GLOBAL.fuelType="";GB_GLOBAL.isLoggedIn=function(){return isMemberLoggedIn};GB_GLOBAL.getFuelType=function(){return userFuelType};GB_GLOBAL.unknownErrorMsg="Sorry, but something isn't working. Please try again.";GB_GLOBAL.setCookie=function(n,t,i){var r=new Date,u;r.setDate(r.getDate()+i);u=escape(t)+(i==null?"":"; path=/; expires="+r.toUTCString());document.cookie=n+"="+u};GB_GLOBAL.getCookie=function(n){for(var r=n+"=",u=document.cookie.split(";"),t,i=0;i<u.length;i++){for(t=u[i];t.charAt(0)==" ";)t=t.substring(1,t.length);if(t.indexOf(r)==0)return t.substring(r.length,t.length)}return null};$("#AwardDetails_page").live("pageshow",function(){_gaq.push(["_trackPageview","/AwardDetails_page"]);try{ll("tagScreen","Award Details Page")}catch(n){}GB_AwardDetailsPage.awardId==""?$.mobile.changePage($(GB_GLOBAL.memberPage.pageId),"slide"):(GB_AwardDetailsPage.clear(),GasBuddyTouch._Default.AjaxLoadAward(GB_AwardDetailsPage.awardId,GB_AwardDetailsPage.awardLevel,GB_AwardDetailsPage.load_callback))});GB_AwardDetailsPage={pageId:"#AwardDetails_page",headerId:"AwardDetails_header",awardId:"",init:function(){$("#award_details_back_button_container").click(function(){$.mobile.changePage($(GB_GLOBAL.memberPage.pageId),{transition:"slidefade"})})},load:function(n,t){GB_AwardDetailsPage.clear();GB_AwardDetailsPage.awardId=n;GB_AwardDetailsPage.awardLevel=t;$.mobile.changePage($(this.pageId),"slide")},load_callback:function(n){var t,i,r;if(n&&n.value)if(spitItAllOut&&console.log(n),n.value.ResponseCode=="1")t=n.value.Payload,$("#AwardDetails_loadImage").css({visibility:"hidden"}),$("#AwardDetails_imageDiv").css({visibility:"visible"}),GB_AwardDetailsPage.injectAwardTitleHtml(t),i=GB_AwardDetailsPage.getCurrentAward(t.AwardList),r=GB_AwardDetailsPage.getNextAward(t.AwardList,i.Level),GB_AwardDetailsPage.injectAwardLevelHtml(i),GB_AwardDetailsPage.injectAwardInfoHtml(r),drawToAwardDetailsCanvas(t,i.Level),r&&($("#AwardDetails_meter").css({display:"block"}),drawToAwardDetailsMeterCanvas(r));else return alert(n.value.ResponseMessage),window.history.back(),!1;else alert(GB_GLOBAL.unknownErrorMsg),window.location="/touch/"},clear:function(){$("#AwardDetails_header").html("");$("#AwardDetails_titleDiv").html("");$("#AwardDetails_loadImage").css({visibility:"visible"});$("#AwardDetails_imageDiv").css({visibility:"hidden"});$("#AwardDetails_infoDiv").html("");$("#AwardDetails_levelDiv").html("");$("#AwardDetails_meter").css({display:"none"})},injectAwardTitleHtml:function(n){var t=[];t.push("<h1>");t.push(n.Title);t.push("<\/h1>");$("#AwardDetails_titleDiv").append(t.join(""))},injectAwardLevelHtml:function(n){var t=[];n&&(t.push("<h3>"),t.push("Level "),t.push(n.Level.toString()),t.push("<\/h3>"));$("#AwardDetails_levelDiv").append(t.join(""))},injectAwardInfoHtml:function(n){var i=n.ProgressMessage.split("/"),r=parseFloat(i[0]),u=parseFloat(i[1]),f=u-r,t=[];t.push('<div style="font-weight: bold;">');t.push(n.ProgressMessage);t.push("<\/div><div>&nbsp;<\/div><div>");t.push(n.Description+" to reach Level "+n.Level);t.push("<\/div>");$("#AwardDetails_infoDiv").append(t.join(""))},getCurrentAward:function(n){var t;if(n.length==0)return!1;for(t=0;t<n.length;t++)if(n[t].IsCurrent)return n[t];return{Description:n[n.length-1].Description,IsCurrent:!0,Level:0,ProgressMessage:n[n.length-1].ProgressMessage}},getNextAward:function(n,t){if(n.length==0)return!1;if(t==5)return n[0];t++;for(var i=0;i<n.length;i++)if(n[i].Level==t)return n[i];return!1}};$("#Feedback_dialog").live("pageshow",function(){_gaq.push(["_trackPageview","/Feedback_dialog"]);try{ll("tagScreen","Feedback Dialog")}catch(n){}GB_GLOBAL.isLoggedIn()=="False"?$("#Feedback_emailDiv").css({display:"block"}):$("#Feedback_emailDiv").slideUp();GB_GLOBAL.isLoggedIn()=="True"&&GB_FeedbackDialog.clear()});GB_FeedbackDialog={pageId:"#Feedback_dialog",init:function(){$("#Feedback_submit").click(function(){GB_FeedbackDialog.submitFeedback()});$("#feedback_dialog_back_button_container").click(function(){$.mobile.changePage($(GB_GLOBAL.settingsPage.pageId),"slide");$("#Feedback_emailField").val("");$("#Feedback_commentsField").val("")})},load:function(){},clear:function(){$("#Feedback_emailField").val("")},submitFeedback:function(){if(GB_GLOBAL.isLoggedIn()=="False"&&$("#Feedback_emailField").val()=="")alert("Please enter an email.");else if(GB_GLOBAL.isLoggedIn()!="False"||GB_Utility.isValidEmail($("#Feedback_emailField").val()))if($("#Feedback_commentsField").val()=="")alert("Please enter something for the comments!");else{var n=$("#Feedback_emailField").val(),t=$("#Feedback_commentsField").val();GasBuddyTouch._Default.AjaxSubmitFeedback(n,t,this.submitFeedback_callback)}else alert("Please enter a valid email.")},submitFeedback_callback:function(n){if(n&&n.value)return spitItAllOut&&console.log(n),GB_FeedbackDialog.clear(),$("#Feedback_commentsField").val(""),GB_GLOBAL.displayToastMessage(n.value.ResponseMessage),window.history.back(),!1;alert(GB_GLOBAL.unknownErrorMsg);window.location="/touch/"}};$("#Home_page").live("pageshow",function(){_gaq.push(["_trackPageview","/Home_page"]);try{ll("tagScreen","Home")}catch(t){}try{googletag.cmd.push(function(){googletag.pubads().refresh([homepageAd])});for(var n=0;n<dacBidRequestConfigs.length;n++)ADTECH.loadPubAd(dacBidRequestConfigs[n].alias)}catch(i){}});GB_HomePage={pageId:"#Home_page",headerId:"Home_header",menuId:"Home_menu",init:function(){$("#Home_nearMeButton").click(function(){GB_HomePage.searchNearMe()});$("#Home_searchButton").click(function(){GB_HomePage.searchStations()});$("#Home_profileButton").click(function(){GB_GLOBAL.memberPage.load()});$("#Home_challengesButton").click(function(){GB_GLOBAL.isLoggedIn()==="False"?(GB_GLOBAL.memberLoginPage.setLoginPrompt("",GB_MemberAwardsPage,{}),$.mobile.changePage($(GB_GLOBAL.memberLoginPage.pageId),"slide")):$.mobile.changePage($(GB_GLOBAL.memberAwardsPage.pageId),{transition:"slidedown"})});$("#Home_challengesButton").on({touchstart:function(){$(this).attr("src","./Images/Rebrand/challenges_button_focus.png")}});$("#Home_challengesButton").on({touchend:function(){$(this).attr("src","./Images/Rebrand/challenges_button.png")}});$("#Home_getTicketsButton").click(function(){GB_HomePage.openTickets()});$("#Home_prizeInfoButton").click(function(){$.mobile.changePage($(GB_GLOBAL.prizeInfoPage.pageId),"slide")});$("#Home_searchBox").live("keyup",function(n){n.which===13&&GB_HomePage.searchStations()});$("#Home_settingsButton").click(function(){$.mobile.changePage($(GB_GLOBAL.settingsPage.pageId),"slide")});$("#Home_gasButton").click(function(){GB_HomePage.searchNearMe()});$("#Home_gasButton").on({touchstart:function(){$(this).attr("src","./Images/Rebrand/gas_icon_focus.png")}});$("#Home_gasButton").on({touchend:function(){$(this).attr("src","./Images/Rebrand/gas_icon.png")}});$("#Home_loginButton").click(function(){GB_GLOBAL.memberLoginPage.setLoginPrompt("",GB_MemberPage,{});$.mobile.changePage($(GB_GLOBAL.memberLoginPage.pageId),"slide")});$("#log_in_dialog_back_button_container").click(function(){window.history.back()});window.location.hash===""&&GB_HomePage.load()},load:function(){var n=$("#homePage_logged_panel").find(".home-menu-item")[2];if(GB_GLOBAL.isLoggedIn()==="True"){$(n).html('<div id="Home_profileButton" class="home-profile-button home-menu-image"><\/div>');$("#Home_profileButton").on({touchstart:function(){$(this).attr("src","./Images/Rebrand/profile_button_focus.png")}});$("#Home_profileButton").on({touchend:function(){$(this).attr("src","./Images/Rebrand/profile_button.png")}});$("#Home_profileButton").click(function(){GB_GLOBAL.memberPage.load()})}else{$(n).html('<div id="Home_loginButton" class="home-profile-button home-menu-image"><\/div>');$("#Home_loginButton").on({touchstart:function(){$(this).attr("src","./Images/Rebrand/profile_button_focus.png")}});$("#Home_loginButton").on({touchend:function(){$(this).attr("src","./Images/Rebrand/profile_button.png")}});$("#Home_loginButton").click(function(){GB_GLOBAL.memberLoginPage.setLoginPrompt("",GB_MemberPage,{});$.mobile.changePage($(GB_GLOBAL.memberLoginPage.pageId),"slide")})}},searchNearMe:function(){GB_GLOBAL.searchTerms="";var n=0,t=0;if(GB_GLOBAL.geoHandler.position.coords){GB_GLOBAL.stationListPage.clear();n=GB_GLOBAL.geoHandler.position.coords.latitude;t=GB_GLOBAL.geoHandler.position.coords.longitude;GB_GLOBAL.stationListPage.load(n,t,!0);try{ll("tagEvent","Search",{"Search Type":"Near Me"})}catch(i){}}else GB_GLOBAL.displayToastMessage("Sorry, but we can't find you right now.")},searchStations:function(){if(GB_GLOBAL.searchTerms=$("#Home_searchBox").val(),GB_GLOBAL.searchTerms==="")alert("Please enter a search value.");else{var n=0,t=0;GB_GLOBAL.geoHandler.position.coords&&(n=GB_GLOBAL.geoHandler.position.coords.latitude,t=GB_GLOBAL.geoHandler.position.coords.longitude);GB_GLOBAL.stationListPage.load(n,t,!1);try{ll("tagEvent","Search",{"Search Type":"Search Term Input"})}catch(i){}}},searchStations_callback:function(n){if(n&&n.value)if(spitItAllOut&&console.log(n.value),n.value.Response===0)alert(n.value.ResponseMessage);else{var t=n.value.Payload.PriceCollection;GB_GLOBAL.stationListPage.load(t,GB_GLOBAL.fuelType)}},openTickets:function(){GB_GLOBAL.isLoggedIn()==="True"?($.mobile.changePage($(GB_GLOBAL.ticketsPage.pageId),"slide"),GB_GLOBAL.ticketsPage.load()):alert("You must be logged in to get tickets.")}};$("#MemberAwards_page").live("pageshow",function(){_gaq.push(["_trackPageview","/MemberAwards_page"]);try{ll("tagScreen","Member Awards Page")}catch(n){}if(GB_GLOBAL.isLoggedIn()==="False"){GB_GLOBAL.memberLoginPage.setLoginPrompt("");$.mobile.changePage($(GB_GLOBAL.memberLoginPage.pageId),"slide");return}GB_GLOBAL.isLoggedIn()==="True"&&$.isEmptyObject(GB_GLOBAL.memberAwardsPage.achievementCollection)?GasBuddyTouch._Default.AjaxLoadMemberInfo(GB_MemberAwardsPage.load_callback):(GB_GLOBAL.memberAwardsPage.clear(),GB_GLOBAL.memberAwardsPage.buildUIv2())});GB_MemberAwardsPage={pageId:"#MemberAwards_page",header:"MemberAwards_header",awardsCollection:{},awardImageArray:{},init:function(){$("#member_awards_back_button_container").click(function(){window.history.back()})},load:function(){GB_MemberAwardsPage.clear();$.mobile.changePage($(GB_GLOBAL.memberAwardsPage.pageId),"slide")},load_callback:function(n){if(n&&n.value&&(spitItAllOut&&console.log(n),n.value.ResponseCode===1)){var t=n.value.Payload;GB_GLOBAL.memberAwardsPage.awardsCollection=t.AwardsCollection;GB_GLOBAL.memberAwardsPage.achievementsCollection=t.AchievementsCollection;GB_GLOBAL.memberAwardsPage.buildUIv2(t.AchievementsCollection)}},clear:function(){$("#MemberAwards_grid").html("")},openAwardDetails:function(n){var t=$(n).attr("gb-awardId"),i=$(n).attr("gb-award-level");GB_GLOBAL.isLoggedIn()==="False"?alert("You are not currently logged in."):GB_GLOBAL.awardDetailsPage.load(t,i)},buildUI:function(){var n=[];$(GB_MemberAwardsPage.awardsCollection).each(function(){n.push('<div class="awards-grid-item" gb-awardId="');n.push(this.ID);n.push('" gb-award-level="');n.push(this.Level);n.push('">');n.push(buildAchievementsImage(this));n.push("<\/div>")});n.push("<div style='clear:left'; />");$("#MemberAwards_grid").append(n.join(""));drawAwardsToCanvas(GB_MemberAwardsPage.awardsCollection)},buildUIv2:function(n){var t=[],r,e,i,o,u,f;if(n=n||GB_GLOBAL.memberAwardsPage.achievementCollection,r=n,e=r.keys.length,e===0)t.push("<div>"),t.push($("<div/>").append($("<h3/>",{text:"See your glory, tackle new challenges"}).clone()).html()),t.push($("<div/>").append($("<p/>",{text:"Download the new GasBuddy app to see all your past challenges and achievements—and to start earning even more glory!"}).clone()).html()),t.push($("<div/>").append($("<a/>",{text:"Visit The App!",href:"https://routing.gasbuddy.com/app"}).clone()).html()),t.push("<\/div>");else for(i=0;i<e;i++){for(t.push("<div>"),t.push('<div class="achivement-group-header"><span>'+r.keys[i]),t.push("<\/span><\/div>"),t.push("<div>"),o=r.values[i],u=0;u<o.length;u++)f=o[u],t.push('<div class="awards-grid-item" gb-awardId="'),t.push(f.Content.AchievementId),t.push('" gb-award-level="'),t.push(f.Status.LevelNumber),t.push('">'),t.push(buildAchievementsImagev2(f)),t.push("<\/div>");t.push("<\/div><\/div>")}$("#MemberAwards_grid").append(t.join(""))}};$("#MemberLogin_page").live("pageshow",function(){try{ll("tagScreen","Member Login Page")}catch(n){}_gaq.push(["_trackPageview","/MemberLogin_page"]);$("#MemberLogin_loginButton").removeAttr("disabled");$("#MemberLogin_password").val("")});GB_MemberLoginPage={pageId:"#MemberLogin_page",navigatedFromRegister:!1,pageAfterLoginParams:{},init:function(){$("#MemberLogin_loginButton").click(function(){GB_MemberLoginPage.login()});$("#MemberLogin_username").keyup(function(n){n.which===13&&$("#MemberLogin_password").focus()});$("#MemberLogin_password").keyup(function(n){n.which===13&&GB_MemberLoginPage.login()});$("#MemberLogin_signUpLink").click(function(){$.mobile.changePage($(GB_GLOBAL.registerPage.pageId),"slide");GB_RegisterPage.load()});$("#MemberLogin_loginButton").removeAttr("disabled");$("#register_dialog_back_button_container").click(function(){window.history.back()})},login:function(){var t=$("#MemberLogin_username").val(),i=$("#MemberLogin_password").val(),n=!1;$("#MemberLogin_rememberCheckbox").attr("checked")&&(n=!0);$("#MemberLogin_username").val()===""?alert("Please enter a nickname."):$("#MemberLogin_password").val()===""?alert("Please enter a password."):($("#MemberLogin_loginButton").attr("disabled","disabled"),$("#PrizeInfo_loginLink").attr("href",""),GasBuddyTouch._Default.AjaxMemberApiLogin(t,i,n,this.login_callback));GB_HomePage.load()},login_callback:function(n){if(n&&n.value)if(spitItAllOut&&console.log(n),n.value.ResponseMessage!==""&&alert(n.value.ResponseMessage),n.value.ResponseCode===1){if(n.value.Payload){if($("#PrizeInfo_loginLink").attr("href","#MemberLogin_page"),isMemberLoggedIn="True",GB_MemberLoginPage.pageAfterLoginParams.length){var t=GB_MemberLoginPage.pageAfterLoginParams;GB_MemberLoginPage.pageAfterLogin.load(t[0],t[1],t[2])}else GB_MemberLoginPage.pageAfterLogin.load(GB_MemberLoginPage.pageAfterLoginParams);return GB_HomePage.load(),!1}$("#MemberLogin_loginButton").removeAttr("disabled");$("#PrizeInfo_loginLink").attr("href","#MemberLogin_page");isMemberLoggedIn="False";$("#MemberLogin_password").val("")}else return $("#MemberLogin_loginButton").removeAttr("disabled"),$("#MemberLogin_password").val(""),!1},setLoginPrompt:function(n,t,i){n!==""?($("#MemberLogin_prompt").html(n),$("#MemberLogin_prompt").css({display:"block"})):($("#MemberLogin_prompt").html(""),$("#MemberLogin_prompt").css({display:"none"}));GB_MemberLoginPage.pageAfterLogin=t;GB_MemberLoginPage.pageAfterLoginParams=i}};$("#Member_page").live("pageshow",function(){_gaq.push(["_trackPageview","/Member_page"]);try{ll("tagScreen","Member Profile Page")}catch(n){}GB_GLOBAL.closeMenu(GB_MemberPage.menuId);GB_GLOBAL.isLoggedIn()==="False"?(GB_GLOBAL.memberLoginPage.setLoginPrompt("You must be logged in to post prices."),$.mobile.changePage($(GB_GLOBAL.memberLoginPage.pageId),"slide")):GB_GLOBAL.memberPage.currentMember?GB_MemberPage.buildUI():GasBuddyTouch._Default.AjaxLoadMemberInfo(GB_MemberPage.load_callback)});GB_MemberPage={pageId:"#Member_page",headerId:"Member_header",menuId:"#Member_menu",init:function(){$("#Member_logout").click(function(){GB_MemberPage.logout()});$("#Member_getTicketsButton").click(function(){GB_MemberPage.openTickets()});$("#Member_awardsButton").click(function(){GB_GLOBAL.memberAwardsPage.load()});$("#Member_settingsButton").click(function(){$.mobile.changePage($(GB_GLOBAL.settingsPage.pageId),{transition:"fade"})});$("#member_back_button_container").click(function(){GB_HomePage.load();$.mobile.changePage($(GB_GLOBAL.homePage.pageId),{transition:"slideup"})})},load:function(){GB_MemberPage.clear();$.mobile.changePage($(this.pageId),{transition:"slidedown"})},load_callback:function(n){if(n&&n.value)if(spitItAllOut&&console.log(n),console.log(n.value.ResponseCode),n.value.ResponseCode===1)GB_GLOBAL.memberPage.currentMember=n.value.Payload,GB_MemberPage.buildUI(),GB_GLOBAL.memberAwardsPage.awardsCollection=GB_GLOBAL.memberPage.currentMember.AwardsCollection,GB_GLOBAL.memberAwardsPage.achievementCollection=GB_GLOBAL.memberPage.currentMember.AchievementsCollection;else return alert(n.value.ResponseMessage),$.mobile.changePage($(GB_GLOBAL.homePage.pageId),"slide"),window.location="/touch/",!1;else alert(GB_GLOBAL.unknownErrorMsg),window.location="/touch/"},buildUI:function(){$("#Member_username").html(GB_GLOBAL.memberPage.currentMember.Stats.MemberID);$("#Member_loadImage").css({visibility:"hidden"});$("#Member_loading").css({display:"none"});GB_MemberPage.setMemberImage(GB_GLOBAL.memberPage.currentMember.Photo.ImageUrl);$("#Member_joinDate").html(buildJoinedDate(GB_GLOBAL.memberPage.currentMember.Stats.JoinDate));$("#Member_totalPoints").html(GB_GLOBAL.memberPage.currentMember.Stats.TotalPoints);$("#Member_pointBalance").html(GB_GLOBAL.memberPage.currentMember.Stats.PointBalance);$("#Member_consecutiveDays").html(GB_GLOBAL.memberPage.currentMember.ConsecutiveDays);$("#Member_profileDiv").css({visibility:"visible"});$("#Member_footer").css({visibility:"visible"})},clear:function(){$("#Member_loadImage").css({visibility:"visible"});$("#Member_loading").css({display:"block"});$("#Member_profileDiv").css({visibility:"hidden"});$("#Member_footer").css({visibility:"hidden"})},setMemberImage:function(n){n===""?$("#Member_image").attr("src","./Images/image_defaultUser.png"):$("#Member_image").attr("src",n)},logout:function(){GasBuddyTouch._Default.AjaxMemberLogout(this.logoutCallback)},logoutCallback:function(n){if(n&&n.value)return window.history.back(),setTimeout(function(){GB_GLOBAL.reloadPage()},10),!1},openTickets:function(){GB_GLOBAL.isLoggedIn()==="True"?GB_GLOBAL.ticketsPage.load({navigate:!0}):alert("You must be logged in to get tickets.")}};$("#PrizeEntryForm_dialog").live("pageshow",function(){_gaq.push(["_trackPageview","/PrizeEntryForm_dialog"]);try{ll("tagScreen","Prize Entry Form Dialog")}catch(n){}});GB_PrizeEntryFormDialog={pageId:"PrizeEntryForm_dialog",stateList:[],ticketAmount:{},init:function(){$("#PrizeEntryForm_submitButton").click(function(){GB_PrizeEntryFormDialog.getTickets()});$("#PrizeEntryForm_submitButton").removeAttr("disabled");$("#PrizeEntryForm_email").keyup(function(n){n.which===13&&GB_PrizeEntryFormDialog.getTickets()})},load:function(n,t){GB_PrizeEntryFormDialog.clear();GB_GLOBAL.goToPage(this.pageId);$("#PrizeEntryForm_firstName").val(n.FirstName);$("#PrizeEntryForm_lastName").val(n.LastName);$("#PrizeEntryForm_address1").val(n.Address1);$("#PrizeEntryForm_address2").val(n.Address2);$("#PrizeEntryForm_city").val(n.City);$("#PrizeEntryForm_state").val(n.State);$("#PrizeEntryForm_postalCode").val(n.PostalCode);$("#PrizeEntryForm_email").val(n.Email);this.loadStateList();this.injectStatesSelectHtml();$("#PrizeEntryForm_statesSelect").val(n.State).selectmenu("refresh");this.ticketAmount=t},clear:function(){$("#PrizeEntryForm_submitButton").removeAttr("disabled");$("#PrizeEntryForm_firstName").val("");$("#PrizeEntryForm_lastName").val("");$("#PrizeEntryForm_address1").val("");$("#PrizeEntryForm_address2").val("");$("#PrizeEntryForm_city").val("");$("#PrizeEntryForm_state").val("");$("#PrizeEntryForm_postalCode").val("");$("#PrizeEntryForm_email").val("");$("#PrizeEntryForm_statesSelect").html("")},injectStatesSelectHtml:function(){var n=[];$(this.stateList).each(function(){n.push('<option value="');n.push(this.code);n.push('">');n.push(this.name);n.push("<\/option>")});$("#PrizeEntryForm_statesSelect").append(n.join(""))},getTickets:function(){if($("#PrizeEntryForm_firstName").val()===""||$("#PrizeEntryForm_lastName").val()===""||$("#PrizeEntryForm_address1").val()===""||$("#PrizeEntryForm_city").val()===""||$("#PrizeEntryForm_statesSelect").val()===""||$("#PrizeEntryForm_postalCode").val()===""||$("#PrizeEntryForm_email").val()==="")alert("All fields are required please!");else $("#PrizeEntryForm_submitButton").attr("disabled","disabled"),GasBuddyTouch._Default.AjaxGetTickets(parseInt(this.ticketAmount),$("#PrizeEntryForm_firstName").val(),$("#PrizeEntryForm_lastName").val(),$("#PrizeEntryForm_address1").val(),$("#PrizeEntryForm_address2").val(),$("#PrizeEntryForm_city").val(),$("#PrizeEntryForm_statesSelect").val(),$("#PrizeEntryForm_postalCode").val(),$("#PrizeEntryForm_email").val(),!1,this.getTickets_callback)},getTickets_callback:function(n){if(n&&n.value)if(spitItAllOut&&console.log(n),n.value.ResponseCode===1){if(n.value.ResponseMessage!=="")return GB_GLOBAL.displayToastMessage(n.value.ResponseMessage),$(".ui-dialog").dialog("close"),!1}else n.value.ResponseCode===0&&($("#PrizeEntryForm_submitButton").attr("disabled",!1),alert(n.value.ResponseMessage));else alert("Sorry, we are unable to get you tickets right now."),$("#PrizeEntryForm_submitButton").removeAttr("disabled")},formMemberPrizeDrawAndCollectionObject:function(n){return{value:{ResponseCode:1,ResponseMessage:"",Payload:n}}},loadStateList:function(){GB_PrizeEntryFormDialog.stateList.length<1&&(GB_PrizeEntryFormDialog.stateList.push({code:"",name:"Choose a state..."}),GB_PrizeEntryFormDialog.stateList.push({code:"AL",name:"Alabama"}),GB_PrizeEntryFormDialog.stateList.push({code:"AK",name:"Alaska"}),GB_PrizeEntryFormDialog.stateList.push({code:"AZ",name:"Arizona"}),GB_PrizeEntryFormDialog.stateList.push({code:"AR",name:"Arkansas"}),GB_PrizeEntryFormDialog.stateList.push({code:"CA",name:"California"}),GB_PrizeEntryFormDialog.stateList.push({code:"CO",name:"Colorado"}),GB_PrizeEntryFormDialog.stateList.push({code:"CT",name:"Connecticut"}),GB_PrizeEntryFormDialog.stateList.push({code:"DE",name:"Delaware"}),GB_PrizeEntryFormDialog.stateList.push({code:"FL",name:"Florida"}),GB_PrizeEntryFormDialog.stateList.push({code:"GA",name:"Georgia"}),GB_PrizeEntryFormDialog.stateList.push({code:"HI",name:"Hawaii"}),GB_PrizeEntryFormDialog.stateList.push({code:"ID",name:"Idaho"}),GB_PrizeEntryFormDialog.stateList.push({code:"IL",name:"Illinois"}),GB_PrizeEntryFormDialog.stateList.push({code:"IN",name:"Indiana"}),GB_PrizeEntryFormDialog.stateList.push({code:"IA",name:"Iowa"}),GB_PrizeEntryFormDialog.stateList.push({code:"KS",name:"Kansas"}),GB_PrizeEntryFormDialog.stateList.push({code:"KY",name:"Kentucky"}),GB_PrizeEntryFormDialog.stateList.push({code:"LA",name:"Louisiana"}),GB_PrizeEntryFormDialog.stateList.push({code:"ME",name:"Maine"}),GB_PrizeEntryFormDialog.stateList.push({code:"MD",name:"Maryland"}),GB_PrizeEntryFormDialog.stateList.push({code:"MA",name:"Massachusetts"}),GB_PrizeEntryFormDialog.stateList.push({code:"MI",name:"Michigan"}),GB_PrizeEntryFormDialog.stateList.push({code:"MN",name:"Minnesota"}),GB_PrizeEntryFormDialog.stateList.push({code:"MS",name:"Mississippi"}),GB_PrizeEntryFormDialog.stateList.push({code:"MO",name:"Missouri"}),GB_PrizeEntryFormDialog.stateList.push({code:"MT",name:"Montana"}),GB_PrizeEntryFormDialog.stateList.push({code:"NE",name:"Nebraska"}),GB_PrizeEntryFormDialog.stateList.push({code:"NV",name:"Nevada"}),GB_PrizeEntryFormDialog.stateList.push({code:"NH",name:"New Hampshire"}),GB_PrizeEntryFormDialog.stateList.push({code:"NJ",name:"New Jersey"}),GB_PrizeEntryFormDialog.stateList.push({code:"NM",name:"New Mexico"}),GB_PrizeEntryFormDialog.stateList.push({code:"NY",name:"New York"}),GB_PrizeEntryFormDialog.stateList.push({code:"NC",name:"North Carolina"}),GB_PrizeEntryFormDialog.stateList.push({code:"ND",name:"North Dakota"}),GB_PrizeEntryFormDialog.stateList.push({code:"OH",name:"Ohio"}),GB_PrizeEntryFormDialog.stateList.push({code:"OK",name:"Oklahoma"}),GB_PrizeEntryFormDialog.stateList.push({code:"OR",name:"Oregon"}),GB_PrizeEntryFormDialog.stateList.push({code:"PA",name:"Pennsylvania"}),GB_PrizeEntryFormDialog.stateList.push({code:"RI",name:"Rhode Island"}),GB_PrizeEntryFormDialog.stateList.push({code:"SC",name:"South Carolina"}),GB_PrizeEntryFormDialog.stateList.push({code:"TN",name:"Tennessee"}),GB_PrizeEntryFormDialog.stateList.push({code:"TX",name:"Texas"}),GB_PrizeEntryFormDialog.stateList.push({code:"UT",name:"Utah"}),GB_PrizeEntryFormDialog.stateList.push({code:"VT",name:"Vermont"}),GB_PrizeEntryFormDialog.stateList.push({code:"VA",name:"Virginia"}),GB_PrizeEntryFormDialog.stateList.push({code:"WA",name:"Washington"}),GB_PrizeEntryFormDialog.stateList.push({code:"DC",name:"Washington DC"}),GB_PrizeEntryFormDialog.stateList.push({code:"WV",name:"West Virginia"}),GB_PrizeEntryFormDialog.stateList.push({code:"WI",name:"Wisconsin"}),GB_PrizeEntryFormDialog.stateList.push({code:"WY",name:"Wyoming"}),GB_PrizeEntryFormDialog.stateList.push({code:"AB",name:"Alberta"}),GB_PrizeEntryFormDialog.stateList.push({code:"BC",name:"British Columbia"}),GB_PrizeEntryFormDialog.stateList.push({code:"MB",name:"Manitoba"}),GB_PrizeEntryFormDialog.stateList.push({code:"NF",name:"Newfoundland"}),GB_PrizeEntryFormDialog.stateList.push({code:"NT",name:"Northwest Territories"}),GB_PrizeEntryFormDialog.stateList.push({code:"NS",name:"Nova Scotia"}),GB_PrizeEntryFormDialog.stateList.push({code:"ON",name:"Ontario"}),GB_PrizeEntryFormDialog.stateList.push({code:"PE",name:"PEI"}),GB_PrizeEntryFormDialog.stateList.push({code:"SK",name:"Saskatchewan"}))}};$("#PrizeInfo_page").live("pageshow",function(){_gaq.push(["_trackPageview","/PrizeInfo_page"]);try{ll("tagScreen","Prize Info Page")}catch(n){}GB_GLOBAL.memberLoginPage.setLoginPrompt("");GB_GLOBAL.isLoggedIn()==="True"&&(window.location="/touch/")});GB_PrizeInfoPage={pageId:"#PrizeInfo_page",init:function(){},load:function(){},clear:function(){}};$("#Register_page").live("pageshow",function(){_gaq.push(["_trackPageview","/Register_page"]);try{ll("tagScreen","Registration Page")}catch(n){}});GB_RegisterPage={pageId:"#Register_page",init:function(){$("#Register_registerButton").click(function(){GB_RegisterPage.validateUser()});$("#Register_username").keyup(function(n){n.which===13&&$("#Register_email").focus()});$("#Register_email").keyup(function(n){n.which===13&&$("#Register_password").focus()});$("#Register_password").keyup(function(n){n.which===13&&$("#Register_zip").focus()});$("#Register_zip").on("input propertychange paste",function(){var t=$("#Register_zip").val(),n;$("#Register_zip").val(t.toUpperCase().trim().replace(" ",""));n=!1;n=GB_RegisterPage.checkPostalCode($("#Register_zip").val());n?($("#Register_OptIn").show("fast"),$("#Register_emailCheckbox").prop("checked",!1),$("#Register_country option").attr("selected",!1),$("#Register_country option[value='CAN']").attr("selected",!0).change()):($("#Register_OptIn").hide("fast"),$("#Register_emailCheckbox").prop("checked",!0),$("#Register_country option").attr("selected",!1),$("#Register_country option[value='USA']").attr("selected",!0).change())});$("#Register_zip").keyup(function(n){n.which===13&&$("#Register_zip").blur()});$("#Register_page").live("pageshow",function(){$("#Register_registerButton").removeAttr("disabled")})},load:function(){GB_GLOBAL.geoHandler.position.coords&&GasBuddyTouch._Default.AjaxApiGetGeoInfo(GB_GLOBAL.geoHandler.position.coords.latitude,GB_GLOBAL.geoHandler.position.coords.longitude,this.load_callback)},load_callback:function(n){n.value.Payload&&($("#Register_zip").val(n.value.Payload.Description),$("#Register_country option").attr("selected",!1),$("#Register_country option[value='"+n.value.Payload.CountryCode+"']").attr("selected",!0).change(),n.value.Payload.CountryCode==="CAN"&&$("#Register_emailCheckbox").attr("checked",!1))},clear:function(){$("#Register_zip").val("");$("#Register_country").val("");$("#Register_country option").attr("selected",!1);$("#Register_emailCheckbox").attr("checked",!0)},validateUser:function(){var n=$("#Register_username").val(),t=$("#Register_email").val(),i=$("#Register_zip").val(),r=$("#Register_password").val(),u=$("#Register_emailCheckbox").prop("checked"),f=$("#Register_country").val();GasBuddyTouch._Default.AjaxApiValidate(n,t,i,u,f,r,this.validate_callback)},validate_callback:function(n){if(n.value)if(n.value.ResponseCode===0){if(n.value.Payload&&n.value.Payload.HasErrors){var t=n.value.Payload;alert(n.value.ResponseMessage);console.log(t)}}else console.log(n.value.ResponseMessage),GB_RegisterPage.registerUser()},registerUser:function(){var i=$("#Register_username").val(),r=$("#Register_email").val(),n=$("#Register_zip").val(),t=$("#Register_password").val(),f=$("#Register_emailCheckbox").prop("checked"),e=$("#Register_country").val(),u;if(validRequest=!0,GB_RegisterPage.isFieldsFilled()){if(!GB_Utility.isValidUsername(i)){alert("Nickname may contain only letters and numbers.");validRequest=!1;return}if(t.length<4){alert("Passwords must be at least 4 characters long.");validRequest=!1;return}if(t.length>15&&alert("Passwords must be less then 15 characters long."),!GB_Utility.isValidEmail(r)){alert("Please enter a valid email.");validRequest=!1;return}if(!(GB_Utility.containsZipCode(n)||GB_Utility.containsPostalCode(n))){alert("Please enter a valid zip/postal code.");validRequest=!1;return}$("#Register_registerButton").attr("disabled","disabled");validRequest&&(u=!1,$("#Register_rememberCheckbox").attr("checked")&&(u=!0),GasBuddyTouch._Default.AjaxApiRegisterMember(i,r,t,n,e,f,GB_GLOBAL.geoHandler.position.coords.latitude,GB_GLOBAL.geoHandler.position.coords.longitude,((new Date).getTimezoneOffset()-240)*-1,this.registerUser_callback))}else alert("All fields are required please!")},registerUser_callback:function(n){if($("#Register_registerButton").removeAttr("disabled"),n&&n.value){if(spitItAllOut&&console.log(n),n.value.ResponseCode===0){if(n.value.Payload&&n.value.Payload.MemberValidation){var t=n.value.Payload.MemberValidation;alert(n.value.ResponseMessage);console.log(t)}}else if(n.value.ResponseCode===1&&(alert(n.value.ResponseMessage),$.mobile.changePage($(GB_GLOBAL.homePage.pageId),"slide"),window.location="/touch/",setTimeout(function(){GB_GLOBAL.reloadPage()},10),n.value.Payload.MemberStats.MemberId))return $(".ui-dialog").dialog("close"),$("#PrizeInfo_loginLink").attr("href","#MemberLogin_page"),isMemberLoggedIn="True",GB_HomePage.load(),!1}else alert("We are currently unable to register you at this time. Please try again!")},isFieldsFilled:function(){return $("#Register_username").val()===""||$("#Register_email").val()===""||$("#Register_password").val()===""||$("#Register_zip").val()===""?!1:!0},checkPostalCode:function(n){var t=new RegExp(/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ]/i);return t.test(n)?!0:!1}};$("#ReportPrice_dialog").live("pageshow",function(){_gaq.push(["_trackPageview","/ReportPrice_dialog"]);try{ll("tagScreen","Member Report Price Dialog")}catch(n){}if(GB_ReportPriceDialog.stationParameter==="")return window.history.back(),!1});GB_ReportPriceDialog={pageId:"#ReportPrice_dialog",stationId:0,stationParameter:"",priceValidation:{},loadedFromWebService:!1,init:function(){$("#Report_prices_wrapper").click(function(n){var t=null,r,i;if(n.target.className==="price-confirm"){if(t=n.target,!t.innerHTML.includes("Ready")||t.innerHTML.length===0){var u=t.dataset.fuelId,f=t.dataset.priceId,e=t.dataset.value;GB_ReportPriceDialog.autoFillPrice(u,f,e)}}else if(n.target.className!=="price-input")for(r=$("input.price-input"),i=0;i<r.length;i++)t=r[i],GB_ReportPriceDialog.formatText(t)});$("#Report_prices_wrapper").keyup(function(n){var f;if(n.target.className.includes("price-input")&&n.which===8){var i=n.target,r=i.dataset.fuelId,u=i.dataset.priceId,t=$("div.price-confirm[data-fuel-id="+r+"][data-price-id="+u+"]");$(i).css({color:"#101821"});var e=GB_Utility.getPrice(GB_ReportPriceDialog.prices,r,u),o=new Date,s=o-e.PostedTime,h=Math.floor(s/36e5);t.css({color:"#0097A9"});h<48?(f=t.data("value"),t.html("Confirm "+f)):t.html("")}});$("#ReportPrice_submitButton").click(function(){GB_ReportPriceDialog.reportPrices()});$("#report_dialog_back_button_container").click(function(){GB_ReportPriceDialog.previousPage&&(GB_ReportPriceDialog.previousPage==="#StationList_page"?$.mobile.changePage($(GB_GLOBAL.stationListPage.pageId),{transition:"slidefade"}):GB_ReportPriceDialog.previousPage==="#StationDetails_page"?$.mobile.changePage($(GB_GLOBAL.stationDetailsPage.pageId),{transition:"slidefade"}):window.history.bacK())})},load:function(n,t,i,r){GB_ReportPriceDialog.clear();typeof n=="number"?(GB_ReportPriceDialog.stationParameter=n,GB_ReportPriceDialog.loadedFromWebService=!0,GB_ReportPriceDialog.loadFromWebService(n),GB_ReportPriceDialog.previousPage=r):(GB_ReportPriceDialog.stationParameter=n.StationId,GB_ReportPriceDialog.loadedFromWebService=!1,GB_ReportPriceDialog.loadFromData(n,t,i),GB_ReportPriceDialog.previousPage=r);$.mobile.changePage($(this.pageId),"slide")},clear:function(){$("#ReportPrice_submitButton").attr("disabled",!1);GB_ReportPriceDialog.loadedFromWebService=!1;$("#ReportPrice_stationLogo").removeAttr("src");$("#ReportPrice_loadImage").css({visibility:"visible"});$("#Report_prices_wrapper").html("")},loadFromData:function(n,t,i,r){GB_ReportPriceDialog.currentStation=n;GB_ReportPriceDialog.prices=t;GB_ReportPriceDialog.priceValidation=i;GB_ReportPriceDialog.features=r;GB_ReportPriceDialog.stationId=n.Id;GB_ReportPriceDialog.stationCountry=n.Country;$("#ReportPrice_loadImage").css({visibility:"hidden"});$("#ReportPrice_stationLogo").attr("src",GB_Utility.buildStationLogoUrl(n.BrandId));GB_ReportPriceDialog.populatePriceTiles(t);GB_ReportPriceDialog.enableInputs()},loadFromWebService:function(n){GasBuddyTouch._Default.AjaxLoadStationDetails(n,this.loadFromWebService_callback)},loadFromWebService_callback:function(n){n&&n.value&&n.value.Result&&(spitItAllOut&&console.log(n),GB_ReportPriceDialog.loadFromData(n.value.Result.Payload.Details,n.value.Result.Payload.Prices,n.value.Result.Payload.PriceValidation,n.value.Result.Payload.Features))},populatePriceTiles:function(n){var i,t;for($("#Report_prices_wrapper").html(""),i="",t=1;t<=10;t++)GB_Utility.containsFuelId(n,t)&&(i+='<div class="report-price-fuel-type-div text-font-small">'+GB_Utility.mapFuelIdToString(t)+'<\/div> <div class="prices-container">',GB_Utility.containsFuelAndPriceId(n,t,1)&&(i+=GB_Utility.buildPriceHtml(n,t,1)),GB_Utility.containsFuelAndPriceId(n,t,2)&&(i+=GB_Utility.buildPriceHtml(n,t,2)),i+="<\/div>");$("#Report_prices_wrapper").html(i)},enableInputs:function(){$("#ReportPrice_regInput").removeAttr("disabled");$("#ReportPrice_midInput").removeAttr("disabled");$("#ReportPrice_premInput").removeAttr("disabled");$("#ReportPrice_dieselInput").removeAttr("disabled")},autoFillPrice:function(n,t,i){var u=$("input.price-input[data-fuel-id="+n+"][data-price-id="+t+"]"),r;u.val(i);u.css({color:"#97D700"});r=$("div.price-confirm[data-fuel-id="+n+"][data-price-id="+t+"]");r.css({color:"#97D700"});r.html("&#10003;&nbsp; Confirmed")},reportPrices:function(){var n=new Date,f=n.getTimezoneOffset(),e=new Date;e.setMinutes(n.getMinutes()-f);var o=GB_ReportPriceDialog.stationId,s=$("input.price-input"),t=[];if($(s).each(function(i,r){var f;r=$(r);var u=parseFloat(r.val()),e=r.data("fuelId"),s=r.data("priceId");(u>0||isNaN(u)===!1)&&(f={Amount:parseFloat(u),FuelProductID:e,PostedTime:n,PriceTypeID:s,StationId:o},t.push(f))}),t.length===0)alert("Please enter at least one price.");else{var i=0,r=0,u=0;GB_GLOBAL.geoHandler.position.coords&&(i=GB_GLOBAL.geoHandler.position.coords.latitude,r=GB_GLOBAL.geoHandler.position.coords.longitude,u=GB_GLOBAL.geoHandler.position.coords.accuracy);GasBuddyTouch._Default.AjaxReportStationPrices(GB_ReportPriceDialog.stationId,t,i,r,u,n,GB_ReportPriceDialog.reportPrices_callback)}},reportPrices_callback:function(n){if(n&&n.value){if(spitItAllOut&&console.log(n),n.value.ResponseCode===1){if(GB_GLOBAL.displayToastMessage(n.value.ResponseMessage),n.value.Payload)try{ll("tagEvent","Posted Price")}catch(t){}}else alert(n.value.ResponseMessage);window.history.back()}else alert(GB_GLOBAL.unknownErrorMsg),window.location="/touch/"},validatePrices:function(n,t,i){var r="",f=0,u=GB_Utility.getPrice(GB_ReportPriceDialog.priceValidation,t,i),e,o;return f=u.Price,e=u.MaxPrice,o=u.MinPrice,f>0&&(n>e&&(r=n+" seems high. Are you sure this is the correct price?"),n<o&&(r=n+" seems low. Are you sure this is the correct price?")),r},formatConfirmButton:function(n,t){var u=$(".price-confirm[data-fuel-id="+n+"][data-price-id="+t+"]"),i,r;u.css({color:"#8DC900"});u.html("✓&nbsp;Ready");t===1?(i=$(".price-input[data-fuel-id="+n+"][data-price-id=2]"),i.length>0?i.focus:(i=$(".price-input[data-fuel-id="+(n+1)+"][data-price-id="+t+"]"),i.length>0?i.focus():$("#ReportPrice_submitButton").focus())):(r=$(".price-confirm[data-fuel-id="+n+1+"][data-price-id="+t+"]"),r.length>0?r.focus():$("#ReportPrice_submitButton").focus())},validatePrice:function(n,t,i){var r=GB_ReportPriceDialog.validatePrices(n,t,i);r.length>0&&alert(r);GB_ReportPriceDialog.formatConfirmButton(t,i)},formatText:function(n){if(event.keyCode!==8){for(var r=$(n).data("fuelId"),u=$(n).data("priceId"),f=$(n).data("fuelType"),e=GB_StationDetailsPage.stationCountry,i=!1,t=n.value,t=t.replace(/[^0-9.]+/,"");t.substring(0)==="."&&t.length!==0;)t=t.substring(1,t.length);t.length>0&&(GB_ReportPriceDialog.stationCountry==="USA"?t.length===1?t=t.match(/[0-9]/)?t+".":"":t.length===2?t.match(/[0-9]\./)||(t=t[0]):t.length===3?t.match(/[0-9]\.[0-9]/)||(t=t.substring(0,t.length-1)):t.length===4?t.match(/[0-9].[0-9][0-9]/)?i=!0:t=t.substring(0,t.length-1):t.length>4&&(t=t.substring(0,4)):t[0].match(/[1-3]/)?t.length===1?t.match(/[1-3]/)||(t=""):t.length===2?t.match(/[1-3][0-9]/)||(t=t.substring(0,t.length-1)):t.length===3?t.match(/[1-3][0-9][0-9]/)||t.match(/[1-3][0-9]\./)?t.match(/[1-3][0-9][0-9]/)&&(t+="."):t=t.substring(0,t.length-1):t.length===4?(t.match(/[1-3][0-9][0-9]\./)||t.match(/[1-3][0-9]\.[0-9]/)||t.match(/[1-3][0-9][0-9][0-9]/)||(t=t.substring(0,t.length-1)+"."),t.match(/[1-3][0-9][0-9][0-9]/)&&(t=t.substring(0,3)+"."+t.substring(3),i=!0)):t.length===5?t.match(/[1-3][0-9][0-9]\.[0-9]/)?i=!0:t=t.substring(0,t.length-1):t.length>5&&(t=t.substring(0,5)):t.length===1?t.match(/[0-9]/)||(t=""):t.length===2?t.match(/[0-9][0-9]/)?t+=".":t=t.substring(0,t.length-1):t.length===3?t.match(/[0-9][0-9]\./)||(t=t.substring(0,t.length-1)):t.length===4?t.match(/[0-9][0-9]\.[0-9]/)?i=!0:t=t.substring(0,t.length-1):t.length>4&&(t=t.substring(0,4)));n.value=t;i&&GB_ReportPriceDialog.validatePrice(parseFloat(t),r,u,f)}}};$("#Settings_page").live("pageshow",function(){_gaq.push(["_trackPageview","/Settings_page"]);try{ll("tagScreen","Member Settings Page")}catch(n){}});GB_SettingsPage={pageId:"#Settings_page",init:function(){this.autoCheckRadioButton();$("#Settings_regRadio").click(function(){GB_SettingsPage.updateFuelType(this)});$("#Settings_midRadio").click(function(){GB_SettingsPage.updateFuelType(this)});$("#Settings_premRadio").click(function(){GB_SettingsPage.updateFuelType(this)});$("#Settings_dieselRadio").click(function(){GB_SettingsPage.updateFuelType(this)});$("#Settings_feedbackButton").click(function(){$.mobile.changePage($(GB_GLOBAL.feedbackDialog.pageId),"slide")});$("#settings_back_button_container").click(function(){$.mobile.changePage($(GB_GLOBAL.memberPage.pageId),"slide")})},updateFuelType:function(n){GB_GLOBAL.setCookie(GB_GLOBAL.FUELSETTINGS_COOKIE,n.value,30);GB_GLOBAL.fuelType=n.value;try{ll("tagEvent","Fuel Preference",{"Fuel Type":this.FuelTypeToFuelName(GB_GLOBAL.fuelType)})}catch(t){}},autoCheckRadioButton:function(){GB_GLOBAL.fuelType==="A"?$("#Settings_regRadio").attr("checked","checked"):GB_GLOBAL.fuelType==="B"?$("#Settings_midRadio").attr("checked","checked"):GB_GLOBAL.fuelType==="C"?$("#Settings_premRadio").attr("checked","checked"):GB_GLOBAL.fuelType==="D"?$("#Settings_dieselRadio").attr("checked","checked"):$("#Settings_regRadio").attr("checked","checked")},FuelTypeToFuelName:function(n){switch(n){case"A":return"Regular";case"B":return"Mid-Grade";case"C":return"Premium";case"D":return"Diesel"}}};$("#StationDetails_page").live("pageshow",function(){_gaq.push(["_trackPageview","/StationDetails_page"]);try{ll("tagScreen","Station Details Page")}catch(i){}if(googletag.cmd.push(function(){googletag.pubads().refresh([contentTopFluid])}),GB_GLOBAL.closeMenu(GB_StationDetailsPage.menuId),$.cookie(GB_StationDetailsPage.cookieId)==="")window.location="/touch/";else{GB_StationDetailsPage.clear();var n=decodeURIComponent($.cookie(GB_StationDetailsPage.cookieId)),t=JSON.parse(n);GasBuddyTouch._Default.AjaxLoadStationDetails(t.stationId,GB_StationDetailsPage.load_callback)}});GB_StationDetailsPage={pageId:"#StationDetails_page",headerId:"StationDetails_header",menuId:"#StationDetails_menu",cookieId:"stationDetails_cookie",stationId:0,map:{},openStreetMapUrl:{},openStreetMap:{},marker:{},currentStation:{},priceValidation:{},autoFillReg:!1,autoFillMid:!1,autoFillPrem:!1,autoFillDiesel:!1,init:function(){$("#StationDetails_regTile").click(function(){GB_StationDetailsPage.autoFillPrice("reg")});$("#StationDetails_midTile").click(function(){GB_StationDetailsPage.autoFillPrice("mid")});$("#StationDetails_premTile").click(function(){GB_StationDetailsPage.autoFillPrice("prem")});$("#StationDetails_dieselTile").click(function(){GB_StationDetailsPage.autoFillPrice("diesel")});$("#StationDetails_featuresButton").click(function(){GB_GLOBAL.stationFeaturesPage.load(GB_StationDetailsPage.currentStation)});$("#StationDetails_photosButton").click(function(){GB_GLOBAL.stationPhotosPage.load(GB_StationDetailsPage.currentStation)});$("#StationDetails_mapButton").click(function(){GB_GLOBAL.stationMapInfoPage.load(GB_StationDetailsPage.currentStation)});$("#StationDetails_mapContainer").click(function(){GB_GLOBAL.stationMapInfoPage.load(GB_StationDetailsPage.currentStation)});$("#StationDetails_reportPricesButton").click(function(){GB_GLOBAL.isLoggedIn()==="False"?(GB_GLOBAL.memberLoginPage.setLoginPrompt("You must be logged in to post prices.",GB_ReportPriceDialog,[GB_StationDetailsPage.currentStation,GB_StationDetailsPage.prices,GB_StationDetailsPage.priceValidation]),$.mobile.changePage($(GB_GLOBAL.memberLoginPage.pageId),"slide")):GB_StationDetailsPage.openReportPricesDialog()});$(".station_details_prices_wrapper").click(function(){GB_GLOBAL.isLoggedIn()==="False"?(GB_GLOBAL.memberLoginPage.setLoginPrompt("You must be logged in to post prices."),$.mobile.changePage($(GB_GLOBAL.memberLoginPage.pageId),"slide")):GB_StationDetailsPage.openReportPricesDialog()});$("#StationDetails_testMapButton").click(function(){GB_StationDetailsPage.map.setView(new L.LatLng(50.45,-104.61),16);var n=L.Icon.extend({iconUrl:"Images/mylocation.png",shadowUrl:"",iconSize:new L.Point(16,16),iconAnchor:new L.Point(8,10),popupAnchor:new L.Point(0,0)}),t=new n,i=new L.Marker(new L.LatLng(50.45,-104.61),{icon:t});GB_StationDetailsPage.map.addLayer(i)});$("#station_details_back_button_container").click(function(){if(GB_StationListPage.stationCollection)$.mobile.changePage($(GB_GLOBAL.stationListPage.pageId),{transition:"slidefade"});else if(GB_GLOBAL.searchTerms.length>0){var n=0,t=0;GB_GLOBAL.geoHandler.position.coords&&(n=GB_GLOBAL.geoHandler.position.coords.latitude,t=GB_GLOBAL.geoHandler.position.coords.longitude);GB_GLOBAL.stationListPage.load(n,t,!1)}else GB_GLOBAL.geoHandler.position.coords?(n=GB_GLOBAL.geoHandler.position.coords.latitude,t=GB_GLOBAL.geoHandler.position.coords.longitude,GB_GLOBAL.stationListPage.load(n,t,!0)):alert("No location information available. Unable to return to stations list. Please return the home page.")});$("#StationDetails_cashToggle").click(function(){GB_StationDetailsPage.injectStationPricesHtml(GB_StationDetailsPage.prices)})},load:function(n){GB_StationDetailsPage.clear();var t={stationId:n};GB_GLOBAL.populateData(GB_StationDetailsPage.cookieId,t);$.mobile.changePage($(this.pageId),"slide")},load_callback:function(n){spitItAllOut&&console.log(n);$("#StationDetails_mapContainer").append('<div id="StationDetails_mapCanvas" class="station-details-map-div"><\/div>');GB_StationDetailsPage.map=new L.Map("StationDetails_mapCanvas");this.openStreetMapUrl="https://a.tile.openstreetmap.org/{z}/{x}/{y}.png";openStreetMapAttribution="© OpenStreetMap contributors, CC BY-SA";this.openStreetMap=new L.TileLayer(this.openStreetMapUrl,{maxZoom:18,attribution:openStreetMapAttribution});GB_StationDetailsPage.map.addLayer(this.openStreetMap);GB_StationDetailsPage.map.setView(new L.LatLng(38,-97),15);n&&n.value&&n.value.Result?(GB_StationDetailsPage.currentStation=n.value.Result.Payload.Details,GB_StationDetailsPage.priceValidation=n.value.Result.Payload.PriceValidation,GB_StationDetailsPage.prices=n.value.Result.Payload.Prices,GB_StationDetailsPage.features=n.value.Result.Payload.Features,GB_Utility.containsCash(GB_StationDetailsPage.prices)?$("#cash_toggle_span").css({visibility:"visible"}):$("#cash_toggle_span").css({visibility:"hidden"}),$("#StationDetails_loadImage").css({visibility:"hidden"}),$("#StationDetails_loading").css({display:"none"}),GB_StationDetailsPage.injectStationInfoHtml(GB_StationDetailsPage.currentStation),GB_StationDetailsPage.injectStationPricesHtml(GB_StationDetailsPage.prices),n.value.Result.Payload.EnterpriseAds&&GB_StationDetailsPage.injectEnterpriseAds(n.value.Result.Payload.EnterpriseAds),GB_StationDetailsPage.stationCountry=GB_StationDetailsPage.currentStation.Country,GB_StationDetailsPage.initSmallStationMap(GB_StationDetailsPage.currentStation),$("#StationDetails_reportPricesDiv").css({visibility:"visible"}),GB_StationFeaturesPage.stationDetails=GB_StationDetailsPage.features,GB_StationDetailsPage.buildFeatures()):(alert(GB_GLOBAL.unknownErrorMsg),window.location="/touch/")},clear:function(){GB_GLOBAL.animateCloseMenu(GB_StationDetailsPage.menuId);this.autoFillReg=!1;this.autoFillMid=!1;this.autoFillPrem=!1;this.autoFillDiesel=!1;$("#StationDetails_loadImage").css({visibility:"visible"});$("#StationDetails_loading").css({display:"block"});$("#StationDetails_reportPricesDiv").css({visibility:"hidden"});$("#StationDetails_stationName").html("");$("#StationDetails_stationAddress").html("");$("#StationDetails_cityState").html("");$("#StationDetails_postalCode").html("");$("#StationDetails_phoneNumber").html("");$("#cash_toggle_span").css({visibility:"hidden"});jQuery.isEmptyObject(this.marker)||this.map.removeLayer(this.marker);$("#StationDetails_mapCanvas").remove();$("#StationFeatures_grid").html("")},openReportPricesDialog:function(){GB_GLOBAL.reportPriceDialog.load(GB_StationDetailsPage.currentStation,GB_StationDetailsPage.prices,GB_StationDetailsPage.priceValidation,window.location.hash)},injectStationInfoHtml:function(n){$("#StationDetails_stationName").html(n.Name);$("#StationDetails_stationAddress").html(GB_Utility.buildFullAddress(n.Address,n.CrossStreet,!n.AtIntersection));$("#StationDetails_cityState").html(n.City+", "+n.State+" "+n.PostalCode);$("#StationDetails_advert").html("")},injectEnterpriseAds:function(n){var u,t;if(n&&n.length>0)for(u=$("#StationDetails_enterprisePromotionsDiv").css("display","block"),t=0;t<n.length;t++){var i=n[t],f=$('<div class="enterprise-ad"><\/div>'),r='<b class="enterprise-ad-title">'+i.Name+'<\/b><img src="'+i.ImageUrl+'"/>';i.ClickUrl&&(r='<a href="'+i.ClickUrl+'">'+r+"<\/a>");f.append(r);u.append(f)}},injectStationPricesHtml:function(n){var t;$(".station_details_prices_wrapper").html("");var i="",r=0,u=$("#StationDetails_cashToggle").prop("checked");if(n.length>0){for(t=0;t<n.length;t++)GB_Utility.mapFuelIdToString(n[t].FuelId)!=="N/A"&&(n[t].PriceTypeId!==1||u||(i+=GB_StationDetailsPage.createPriceHtml(n[t]),r++),n[t].PriceTypeId===2&&u&&(i+=GB_StationDetailsPage.createPriceHtml(n[t]),r++));$(".station_details_prices_wrapper").css({width:r*81+"px"})}else stationPricesHtml+='<div class="station-details-single-price-container">N/A<\/div>',$(".station_details_prices_wrapper").css({width:"81px"});$(".station_details_prices_wrapper").html(i)},createPriceHtml:function(n){var i=new Date,r=i-n.PostedTime,t=Math.floor(r/36e5);return'<div class="station-details-single-price-container"><div class="station-details-price-inner-div data-fuel-id='+n.FuelId+'"><div class="station-details-fuel-type-div">'+GB_Utility.mapFuelIdToString(n.FuelId)+'<\/div><div class="station-details-single-price-div"'+(t>48?' style="padding: 30px 0px;"':"")+">"+(t<48?n.Amount:"--")+'<\/div><div class="text-font-tiny reported-by">'+(t<48?n.Nickname:"")+'<\/div><div class="text-font-tiny">'+(t<48?GB_Utility.formatReportedTime(n.PostedTime):"")+"<\/div><\/div><\/div>"},initSmallStationMap:function(n){var t,i,r;GB_StationDetailsPage.map.setView(new L.LatLng(n.Latitude+.0003,n.Longitude),15,!0);t=L.Icon.extend({iconUrl:"Images/mylocation.png",shadowUrl:"",iconSize:new L.Point(16,16),iconAnchor:new L.Point(8,10),popupAnchor:new L.Point(0,0)});i=new t;GB_StationDetailsPage.marker=new L.Marker(new L.LatLng(n.Latitude,n.Longitude),{icon:i});GB_StationDetailsPage.map.addLayer(this.marker);r=GB_Utility.buildMapMarkerHtml(n.BrandId);GB_StationDetailsPage.marker.bindPopup(r).openPopup()},buildFeatures:function(){for(var t=GB_StationFeaturesPage.stationDetails,i=[],r,n=0;n<t.length;n++)t[n].Available&&(r=t[n].Id,appendFeatureHtml(r,"",i));i.push("<div style='clear:left'; />");$("#StationFeatures_grid").append(i.join(""))}};$("#StationFeatures_page").live("pageshow",function(){_gaq.push(["_trackPageview","/StationFeatures_page"]);jQuery.isEmptyObject(GB_StationFeaturesPage.stationDetails)?$.mobile.changePage($(GB_GLOBAL.stationDetailsPage.pageId),"slide"):(GB_StationFeaturesPage.clear(),GB_StationFeaturesPage.buildUI())});GB_StationFeaturesPage={pageId:"#StationFeatures_page",cookieId:"stationFeatures_cookie",stationDetails:{},load:function(n){GB_StationFeaturesPage.clear();GB_StationFeaturesPage.stationDetails=n;$.mobile.changePage($(this.pageId),"slide")},clear:function(){$("#StationFeatures_grid").html("")},buildUI:function(){var t=GB_StationFeaturesPage.stationDetails,n=[];t.CStore&&appendFeatureHtml("CStore.png","C-Store",n);t.ServiceStation&&appendFeatureHtml("ServiceStation.png","Service Station",n);t.PayAtPump&&appendFeatureHtml("PayAtPump.png","Pay At Pump",n);t.Restaurant&&appendFeatureHtml("Restaurant.png","Restaurant",n);t.Restrooms&&appendFeatureHtml("Restrooms.png","Restrooms",n);t.Air&&appendFeatureHtml("Air.png","Air",n);t.Payphone&&appendFeatureHtml("Payphone.png","Payphone",n);t.ATM&&appendFeatureHtml("ATM.png","ATM",n);t.Open247&&appendFeatureHtml("Open247.png","Open 24/7",n);t.Truckstop&&appendFeatureHtml("Truckstop.png","Truckstop",n);t.Carwash&&appendFeatureHtml("Carwash.png","Carwash",n);t.RegularGas&&appendFeatureHtml("RegularGas.png","Regular Gas",n);t.MidgradeGas&&appendFeatureHtml("MidgradeGas.png","Midgrade Gas",n);t.PremiumGas&&appendFeatureHtml("PremiumGas.png","Premium Gas",n);t.Diesel&&appendFeatureHtml("Diesel.png","Diesel",n);t.E85&&appendFeatureHtml("E85.png","E85",n);t.Propane&&appendFeatureHtml("Propane.png","Propane",n);n.push("<div style='clear:left'; />");$("#StationFeatures_grid").html(n.join(""))}};$("#StationList_page").live("pageshow",function(){_gaq.push(["_trackPageview","/StationList_page"]);try{ll("tagScreen","Station List Page")}catch(i){}if(GB_GLOBAL.closeMenu(GB_StationListPage.menuId),GB_StationListPage.clear(),$.cookie(GB_StationListPage.cookieId)===null||$.cookie(GB_StationListPage.cookieId)==="")window.location="/touch/";else{var t=decodeURIComponent($.cookie(GB_StationListPage.cookieId)),n=JSON.parse(t);GB_GLOBAL.searchTerms=n.searchTerms;n.nearMeFlag?(GB_StationListPage.sortedByDistance=!0,GB_StationListPage.sortedByPrice=!1):(GB_StationListPage.sortedByPrice=!0,GB_StationListPage.sortedByDistance=!1);GB_GLOBAL.fuelType===""&&(GB_GLOBAL.fuelType=GB_GLOBAL.getFuelType());GB_StationListPage.listFuelType===""&&(GB_StationListPage.listFuelType=GB_GLOBAL.fuelType);console.log();GasBuddyTouch._Default.AjaxLoadStationsV2(n.searchTerms,GB_StationListPage.listFuelType,n.userLat,n.userLong,n.nearMeFlag,GB_StationListPage.load_callback)}});GB_StationListPage={pageId:"#StationList_page",headerId:"StationList_header",menuId:"#StationList_menu",cookieId:"stationList_cookie",sortedByPrice:!1,sortedByDistance:!1,resortedByPrice:!1,resortedByDistance:!1,stationCollection:{},distanceFormat:"",listFuelType:"",sortByDistanceFlag:!0,init:function(){$("#StationList_fuelSelect").change(function(){var n=$("#StationList_fuelSelect option:selected").val();GB_StationListPage.listFuelType=n;GB_StationListPage.refreshStations(GB_StationListPage.listFuelType)});$("#StationList_sortButton").click(function(){GB_StationListPage.sortStations()});$("#StationList_refreshButton").click(function(){GB_StationListPage.refreshStations(GB_StationListPage.listFuelType)})},load:function(n,t,i){var r,u;GB_StationListPage.clear();GB_StationListPage.listFuelType=GB_GLOBAL.fuelType;r="";i||(r=GB_GLOBAL.searchTerms);u={searchTerms:r,userLat:n,userLong:t,nearMeFlag:i};GB_GLOBAL.populateData(GB_StationListPage.cookieId,u);$.mobile.changePage($(GB_GLOBAL.stationListPage.pageId),{transition:"slidefade"})},load_callback:function(n){if(n&&n.value)if(spitItAllOut&&console.log(n),n.value.ResponseCode===0)alert(n.value.ResponseMessage),window.location="/touch/";else{GB_StationListPage.stationCollection=n.value.Payload.StationWithPriceList;GB_StationListPage.distanceFormat=n.value.Payload.DistanceFormat;var t=GB_StationListPage.stationCollection[0].Station.City+", "+GB_StationListPage.stationCollection[0].Station.State;GB_StationListPage.buildUI(GB_StationListPage.stationCollection)}else alert(GB_GLOBAL.unknownErrorMsg),window.location="/touch/"},clear:function(){if($("#StationList_listView").html(""),$("#StationList_loading").css({display:"block"}),$("#StationList_loadImage").css({visibility:"visible"}),$("#form1").hasClass("ui-mobile-viewport-transitioning"))try{$("#form1").removeClass("ui-mobile-viewport-transitioning viewport-fade viewport-slidefade")}catch(n){}},buildUI:function(n){var i=n[0].CurrentPrice.FuelId,t;GB_StationListPage.sortedByDistance?(GB_StationListPage.sortByDistanceFlag=!0,$("#StationList_sortButton").val("price")):(GB_StationListPage.sortByDistanceFlag=!1,$("#StationList_sortButton").val("distance"));$("#StationList_sortButton").button("refresh");i&&GB_StationListPage.syncFuelSelect(i);$("#StationList_loadImage").css({visibility:"hidden"});$("#StationList_loading").css({display:"none"});t=[];GB_StationListPage.stationCollection.length<20?$(GB_StationListPage.stationCollection).each(function(n){t.push(GB_StationListPage.buildStationListCellHtml(this));n<GB_StationListPage.stationCollection.length-1&&(n===2?t.push("<div class=\"\" style=\"text-align:center; border-bottom: 1px solid #b3b3b3;\"><div id='div-gpt-ad-1475878961215-0' style='margin: 0 auto;'><script>googletag.cmd.push(function () { googletag.display('div-gpt-ad-1475878961215-0'); googletag.pubads().refresh([mainAd[0]]); });<\/script><\/div><\/div>"):n===5?t.push("<div class=\"\" style=\"text-align:center; border-bottom: 1px solid #b3b3b3;\"><div id='div-gpt-ad-1475878961215-3' style='margin: 0 auto;'><script>googletag.cmd.push(function () { googletag.display('div-gpt-ad-1475878961215-3'); googletag.pubads().refresh([mainAd[1]]); });<\/script><\/div><\/div>"):n===8?t.push("<div class=\"\" style=\"text-align:center; border-bottom: 1px solid #b3b3b3;\"><div id='div-gpt-ad-1475878961215-4' style='margin: 0 auto;'><script>googletag.cmd.push(function () { googletag.display('div-gpt-ad-1475878961215-4'); googletag.pubads().refresh([mainAd[2]]); });<\/script><\/div><\/div>"):n===11&&t.push("<div class=\"\" style=\"text-align:center; border-bottom: 1px solid #b3b3b3;\"><div id='div-gpt-ad-1475878961215-5' style='margin: 0 auto;'><script>googletag.cmd.push(function () { googletag.display('div-gpt-ad-1475878961215-5'); googletag.pubads().refresh([mainAd[3]]); });<\/script><\/div><\/div>"))}):$(GB_StationListPage.stationCollection).each(function(n){t.push(GB_StationListPage.buildStationListCellHtml(this));n<GB_StationListPage.stationCollection.length-1&&(n===3?t.push("<div class=\"\" style=\"text-align:center; border-bottom: 1px solid #b3b3b3;\"><div id='div-gpt-ad-1475878961215-0' style='margin: 0 auto;'><script>googletag.cmd.push(function () { googletag.display('div-gpt-ad-1475878961215-0'); googletag.pubads().refresh([mainAd[0]]); });<\/script><\/div><\/div>"):n===7?t.push("<div class=\"\" style=\"text-align:center; border-bottom: 1px solid #b3b3b3;\"><div id='div-gpt-ad-1475878961215-3' style='margin: 0 auto;'><script>googletag.cmd.push(function () { googletag.display('div-gpt-ad-1475878961215-3'); googletag.pubads().refresh([mainAd[1]]); });<\/script><\/div><\/div>"):n===11?t.push("<div class=\"\" style=\"text-align:center; border-bottom: 1px solid #b3b3b3;\"><div id='div-gpt-ad-1475878961215-4' style='margin: 0 auto;'><script>googletag.cmd.push(function () { googletag.display('div-gpt-ad-1475878961215-4'); googletag.pubads().refresh([mainAd[2]]); });<\/script><\/div><\/div>"):n===15&&t.push("<div class=\"\" style=\"text-align:center; border-bottom: 1px solid #b3b3b3;\"><div id='div-gpt-ad-1475878961215-5' style='margin: 0 auto;'><script>googletag.cmd.push(function () { googletag.display('div-gpt-ad-1475878961215-5'); googletag.pubads().refresh([mainAd[3]]); });<\/script><\/div><\/div>"))});$("#StationList_listView").append(t.join(""));googletag.cmd.push(function(){googletag.pubads().refresh([homeFooter])});GB_StationListPage.resortedByDistance=!1;GB_StationListPage.resortedByPrice=!1},buildStationListCellHtml:function(n){var t=[];return t.push('<div class="cell div-border-color">'),t.push(GB_StationListPage.buildStationListPriceCellHtml(n)),t.push(GB_StationListPage.buildStationListDetailsCellHtml(n)),t.push('<div class="cl"><\/div>'),t.push("<\/div>"),t.join("")},buildStationListPriceCellHtml:function(n){var t=[];return t.push('<div class="price-cell" onclick="GB_StationListPage.openPriceReportDialog('),t.push(n.Station.Id),t.push(')">'),t.push('<div class="price-cell-position">'),t.push('<div class="station-price-cell">'),t.push(GB_StationListPage.buildStationPrice(n)),t.push("<\/div>"),t.push('<div class="station-price-time font-small">'),n.CurrentPrice!==null&&n.CurrentPrice.Amount!==0&&t.push(GB_Utility.formatReportedTime(n.CurrentPrice.PostedTime)),t.push("<\/div>"),t.push('<div class="station-tap-hint font-small">'),t.push("Tap to Update"),t.push("<\/div>"),t.push("<\/div>"),t.push("<\/div>"),t.join("")},buildStationListDetailsCellHtml:function(n){var t=[];return t.push('<div class="station-details-cell" onclick="GB_StationListPage.openStationDetails('),t.push(n.Station.Id),t.push(');">'),t.push('<div class="station-details-cell-padding div-border-color">'),t.push('<div class="station-name-cell div-border-color">'),t.push('<div class="station-name-with-icon" '),t.push('style="background-image: url('),t.push(GB_Utility.buildStationLogoUrl(n.Station.BrandId)),t.push(');" >'),t.push(n.Station.Name),t.push("<\/div>"),t.push('<div class="station-distance-cell font-small">'),t.push('<div class="station-distance-text-div">'),t.push(GB_Utility.getDistanceFromStationUsingDistanceFormat(n.Distance,GB_StationListPage.distanceFormat)),t.push("<\/div>"),t.push("<\/div>"),t.push('<div class="cb"><\/div>'),t.push("<\/div>"),t.push('<div class="station-address-cell font-regular">'),t.push(GB_Utility.buildFullAddress(n.Station.Address,n.Station.CrossStreet,n.Station.AtIntersection)),t.push("<\/div>"),t.push('<div class="station-city-state-div font-small">'),t.push(n.Station.City),t.push(", "),t.push(n.Station.State),t.push("<\/div>"),t.push("<\/div>"),t.push("<\/div>"),t.join("")},buildStationPrice:function(n){return n.CurrentPrice===null||n.CurrentPrice.Amount===0?"--":n.CurrentPrice.Amount},refreshStations:function(n){var t,i,r;this.clear();t=!1;GB_GLOBAL.animateCloseMenu(this.menuId);i=0;r=0;GB_GLOBAL.geoHandler.position.coords&&(i=GB_GLOBAL.geoHandler.position.coords.latitude,r=GB_GLOBAL.geoHandler.position.coords.longitude);GB_GLOBAL.searchTerms===""&&(t=!0);t?(GB_StationListPage.sortedByDistance=!0,GB_StationListPage.sortedByPrice=!1):(GB_StationListPage.sortedByPrice=!0,GB_StationListPage.sortedByDistance=!1);GasBuddyTouch._Default.AjaxLoadStationsV2(GB_GLOBAL.searchTerms,n,i,r,t,this.load_callback)},stationListRefresh_callback:function(n){n&&n.value&&(spitItAllOut&&console.log(n),GB_StationListPage.load(n.value.Payload.StationWithPriceList,null))},sortStations:function(){GB_StationListPage.sortedByDistance?(GB_StationListPage.sortByPrice(),GB_StationListPage.sortedByDistance=!1,GB_StationListPage.sortedByPrice=!0):GB_StationListPage.stationCollection[0].Distance===0?alert("We couldn't find your location. Try a refresh!"):(GB_StationListPage.sortByDistance(),GB_StationListPage.sortedByPrice=!1,GB_StationListPage.sortedByDistance=!0);this.clear();$("#StationList_sortButton").button("refresh");this.buildUI(GB_StationListPage.stationCollection)},sortByDistance:function(){GB_StationListPage.stationCollection.sort(function(n,t){return n.Distance-t.Distance})},sortByPrice:function(){var n=[],t=[];$(GB_StationListPage.stationCollection).each(function(){this.CurrentPrice===null||this.CurrentPrice.Amount===0?t.push(this):n.push(this)});n.sort(function(n,t){return n.CurrentPrice.Amount-t.CurrentPrice.Amount});jQuery.merge(n,t);GB_StationListPage.stationCollection=n},openStationDetails:function(n){GB_GLOBAL.stationDetailsPage.load(parseInt(n))},openPriceReportDialog:function(n){GB_GLOBAL.isLoggedIn()==="False"?(GB_GLOBAL.memberLoginPage.setLoginPrompt("You must be logged in to post prices.",GB_ReportPriceDialog,n),$.mobile.changePage($(GB_GLOBAL.memberLoginPage.pageId),"slide")):GB_GLOBAL.reportPriceDialog.load(n,null,null,window.location.hash)},syncFuelSelect:function(n){n==="A"||n===1?$("#StationList_fuelSelect").prop("selectedIndex",0):n==="B"||n===2?$("#StationList_fuelSelect").prop("selectedIndex",1):n==="C"||n===3?$("#StationList_fuelSelect"||n==5).prop("selectedIndex",2):(n==="D"||n===4)&&$("#StationList_fuelSelect").prop("selectedIndex",3);$("#StationList_fuelSelect").selectmenu("refresh",!0)},initAdUnit:function(n){var t={pubId:GB_Utility.getAdPubId(),query:n,channel:GB_Utility.getDomainSite(),adstyle:"hm"};new google.ads.search.Ads(t,{container:"StationList_adUnit",number:"1",lines:"2",fontSizeTitle:"12px",fontSizeDescription:"10px",fontSizeDomainLink:"10px"})}};$("#StationMapInfo_page").live("pageshow",function(){_gaq.push(["_trackPageview","/StationMapInfo_page"]);try{ll("tagScreen","Station Map Info Page")}catch(n){}jQuery.isEmptyObject(GB_StationMapInfoPage.stationDetails)?$.mobile.changePage($(GB_GLOBAL.stationDetailsPage.pageId),"slide"):(jQuery.isEmptyObject(GB_StationMapInfoPage.map)&&(GB_StationMapInfoPage.map=new L.Map("StationMapInfo_mapCanvas"),GB_StationMapInfoPage.tileInfo=new L.TileLayer("https://a.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:"© OpenStreetMap contributors, CC BY-SA",maxZoom:18})),GB_StationMapInfoPage.initStationMap())});GB_StationMapInfoPage={pageId:"#StationMapInfo_page",map:{},tileInfo:{},stationDetails:{},userMarker:{},init:function(){$("#StationMapInfo_locateButton").click(function(){GB_StationMapInfoPage.locateUser()});$("#station_map_back_button_container").click(function(){$.mobile.changePage($(GB_GLOBAL.stationDetailsPage.pageId),{transition:"slidefade"})})},load:function(n){GB_StationMapInfoPage.clear();this.stationDetails=n;$.mobile.changePage($(this.pageId),"slide");GB_StationMapInfoPage.injectStationInfoHtml()},clear:function(){$("#StationMap_stationName").html("");$("#StationMap_stationAddress").html("");$("#StationMap_cityState").html("");$("#StationDetails_advert").html("")},initStationMap:function(){var i=new L.LatLng(GB_StationMapInfoPage.stationDetails.Latitude,GB_StationMapInfoPage.stationDetails.Longitude),r=new L.LatLng(GB_StationMapInfoPage.stationDetails.Latitude,GB_StationMapInfoPage.stationDetails.Longitude),t;GB_StationMapInfoPage.map.setView(r,15).addLayer(GB_StationMapInfoPage.tileInfo);var u=L.Icon.extend({iconUrl:"Images/mylocation.png",shadowUrl:"",iconSize:new L.Point(16,16),iconAnchor:new L.Point(8,10),popupAnchor:new L.Point(0,0)}),f=new u,n=new L.Marker(i,{icon:f});GB_StationMapInfoPage.map.addLayer(n);t=GB_Utility.buildMapMarkerHtml(GB_StationMapInfoPage.stationDetails.BrandId);n.bindPopup(t).openPopup()},injectStationInfoHtml:function(){var n=GB_StationMapInfoPage.stationDetails;$("#StationMap_stationName").html(n.Name);$("#StationMap_stationAddress").html(GB_Utility.buildFullAddress(n.Address,n.CrossStreet,n.NotAtIntersection));$("#StationMap_cityState").html(n.City+", "+n.State+" "+n.PostalCode);$("#StationMap_advert").html("")},locateUser:function(){var t,i,n;jQuery.isEmptyObject(GB_StationMapInfoPage.userMarker)||GB_StationMapInfoPage.map.removeLayer(GB_StationMapInfoPage.userMarker);t=0;i=0;GB_GLOBAL.geoHandler.position.coords?(n=new L.LatLng(GB_GLOBAL.geoHandler.position.coords.latitude,GB_GLOBAL.geoHandler.position.coords.longitude),GB_StationMapInfoPage.map.setView(n,15).addLayer(GB_StationMapInfoPage.tileInfo),GB_StationMapInfoPage.userMarker=new L.Marker(n),GB_StationMapInfoPage.map.addLayer(GB_StationMapInfoPage.userMarker)):GB_GLOBAL.displayToastMessage("Sorry, but we can't find you right now.")}};$("#StationPhoto_dialog").live("pageshow",function(){_gaq.push(["_trackPageview","/StationPhoto_dialog"]);GB_StationPhotoDialog.clear();GB_StationPhotoDialog.buildUI()});GB_StationPhotoDialog={pageId:"#StationPhoto_dialog",stationPhotoPath:"",stationCaption:"",init:function(){$("#StationPhoto_dialog").click(function(){return window.history.back(),!1})},load:function(n,t){GB_StationPhotoDialog.clear();GB_StationPhotoDialog.stationPhotoPath=n;GB_StationPhotoDialog.stationCaption=t;$.mobile.changePage($(this.pageId),"slide")},clear:function(){$("#StationPhoto_imageDiv").html("");$("#StationPhoto_caption").html("")},buildUI:function(){var n=[];n.push('<img class="station-photo-image" src="');n.push(GB_StationPhotoDialog.stationPhotoPath);n.push('" />');$("#StationPhoto_imageDiv").append(n.join(""));$("#StationPhoto_caption").html(GB_StationPhotoDialog.stationCaption)}};$("#StationPhotos_page").live("pageshow",function(){_gaq.push(["_trackPageview","/StationPhotos_page"]);jQuery.isEmptyObject(GB_StationPhotosPage.stationPhotoCollection)?$.mobile.changePage($(GB_GLOBAL.stationDetailsPage.pageId),"slide"):(GB_StationPhotosPage.clear(),GB_StationPhotosPage.buildUI())});GB_StationPhotosPage={pageId:"#StationPhotos_page",stationPhotoCollection:{},init:function(){},load:function(n){GB_StationPhotosPage.stationPhotoCollection=n.StationPhotos;GB_StationPhotosPage.clear();$.mobile.changePage($(this.pageId),"slide")},clear:function(){$("#StationPhotos_grid").html("")},buildUI:function(){var t=GB_StationPhotosPage.stationPhotoCollection,n=[];t.length==0&&(n.push("<div>"),n.push("There are currently no photos to display."),n.push("<\/div>"));$(t).each(function(){GB_StationPhotosPage.appendPhotoHtml(this.SmallPath,this.PhotoId,n)});n.push("<div style='clear:left'; />");$("#StationPhotos_grid").append(n.join(""))},appendPhotoHtml:function(n,t,i){i.push('<div class="photo-grid-item" onclick="GB_StationPhotosPage.openPhotoDialog(');i.push(t);i.push(')" >');i.push('<img src="');i.push(n);i.push('" />');i.push("<\/div>")},openPhotoDialog:function(n){$(GB_StationPhotosPage.stationPhotoCollection).each(function(){this.PhotoId==n&&GB_GLOBAL.stationPhotoDialog.load(this.MediumPath,this.Caption)})}};$("#Tickets_page").live("pageshow",function(){_gaq.push(["_trackPageview","/Tickets_page"]);try{ll("tagScreen","Members Ticket Page")}catch(n){}GB_TicketsPage.clear();GB_GLOBAL.isLoggedIn()==="False"?window.location="/touch/":GasBuddyTouch._Default.AjaxLoadTickets2(GB_TicketsPage.load_callback)});GB_TicketsPage={pageId:"#Tickets_page",memberPrizeDrawCollection:{},init:function(){$("#tickets_back_button_container").click(function(){$.mobile.changePage($(GB_GLOBAL.memberPage.pageId),"slide")})},load:function(){$.mobile.changePage($(this.pageId),"slide")},load_callback:function(n){if(n&&n.value){spitItAllOut&&console.log(n);$("#Tickets_loadImage").css({visibility:"hidden"});$("#Tickets_loading").css({display:"none"});var t=n.value;if(t.ResponseCode===0)return alert(t.ResponseMessage),window.history.back(),!1;try{ll("tagEvent","Entered Prize Draw")}catch(i){}GB_TicketsPage.memberPrizeDrawCollection=t.Payload;GB_TicketsPage.injectPrizeAmountHtml(t.Payload.Strings);GB_TicketsPage.injectEndDateHtml(t.Payload.Strings);GB_TicketsPage.injectEntryHtml(t.Payload.Strings);GB_TicketsPage.injectGetTicketsHtml(t.Payload)}else alert(GB_GLOBAL.unknownErrorMsg),window.location="/touch/"},clear:function(){$("#Tickets_loadImage").css({visibility:"visible"});$("#Tickets_loading").css({display:"inline"});$("#Tickets_prizeAmountDiv").html("");$("#Tickets_endDateDiv").html("");$("#Tickets_entryDiv").html("");$("#Tickets_getTicketsDiv").html("")},injectPrizeAmountHtml:function(n){var t=[];t.push("<h3>");t.push(n[1]);t.push("<\/h3>");$("#Tickets_prizeAmountDiv").append(t.join(""))},injectEndDateHtml:function(n){var t=[];t.push(n[2]);$("#Tickets_endDateDiv").append(t.join(""))},injectEntryHtml:function(n){var t=[];t.push(n[4]);$("#Tickets_entryDiv").append(t.join(""))},injectGetTicketsHtml:function(n){var t=[];t.push('<div id="Tickets_getTicketsGroup" class="tickets-container">');n.TicketsAvailable>0&&t.push('<input type="button" id="Tickets_getOneButton" class="ticket-button" onclick="GB_TicketsPage.openPrizeEntryForm(1)"  value="Get 1 Entry" />');n.TicketsAvailable>1&&t.push('<input type="button" id="Tickets_getTwoButton" class="ticket-button" onclick="GB_TicketsPage.openPrizeEntryForm(2)"  value="Get 2 Entries" />');n.TicketsAvailable>2&&t.push('<input type="button" id="Tickets_getThreeButton" class="ticket-button" onclick="GB_TicketsPage.openPrizeEntryForm(3)"  value="Get 3 Entries" />');n.TicketsAvailable>3&&(t.push('<input type="button" id="Tickets_getAllButton" class="ticket-button" value="Get '),t.push(n.TicketsAvailable),t.push(' Entries" '),t.push('onclick="GB_TicketsPage.openPrizeEntryForm('),t.push(n.TicketsAvailable),t.push(')" />'));t.push("<\/div>");$("#Tickets_getTicketsDiv").append(t.join("")).trigger("create")},openPrizeEntryForm:function(n){GB_GLOBAL.prizeEntryFormDialog.load(this.memberPrizeDrawCollection.MemberInfo,n)}};GB_GLOBAL.homePage=GB_HomePage;GB_GLOBAL.stationListPage=GB_StationListPage;GB_GLOBAL.stationDetailsPage=GB_StationDetailsPage;GB_GLOBAL.stationFeaturesPage=GB_StationFeaturesPage;GB_GLOBAL.stationPhotosPage=GB_StationPhotosPage;GB_GLOBAL.settingsPage=GB_SettingsPage;GB_GLOBAL.memberLoginPage=GB_MemberLoginPage;GB_GLOBAL.memberPage=GB_MemberPage;GB_GLOBAL.memberAwardsPage=GB_MemberAwardsPage;GB_GLOBAL.awardDetailsPage=GB_AwardDetailsPage;GB_GLOBAL.ticketsPage=GB_TicketsPage;GB_GLOBAL.prizeInfoPage=GB_PrizeInfoPage;GB_GLOBAL.registerPage=GB_RegisterPage;GB_GLOBAL.reportPriceDialog=GB_ReportPriceDialog;GB_GLOBAL.prizeEntryFormDialog=GB_PrizeEntryFormDialog;GB_GLOBAL.feedbackDialog=GB_FeedbackDialog;GB_GLOBAL.stationPhotoDialog=GB_StationPhotoDialog;GB_GLOBAL.stationMapInfoPage=GB_StationMapInfoPage;GB_GLOBAL.prevPageId="";GB_GLOBAL.init=function(){GB_GLOBAL.homePage.init();GB_GLOBAL.settingsPage.init();GB_GLOBAL.stationListPage.init();GB_GLOBAL.stationDetailsPage.init();GB_GLOBAL.stationPhotosPage.init();GB_GLOBAL.memberLoginPage.init();GB_GLOBAL.memberPage.init();GB_GLOBAL.memberAwardsPage.init();GB_GLOBAL.awardDetailsPage.init();GB_GLOBAL.ticketsPage.init();GB_GLOBAL.prizeInfoPage.init();GB_GLOBAL.prizeEntryFormDialog.init();GB_GLOBAL.registerPage.init();GB_GLOBAL.reportPriceDialog.init();GB_GLOBAL.feedbackDialog.init();GB_GLOBAL.stationPhotoDialog.init();GB_GLOBAL.stationMapInfoPage.init();$(".header-gb-logo").click(function(){window.location="/touch/"});$("input").click(function(n){n.stopPropagation()});$(".gbt-header-menu-button").click(function(){var n="#"+$(this).attr("menu-id");GB_GLOBAL.menuIsOpen?GB_GLOBAL.animateCloseMenu(n):GB_GLOBAL.animateOpenMenu(n)});$(".gbt-menu-button").click(function(){var n="#"+$(this).attr("menu-id");GB_GLOBAL.animateCloseMenu(n)});$("#Toast_banner").click(function(){GB_GLOBAL.forceCloseToast()})};$(document).ready(function(){if(GB_GLOBAL.searchTerms="",GB_GLOBAL.fuelType=GB_GLOBAL.getFuelType(),GB_GLOBAL.userId="",GB_GLOBAL.authId=0,GB_GLOBAL.geoHandler=new Geo,navigator.geolocation){GB_GLOBAL.geoHandler.getLocation();var n=window.setInterval(GB_GLOBAL.geoHandler.getLocation,1e4)}GB_GLOBAL.init()});_this={};Geo.prototype.successCallback=function(n){this.position=n;this.status="Geolocation working.";GB_GLOBAL.displayLocation()};Geo.prototype.errorCallback=function(){this.status="Geolocation error.";GB_GLOBAL.displayLocation()};Geo.prototype.start=function(){this.status="Geolocation starting.";typeof navigator.geolocation.watchPosition!="undefined"&&navigator.geolocation.watchPosition!=null?this.watchId=navigator.geolocation.watchPosition(function(n){_this.successCallback(n)},function(n){_this.errorCallback(n)},this.options):this.status("Geolocation unavailable on this device")};Geo.prototype.getLocation=function(){navigator.geolocation.getCurrentPosition(function(n){_this.successCallback(n)},function(n){_this.errorCallback(n)},this.options)};Geo.prototype.stop=function(){navigator.geolocation.clearWatch(this.watchId)};Geo.prototype.OutputPosition=function(){var n=[],t={};t=this.position;n.push("lat: "+t.coords.latitude);n.push("long: "+t.coords.longitude);n.push(Date());n.push(this.status)};GB_Utility={formatReportedTime:function(n){var u=new Date,e=0,f=0,t=0,i=0,r=0;return(e=u.getTime()-n.getTime(),r=e/1e3,i=r/60,t=i/60,f=t/24,r<0)?"moments ago":r<60?r.toFixed(0).toString()+" secs ago":i<60?i.toFixed(0).toString()+(i==1?" min":" mins")+" ago":t<24?u.getDay()==n.getDay()?t.toFixed(0).toString()+(t==1?" hour":" hours")+" ago":"yesterday":t<=48?t-u.getHours()<=24?"yesterday":f.toFixed(0).toString()+" days ago":t>48?f.toFixed(0).toString()+" days ago":void 0},mapFuelIdToString:function(n){return n==1?"Regular":n==2?"Midgrade":n==3?"Premium":n==4?"Diesel":n==10?"E85":"N/A"},containsCash:function(n){if(n.length==0)return!1;for(var t=0;t<n.length;t++)if(n[t].PriceTypeId==2)return!0;return!1},containsFuelId:function(n,t){if(n.length==0)return!1;for(var i=0;i<n.length;i++)if(n[i].FuelId==t)return!0;return!1},containsFuelAndPriceId:function(n,t,i){if(n.length==0)return!1;for(var r=0;r<n.length;r++)if(n[r].FuelId==t&&n[r].PriceTypeId==i)return!0;return!1},getPrice:function(n,t,i){if(n.length==0)return!1;for(var r=0;r<n.length;r++)if(n[r].FuelId==t&&n[r].PriceTypeId==i)return n[r];return!1},getPriceByFuelType:function(n,t){if(n.length==0)return!1;for(var i=0;i<n.length;i++)if(n[i].FuelType==t)return n[i];return!1},buildPriceHtml:function(n,t,i){var r=GB_Utility.getPrice(n,t,i),u=new Date,f=u-r.PostedTime,e=Math.floor(f/36e5);return""+('<div id="ReportPrice_'+GB_Utility.mapFuelIdToString(t)+'Div" class="report-price-container"><div class="ui-grid-b"><div class="ui-block-a" style="text-align: center"><div class="report-price-input-div"><input class="price-input" type="tel" placeholder="'+(i==1?"Credit":"Cash")+' Price" onkeyup="GB_ReportPriceDialog.formatText(this)" data-fuel-id="'+r.FuelId+'"  data-price-id="'+r.PriceTypeId+'"/><\/div><\/div><div class="ui-block-b" style="text-align: center"><div class="price-button"style="text-align:center"><a href="" data-role="button" class="report-price-a-button"><div class="price-confirm" style="color: #0097A9; padding: 10px 0px; text-align: right;" data-fuel-id="'+r.FuelId+'" data-price-id="'+r.PriceTypeId+'" data-value="'+r.Amount+'">'+(e<48?"Confirm "+GB_Utility.buildPrice(r.Amount):"")+"<\/div><\/a><\/div><\/div><\/div><\/div>")},buildFullAddress:function(n,t,i){var r="";return r=i?" near ":" & ",t!=""?n+r+t:n},buildStationLogoUrl:function(n){var t=[];return t.push("https://images.gasbuddy.com/b/1/"),t.push(n.toString()),t.push("/wp/logo.png"),t.join("")},getDistanceFromStation:function(n,t){var i=GB_GLOBAL.geoHandler.position;return!i.coords||n<=0?"":t=="CAN"?(n*1.6).toFixed(2)+" km":n.toFixed(2)+" miles"},getDistanceFromStationUsingDistanceFormat:function(n,t){return n<=0?"":t===2?n.toFixed(2).toString()+" km":n.toFixed(2).toString()+" miles"},buildPrice:function(n){return n==""||n=="0"?"--":n},isValidUsername:function(n){var t=n.match(/[^A-Za-z0-9_]+/i);return jQuery.isEmptyObject(t)?!0:!1},isValidEmail:function(n){if(n.search(",")!=-1)return!1;var t=n.match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/);return jQuery.isEmptyObject(t)?!1:!0},containsZipCode:function(n){var t=n.match(/^([0-9]{5})(?:[-\s]*([0-9]{4}))?$/);return jQuery.isEmptyObject(t)?!1:!0},containsPostalCode:function(n){var t=n.match(/^([A-Z][0-9][A-Z])\s*([0-9][A-Z][0-9])$/i);return jQuery.isEmptyObject(t)?!1:!0},buildMapMarkerHtml:function(n){var t=[];return t.push('<div class="gbt-station-map-popup" style="background-image: url('),t.push(GB_Utility.buildStationLogoUrl(n)),t.push(');">'),t.push("<\/div>"),t.join("")},boom:function(){alert("BOOM!")},getDomainSite:function(){var n=window.location.href,t=n.indexOf("gasbuddy.com");if(t>=0)return"gasbuddy";var i=n.indexOf("m."),r=n.indexOf("gasprices.com");return n.substring(i+2,r)},getAdPubId:function(){return"pub-9634286501775085"}}