$(function(){
	if($('body').hasClass('home')){
		$('.homeSlider .slides').jcarousel({
			scroll:1,
			auto:5,
			wrap:'circular'
		});
		
		$('.specialPeople .person').hover(function(){
			$(this).find('.peoplePopup').show();
		}, function(){
			$('.peoplePopup').hide();
		});
		
		var person = $('.specialPeople .person');
		var highlightPeople = window.setInterval(function(){
			if(!person.filter('.highlight').length){
				person.first().find('.dark').fadeOut(800).parent().addClass('highlight').next().addClass('next');
			} else if (person.filter('.next').length){
				var nextPerson = person.filter('.next');
				nextPerson.find('.dark').fadeOut(800).parent().addClass('highlight').removeClass('next');
				if(nextPerson.next().length){
					nextPerson.next().addClass('next');
				};
			} else {
				clearInterval(highlightPeople);
			};
		}, 2000);
	};
	
	$('.video a:not(".editButton")').colorbox({iframe:true, innerWidth:547, innerHeight:361});
	
	$('.form select').selectbox();
	
	if (window.PIE) {
        $('.form input, .form textarea, .jquery-selectbox, .video, .peoplePopup .peopleContent').each(function() {
            PIE.attach(this);
        });
    }
	
	$('a[href="#COMINGSOON"]').click(function(){
		return false;
	});
	
	$("nav li").hover(function() {
		$dd = $(".dd:eq(0)", this);
		if( $dd.size() )
		{
			$dd.toggle();
			if( $dd.parents(".dd").size()==0 ) $dd.css({
				left: ( $(this).width() - $dd.width() )/2
			})
		}
		$("a:eq(0)", this).toggleClass('hover');
	});
});
