var bodyHeight = $('body').height();    
var footerHeight = $('footer.footer.footer-bottom').height();
var headerHeight = $('header').height();
var windowWidth = $(window).width(); //retrieve current window width
var windowHeight = $(window).height(); //retrieve current window height
var scrollTop  = $(document).scrollTop();



$(document).ready(function(){

    $(window).resize(function(){
        /* resize */
        pageDimensions(); 
    });  
    

});


$(window).on("load", function (e) {
  pageDimensions();
  $('.layout.homepage .list.list-slider').addClass('loaded');
});


/* CORE FUNCTIONS */
function pageDimensions(){
    bodyHeight = $('body').height();    
    footerHeight = $('footer.footer.footer-bottom').height();
    headerHeight = $('header').height();
    windowWidth = $(window).width();
    windowHeight = $(window).height();
    pageMeasurement = windowWidth/windowHeight;
    scrollTop  = $(document).scrollTop();

}
function UtilityHasTouch() {    

    var agent   = navigator.userAgent;

    if ( agent.match(/(iPhone|iPod|iPad|Blackberry|Android)/) ) {
        return true;
    }

    try {
        document.createEvent("TouchEvent");
        return true;
    } catch (e) {
        return false;
    }
}
function getUrlVars() {
    var vars = {};
    var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
        vars[key] = value;
    });
    return vars;
}
function numberWithCommas(x) {
    var parts = x.toString().split(".");
    parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, " ");
    return parts.join(".");
}