function slideSwitch()
   {
	  //set active var
      var active = $('#header .slide.active');
      //if active is empty set the first item active
      if ( active.length == 0 )
        active = $('#header .slide:first');
      
      //define next var
      var next =  active.next().length  ?  active.next()  :  $('#header .slide:first');
      
     //set active as last active
      active.addClass('last-active');
      //set next to active
      next.css({opacity: 0.0})
         .addClass('active')
         .animate({opacity: 1.0}, 800, function() {
        	//make ie behave
        	$(this).removeAttr('style');
        	//remove classes from the active
            active.removeClass('active last-active');
         });
   }

   $(document).ready(function(){
	   
	   //run the slider
	   interval = setInterval('slideSwitch()', 4000 );
      $('#menu-main ul li a').mouseenter(function (){
    	  // break out of loop
    	  clearInterval(interval);
    	  
    	  //define id variables
    	  id = $(this).attr('href');
		  currentId = $('.slide.active').attr('id');
    	  
		  
		  //if id is not the same as current active id
    	  if(id != currentId){
    		  //remove last active classes
    		  $('.slide').removeClass('last-active');
    		  //show the hovered slide
    		  $('.slide#' + id).css({opacity: 0.0})
    		  .addClass('active-top')
    		  .animate({opacity: 1.0}, 200, function(){
    			  //remove actives
    			  $('.slide').removeClass('active');
    			  //make ie behave
    			  $(this).removeAttr('style');
    			  //set slide to active
    			  $(this).removeClass('active-top').addClass('active');
    		  });
    	  }
    	  
      }).mouseleave(function(){
    	  //re-initiate the loop from current position
    	  interval = setInterval('slideSwitch()', 4000 );
      });
   });	
