$(document).ready(function () {
    var openMenu = null;
    $("#primary-nav li").hover(
        function() {
            $(this).addClass('sfhover');
        },
        function() {
            $(this).removeClass('sfhover');
        }
    );
    $("#primary-nav>li").bind('touchstart', function(e) {
        $(this).addClass("sfhover");
        if (openMenu == null) {
            e.preventDefault();
            openMenu = $(this);
        } else if (openMenu.attr('id') != $(this).attr('id')){
            e.preventDefault();
            openMenu.removeClass('sfhover');
            openMenu = $(this);
        }
    });
    if (typeof pageTracker != 'undefined') {
        pageTracker._trackEvent(
            'Browser Dimensions',
            'load',
            $(window).width()
                + 'x'
                + $(window).height(),
            $(window).width()
        );

        $(window).resize(function () {
            if ($(this).data('gatimer')) {
                clearTimeout($(this).data('gatimer'));
                $(this).data('gatimer', null);
            }

            $(this).data(
                'gatimer',
                setTimeout(function () {
                    pageTracker._trackEvent(
                        'Browser Dimensions',
                        'resize',
                        $(window).width()
                            + 'x'
                            + $(window).height(),
                        $(window).width()
                        );
                    },
                    500
                )
            );
        });
    }
});

