$(function(){
  $("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)  
  $("ul#nav > li").hover(function() { //When trigger is hovered...  
    if($(this).find('ul').length > 0){
      //Following events are applied to the subnav itself (moving subnav up and down)  
      $(this).find("ul.subnav").show(); //Drop down the subnav on click  
      $(this).addClass("subhover"); //On hover over, add class "subhover"  
    }
  }, function(){  //On Hover Out  
    if($(this).find('ul').length > 0){
      $(this).removeClass("subhover"); //On hover out, remove class "subhover"  
      $(this).find("ul.subnav").hide(); //When the mouse hovers out of the subnav, move it back up  
    }
  });
  
  if($('div#slideshow').length > 0){
    $('div#slideshow > ul').cycle({
      fx: 'fade',
      pause: true,
      next: '#slideshow_next', 
      prev: '#slideshow_prev',
      speed: 500,
      timeout: 5000
    });
  }
  
});
