// JavaScript Document
$(document).ready(function(){
var closeAll;
var currentList;
var thisList;
var div;
$('#navigation ul ul').css('opacity', '0.9');


$(".flip").hover(function(){
$currentList = $(this).next('ul');
$div = $(this);
$('div.flip').removeClass('selected');
$div.addClass('selected');

 if ($(this).next('ul .toggle').css('display', 'none')){ 
$('ul .toggle').hide("fast");
$currentList.slideToggle("slow");
}
});

   $('.toggle')
  .mouseleave(function() {
  $div.removeClass('selected');
    closeAll = setTimeout(function() {
      $('.toggle').hide(100);
    }, 200);
  }).mouseenter(function() {
    clearTimeout(closeAll);
  });
  
   $('.flip')
  .mouseleave(function() {
    closeAll = setTimeout(function() {
      $('.toggle').hide(100);
    }, 200);
  }).mouseenter(function() {
    clearTimeout(closeAll);
  });

});
