// JavaScript Document
function slideSwitch() {
    var $active = $('#slideshow img.active');
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow img:first');

    if ( $active.length == 0 ) $active = $('#slideshow img:last');

    
    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
    
    setTimeout("slideSwitch2()", 5000);
}

function slideSwitch2() {
    var $active = $('#slideshow2 img.active');
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow2 img:first');

    if ( $active.length == 0 ) $active = $('#slideshow2 img:last');

    
    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
    
    setTimeout("slideSwitch()", 5000);
}

setTimeout("slideSwitch()", 5000);

function slidemenu (){ //slide submenu in #nav menu  
		$("#nav li a").hover(function() { //When trigger is onmouseover...  

		$(this).parent().find("ul.submenu").slideDown(50).show(); //Drop down the subnav on click  

		$(this).parent().hover(function() {  
		}, function(){  
		$(this).parent().find("ul.submenu").slideUp(50); //When the mouse hovers out of the subnav, move it back up  
		});  

		//Following events are applied to the trigger (Hover events for the trigger)  
		}).hover(function() {  
		$(this).addClass("submenu"); //On hover over, add class "subhover"  
		}, function(){  //On Hover Out  
		$(this).removeClass("submenu"); //On hover out, remove class "subhover"  
		});  
}
