$(document).ready(function(){

	$('#breadcrumb a:first').addClass('noLeftPad');
	$('.threeCol_left ul li ul').hide();
	$('.threeCol_left ul li.active').children('ul').slideDown();
	$('ul.floorplanAcc li:first').addClass("active");
	$('ul.floorplanAcc li ul:first').slideDown();
	$('.genericMid p:first').addClass("first");
	
	$('.threeCol_left ul li a, ul.floorplanAcc li a').click(function(){ 
		$(this).parent('li').children('ul').slideToggle(); 
		$(this).parent('li').siblings().children('ul:visible').slideUp();
		$(this).parent('li').toggleClass('active'); 
		$(this).parent('li').siblings().removeClass('active'); 
	});

	$('.videoTrigger').click(function(){
		$('.homeVideoPlayer iframe').attr('src', 'http://player.vimeo.com/video/30330672?title=0&amp;byline=0&amp;portrait=0&amp;color=686045&amp;autoplay=1'); 
		$(".homeVideoPlayer").show();
		$("img.videoTrigger").fadeOut();
    	$('.homeFeatureOutWrap').animate({
          height: '563'
        }, 500, function() {
        });
	});

	$('.videoClose').click(function(){
		$('.homeVideoPlayer iframe').attr('src', ''); 
		$(".homeVideoPlayer").hide();
		$("img.videoTrigger").fadeIn();
    	$('.homeFeatureOutWrap').animate({
          height: '400'
        }, 500, function() {
        });
	});

	$('#homeFeatureWrap') 
	.before('<div id="featureNav">') 
	.cycle({ 
	    fx:    		'fade', 
	    speed:		'800', 
	    timeout:	4000, 
	    pager:  	'#featureNav',
	    pause:  	1
	});

	$("ul.floorplanAcc li ul li:nth-child(odd)").addClass('altBk');

	$(".commFooterItem").click(function(){
		 var target = $(this).find("a").attr("target")
		 if (!target)
  	       window.location=$(this).find("a").attr("href");
		 else  
  	       window.open($(this).find("a").attr("href"),'name','');	
	     return false;
	});
	
	$.localScroll();

	$(".videoTestImgWrap a").click(function() {
		$.fancybox({
			'padding'		: 0,
			'opacity'		: true,
			'overlayOpacity': 0.4,
			'overlayColor'	: '#000',
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'elastic',
			'speedIn'		: 300, 
			'speedOut'		: 300, 
			'width'			: 500,
			'height'		: 375,
			'href'			: this.href.replace(new RegExp("([0-9])","i"),'moogaloop.swf?clip_id=$1'),
			'type'			: 'swf'
		});
 
		return false;
	});

	$("a.videoSideModule").click(function() {
		$.fancybox({
			'padding'		: 0,
			'opacity'		: true,
			'overlayOpacity': 0.4,
			'overlayColor'	: '#000',
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'elastic',
			'speedIn'		: 300, 
			'speedOut'		: 300, 
			'width'			: 640,
			'height'		: 360,
			'href'			: this.href.replace(new RegExp("([0-9])","i"),'moogaloop.swf?clip_id=$1'),
			'type'			: 'swf'
		});
 
		return false;
	});
	$("a.anchorLink").anchorAnimate();	
});
