/**
 * @author mosconi
 */
$(document).ready(function(){    
    /* set header and logo to fixed position */
    $("#head, #logo, #corner, #metanav, #ctxtnav, #search, #search-box").addClass("fixed");
        
    /* enable scrolling to correct position for all in-site links */
    $.localScroll({
        lazy: true,
        onBefore: function(e, anchor, $target){
            location.hash = anchor.id;
            if (location.pathname == "/news.html") {
            	off = -10;
            } else {
            	off = 85;
            }
            setTimeout(function(){
                window.scrollTo(0, anchor.offsetTop - off);
            }, 10);
            return false;
        }
    });
});

window.onload = function(){
    /* enable scrolling to correct position for initial URL with hash (#) */
    $.localScroll.hash({
        lazy: true,
        onBefore: function(e, anchor, $target){
            location.hash = anchor.id;
            if (location.pathname == "/news.html") {
            	off = -10;
            } else {
            	off = 85;
            }
            setTimeout(function(){
                window.scrollTo(0, anchor.offsetTop - off);
            }, 10);
            return false;
        }
    });
};
