$(document).ready(function(){

	setInterval( "slideSwitch()", 5000 );


	$(".menuItemTitleHeader").bind("mouseenter",function(){
		$("a:first", this).css({'background-color' : "#008741", "border-left" : "solid 1px white" , "border-right" : "solid 1px white"});
		if ($(this).find("div").children("a").size() > 0)
		{
			$(this).find("div").slideDown();
		}
	});
	$(".menuItemTitleHeader").bind("mouseleave",function(){
		$("a:first", this).css({'background-color' : "", "border-left" : "" , "border-right" : ""});
		if ($(this).find("div").children("a").size() > 0)
		{
			$(this).find("div").stop(true, true);
			$(this).find("div").slideUp();
		}
    });

	$(".menuItemSubHeader a").bind("mouseenter",function(){
		$(this).css({'color' : 'black', "font-style" : "italic"});
	});
	$(".menuItemSubHeader a").bind("mouseleave",function(){
		$(this).css({'color' : "#008741", "font-style" : "normal"});
    });

	$(".menuItemSubFooter a").bind("mouseenter",function(){
		$(this).css({'color' : 'black', "font-style" : "italic"});
	});
	$(".menuItemSubFooter a").bind("mouseleave",function(){
		$(this).css({'color' : "#008741", "font-style" : "normal"});
    });


	$(".menuItemTitleFooter").bind("mouseenter",function(){
		$($(this).children().get(1)).css({"border-left" : "solid 1px #008741" , "border-right" : "solid 1px #008741", "color" : "white", "background-color" : "#008741"});
		if ($(this).find("div").children("a").size() > 0)
		{
			$(this).find("div").stop(true, true);
			$(this).find("div").slideDown();
		}
	});
	$(".menuItemTitleFooter").bind("mouseleave",function(){
		$($(this).children().get(1)).css({'background-color' : "", "border-left" : "" , "border-right" : "", "color" : "#008741", "background-color" : "white" });
		if ($(this).find("div").children("a").size() > 0)
		{
			$(this).find("div").slideUp();
		}
    });

});


function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });


    var $active2 = $('#slideshow2 IMG.active');

    if ( $active2.length == 0 ) $active2 = $('#slideshow2 IMG:last');

    var $next2 =  $active2.next().length ? $active2.next()
        : $('#slideshow2 IMG:first');

    $active2.addClass('last-active');

    $next2.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active2.removeClass('active last-active');
        });
}
