// JavaScript Document
function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    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}, 2000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});


$(function() {
	$('.pics img').css({
        opacity: 0
    });
    setTimeout(function() {
        $('#slideshow').cycle({
            random: 1,
            delay:  -9000
        });

	    $('.pics img').css({
	        opacity: 0
	    });
    }, 1000);
});

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


(function ()
{
	var slideSpeedInMs = 300;  /* To make the slide animation faster, decrease this number. To make it go slower, increase it */
	$(document).ready(
		
		function ()
		{
			$("#topnav").find("a").each( function() {
				
				// The position: relative div will allow us to position the hover div appropriately.
				$(this).wrap("<div class='topnavcontainer'></div>");
				
				// "this" points to the anchor. We want to create a clone of this element and add the onhover class
				// (which will modify the background image used and set it to be absolutely positioned)
				var left = $(this).position().left > 0 ?  $(this).position().left : 0; /* IE7 seems to think the first one is -145px... */
				var $onHoverClone = $(this).clone().addClass("onhover").css("left", left);
				
				$(this).parent().hover(
					function() {
						$onHoverClone.slideDown(slideSpeedInMs);
					},	
					function() {
						$onHoverClone.slideUp(slideSpeedInMs);
					}
				);
				
				$onHoverClone.insertBefore(this);
				
			});
			
		} 
	
	);
})();
	






		$(document).ready(function(){	
			$("#slider").easySlider({
				auto: true,
				controlsShow: false,
				speed: 200,
				pause: 10000,
				continuous: true 
			});
		});	






$(document).ready(function() {
  $('div.accordian> div').hide();  
  $('div.accordian> h3').click(function() {
    var $nextDiv = $(this).next();
    var $visibleSiblings = $nextDiv.siblings('div:visible');
 
    if ($visibleSiblings.length ) {
      $visibleSiblings.slideUp('slow', function() {
        $nextDiv.slideToggle('slow');
      });
    } else {
       $nextDiv.slideToggle('slow');
    }
  });
});

$(document).ready(function() {
  $('div.accordian2> div').hide();  
  $('div.accordian2> h3').click(function() {
    var $nextDiv = $(this).next();
    var $visibleSiblings = $nextDiv.siblings('div:visible');
 
    if ($visibleSiblings.length ) {
      $visibleSiblings.slideUp('slow', function() {
        $nextDiv.slideToggle('slow');
      });
    } else {
       $nextDiv.slideToggle('slow');
    }
  });
});


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
