 $(document).ready(function () {
    
    //if current mid is subitem
    $("ul#subnav li#active").parents(".subbox").fadeIn();    
    // if current mid has subitems 
    $("#mainnav li#active").children(".subbox").fadeIn(); 




    //hover over menuitem
    $('#mainnav ul li').not("li.spacer").not("#subnav > li").not("li#left").not("li#right").hover(function () {    
        $(".subbox").hide();
        $(this).children(".subbox").show();
    });
    

 
    /*    
    var style = 'easeOutSine';		
    var default_left = Math.round($('#mainnav li.active').offset().left - $('#mainnav').offset().left);
    var default_top = '0px';
    var mid = $("li.active").attr("id");

    //right has class active in home, login en contact
    if (mid != 'right') {
         
        //Set the default position and text for the tooltips
        $('#box').css({left: default_left, top: default_top});
    
        //get default submenuitem
        $.get("modules/ajax/loadSubMenu.php", { id: mid },function(data){ 
           if(data != '') {
             $('#box').fadeIn(100);
             $('#box .head').html(data);
           }
        });     
    }  
    
    //if mouse hovers menuitem (except with id spacer)
    $('#mainnav ul li').not("li.spacer").not("li#left").not("li#right").hover(function () {
        mid = $(this).attr('id');
        //alert(mid);
        //get result
        $.get("modules/ajax/loadSubMenu.php", { id: mid },function(data){ 
           
            if(data){
                //show data
                if($('#box').css('display') == 'none') {
                   $('#box').fadeIn(100);  
                }
                $('#box .head').html(data);
            } else {
              //als geen subitems
              $('#box').hide();  
              var bool = false;
            }
        });
        
        //animate
        a = parseInt($(this).offset().left );
        b = parseInt($('#mainnav').offset().left);
        var left = (a - b);
        
        $('#box').stop(false, true).animate({left: left},{duration:500, easing: style});
    });
    
    //if mouse leaves the menu
    $('#mainnav').mouseleave(function () {
        //Set the default position and text for the tooltips
        var current_mid = $("li.active").attr("id");
        
        if (current_mid != 'right') {
            //get default submenuitem
            $.get("modules/ajax/loadSubMenu.php", { id: current_mid },function(data){ 
               if(data) {
                 $('#box').css({'left': default_left, 'top': default_top});
                 if($('#box').css('display') == 'none') {
                   $('#box').fadeIn(100);  
                 }
                 $('#box .head').html(data);
               } else {
                    $('#box').fadeOut(10);  
               }
            }); 
            //animate
            
            $('#box').css({'left': default_left, 'top': default_top});
            $('#box').stop(false, true).animate({'left': default_left},{duration:500, easing: style});
            
        } 
    }); 
    
    
    */
    
    $('#linkedinimg').click(function() {
        $('#linkedinoverlay').fadeIn();
        $('#linkedincontent').fadeIn();
    }); 
    //engels
   
  
    $('#linkedinoverlay').click(function() {
        $('#linkedinoverlay').fadeOut();
        $('#linkedincontent').fadeOut();
    });
    $('#box_closebutton').click(function() {
        $('#linkedinoverlay').fadeOut();
        $('#linkedincontent').fadeOut();
    });
	
    
    
});

