function init() {
    $(document).ready(function(){
        createMenu("#nav li a", -5, 0);
        createMenu("#push #contact-menu li a", -20, 0);
        
        $('a[href*=#]').click(function() {
        if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {        
            $target = $('#' + this.hash.slice(1));
        
            if ($target.length) {
                var targetPos = $target.position().left;
                var titlesPos = (targetPos/800)*500;
                $('#titlesslider').animate({left: "-"+titlesPos}, 1000, 'easeOutElastic');
                $('#slider').animate({left: "-"+targetPos}, 600);
                return false;
            }
        }
        });
    });
}

function createMenu(elem, toppos, topback) {
    $(elem).each(function(){
        $(this).hover(
            function(){
             $(this).stop().animate(
                { top: toppos }, {
                    duration: 1000,
                    easing: 'easeOutElastic'
                });
             },
            function(){
             $(this).stop().animate(
                { top: topback }, {
                    duration: 1000,
                    easing: 'easeOutElastic'
                });
             });
     });
}
