$(document).ready(function() {
	$('#homepage-slides').flexslider({
		animation: 'slide',              //Select your animation type (fade/slide)
		slideshow: true,                //Should the slider animate automatically by default? (true/false)
		slideshowSpeed: 8000,           //Set the speed of the slideshow cycling, in milliseconds
		animationDuration: 500,         //Set the speed of animations, in milliseconds
		directionNav: true,             //Create navigation for previous/next navigation? (true/false)
		controlNav: false,               //Create navigation for paging control of each clide? (true/false)
		keyboardNav: false,              //Allow for keyboard navigation using left/right keys (true/false)
		touchSwipe: true,               //Touch swipe gestures for left/right slide navigation (true/false)
		prevText: 'Prev',           //Set the text for the 'previous' directionNav item
		nextText: 'Next',               //Set the text for the 'next' directionNav item
		pausePlay: false,               //Create pause/play dynamic element (true/false)
		randomize: false,               //Randomize slide order on page load? (true/false)
		slideToStart: 0,                //The slide that the slider should start on. Array notation (0 = first slide)
		animationLoop: true,            //Should the animation loop? If false, directionNav will received disabled classes when at either end (true/false)
		pauseOnAction: true,            //Pause the slideshow when interacting with control elements, highly recommended. (true/false)
		pauseOnHover: true,            //Pause the slideshow when hovering over slider, then resume when no longer hovering (true/false)
		controlsContainer: ".flexcontrols"          //Advanced property: Can declare which container the navigation elements should be appended too. Default container is the flexSlider element. Example use would be ".flexslider-container", "#container", etc. If the given element is not found, the default action will be taken.
	});
	
	$('#menu-top').superfish({ 
	    hoverClass:    'tophovered',          // the class applied to hovered list items 
	    delay:         100,                // the delay in milliseconds that the mouse can remain outside a submenu without it closing 
	    animation:     {opacity:'show'},   // an object equivalent to first parameter of jQueryÕs .animate() method 
	    speed:         200,           // speed of the animation. Equivalent to second parameter of jQueryÕs .animate() method 
	    autoArrows:    false,               // if true, arrow mark-up generated automatically = cleaner source code at expense of initialisation performance 
	    dropShadows:   false,               // completely disable drop shadows by setting this to false 
	    disableHI:     false,              // set to true to disable hoverIntent detection 
	    onInit:        function(){},       // callback function fires once Superfish is initialised Ð 'this' is the containing ul 
	    onBeforeShow:  function(){},       // callback function fires just before reveal animation begins Ð 'this' is the ul about to open 
	    onShow:        function(){},       // callback function fires once reveal animation completed Ð 'this' is the opened ul 
	    onHide:        function(){}        // callback function fires after a sub-menu has closed Ð 'this' is the ul that just closed 
});
	
	$('#menu-top li a:last').addClass('last-menu-item');
	
	$('#testimonial-widget').css('background','none');
	
	$('#menu-top a').mousedown(function(){
			$(this).css('opacity','0.85');
		}
	).mouseup(function(){
			$(this).css('opacity','1.0');
	});
	
	$('#menu-top li:first').removeClass('current-menu-item');
	
	$('.flexcontrols a, .amazon_scroller_nav li').fadeTo(200, 0.7).hover(function(){
		$(this).stop().fadeTo(200, 1.0);
	}, function(){
		$(this).fadeTo(200, 0.7);	
	});
	
	$("#community-slides").amazon_scroller({
		scroller_title_show: 'disable',
		scroller_time_interval: '10000',
		scroller_window_background_color: 'none',
		scroller_window_padding: 'none',
		scroller_border_size: '0',
		scroller_border_color: '#CCC',
		scroller_images_width: '150',
		scroller_images_height: '112',
		scroller_title_size: '12',
		scroller_title_color: 'black',
		scroller_show_count: '10',
		directory: 'images'
	});
	
	$('#community-slides .thumb-item span').fadeTo(100, 0.6);
	
	$('#community-slides .thumb-item a').hover(function(){
		$('span', this).fadeTo(200, 1.0);
	}, function(){
		$('span', this).fadeTo(200, 0.6);
	});
	
	$('.fancyboxframe').fancybox({
		width : '70%',
		height : '80%',
		autoScale : false,
		scrolling: 'no',
		autoDimensions: true,
		type : 'iframe',
		overlayOpacity: 0.5,
		overlayColor: '#fff',
		transitionIn: 'elastic',
		transitionOut: 'elastic'
	}); 
	
	$('.fancyimg').attr('title','');
	$('#floorplans-tab .fancyimg').attr('rel','floorplans-tab');
	$('#photos-tab .fancyimg').attr('rel','photos-tab');
	
	$('.fancyimg').fancybox({
		overlayOpacity: 0.5,
		overlayColor: '#fff',
		transitionIn: 'elastic',
		transitionOut: 'elastic',
		titleShow: false
	});
	
	$('.widget .current-menu-item').next().addClass('undercurrent');
	$('.widget .current-menu-item:last').prev().addClass('overcurrent');
	
	$('.military-friendly tr:even, body.availability .entry .avail-block:even, .comms-block:odd').addClass('greybg');
	
});
