﻿$(document).ready(function() {
	var hover_config = {    
    sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)    
    interval: 100, // number = milliseconds for onMouseOver polling interval    
    over: showSub, // function = onMouseOver callback (REQUIRED)    
    timeout: 600, // number = milliseconds delay before onMouseOut    
    out: hideSub // function = onMouseOut callback (REQUIRED)    
  };

   $('#main-navigation li:not(.active)').hoverIntent( hover_config);
});
function showSub(){
  if (!($(this).parent().hasClass('sub'))) {
      $(this).addClass('hover');
      $('#main-navigation li.active').addClass('inactive-hover');
  } else {
      $(this).parent('li').addClass('hover');
  }
}
function hideSub(){
    if (!($(this).parent().hasClass('sub'))) {
        $(this).removeClass('hover');
        $('#main-navigation li.active').removeClass('inactive-hover');
    } else {
        $(this).parent('li').removeClass('hover');
    }
}
