﻿function updateCounter() {
    PageMethods.odometer_count(GetCountSuccess, GetCountFail);
    setTimeout("updateCounter()", 3000);
}

function GetCountSuccess(result, userContext, methodName) {
    handleCounter(result);
}

function GetCountFail(result, userContext, methodName) {
    //Error silently as showing error only impedes user experience
    //alert("Failed to get latest milage count!");
}

function handleCounter(req) {
    $('#total').hide();
    $('#counter-outer').css('display', 'block');
    $('.counter-wrap .counter-number:first-child').hide();
    loadticker(req);
}

//DOC READY
$(document).ready(function () {

    //Update the odometer counter
    updateCounter();
});
