
// SlideShow
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');
		});
}
		
jQuery(document).ready(function(){
	
	$("#navigation a.florida-villa-a").parent().append("<span></span>");
		//Only shows drop down trigger when JS is enabled (adds empty span tag after ul.subnav)

		$("#navigation a.florida-villa-a, #navigation li span").hover(function() { //When trigger is hovered...
		
		//Drop down the subnav on hover
		$(this).parent().find("ul.sub-nav").slideDown('fast').show();

		$(this).parent().hover(function() {
		}, function(){
			//When the mouse hovers out of the subnav, move it back up
			$(this).parent().find("ul.sub-nav").slideUp('slow');
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() {
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});
								
	// General CSS Styling
	// e.g.
	$("#cta-top-right ul li").css("text-shadow","1px 2px 1px #2e2e2e");
	$("#cta-top-right p.headprice").css("text-shadow","1px 2px 1px #2e2e2e");
	//$("li").css("text-shadow","1px 1px 1px #fff");								
	
	// Lightbox
		$(".lightbox").lightbox();
		
	//Slideshow
		setInterval( "slideSwitch()", 3000 );

});
