$(function () {
    var msie6 = $.browser == 'msie' && $.browser.version < 7;

    if (!msie6) {
        if($('div#switch').css('margin-top')){
            var top = $('#switch').offset().top - parseFloat($('#switch').css('margin-top').replace(/auto/, 0));
            $(window).scroll(function (event) {
                  // what the y position of the scroll is
                  var y = $(this).scrollTop();
                  // whether that's below the div
                  if (y >= top) {
                    // if so, ad the fixed class
                    $('#headicon').addClass('hidden');
                    $('#footicon').removeClass('hidden');
                  } else {
                    // otherwise remove it
                    $('#headicon').removeClass('hidden');
                    $('#footicon').addClass('hidden');
                  }
            });
        }
    }
    return;
});
