$(document).ready(function() {				
							   
			$(".collapseCont").css({"width":"0px"});	
//			$(".collapseCont:first").css({"width":"790px"});	
			$(".collapseCont:first").css({"width":"715px"});	
						
			$("table.tblAlternate tr:even").addClass("alternate");			
			$("table.tblAlternate tr:first-child").removeClass("alternate");
			
			
			$(".homeTabs .accordionLink").click(function() {
	 
					var target = $(this);
					var target_container = $(this).next('div');
	
					var close = true;
	
					if(target.hasClass('expanded')) {
						
						if(target.attr('id') == 'philosophyBar') {
							
							target_container = target.siblings('.default');
							
							close = false;
							
						} else {
							
							target_container = target.prev('div');

							target = target.prev().prev();
							
						}
					}
					
					
	
					$(".collapseCont.expanded")
						.animate({"width": '0px'}, 500)
						.removeClass('expanded');
							
					target_container
						.css({"display":"block"})
//						.animate({"width": '790px'}, 500)
						.animate({"width": '715px'}, 500)
						.addClass('expanded');
					
					$(".homeTabs .accordionLink")
						.css({"background-position":"0"})
						.removeClass('expanded');
					
					if(close) {
						target.css({"background-position":"-76px"});
						target.addClass('expanded');
					}
					
					return false;
			});	
			
			$("a.headerCollapse").toggle(function () {
      				
					$(this).next(".tblCollapse").slideUp('slow');
					$(this).css({"background-image":"url(images/img-linkOpen.gif)"});		
					
			},function() {												 
															
					$(this).css({"background-image":"url(images/img-linkClose.gif)"});					
					
					$(this).next(".tblCollapse").slideDown('slow');
					
					return false;
			});								
		
			
			$(".featureImg").cycle({"fx":"fade", "speed": 1500, "timeout": 7000 });							   
			
			$('#tornadoCallout a').click(function() {
				$('#tornado-modal').modal({
					position:new Array("8%"),
	    			opacity:80,
		    		overlayCss: {backgroundColor:"#000"},
		    		overlayClose:true
		    	});
			});

// NEW STYLE ACCORDION

	var activeContent = '';
	var activeBio;

	$('.accordion-key').click(function() {
		if ($(this).parent().hasClass('active')) {
			return false;
		} else {
		activeContent = $(this).parent().attr('class').split(' ')[0];
		$('.fold.active').animate({
			width: '73px'
			});
		$(this).parent().animate({
			width: '648px'
		});
		$('.fold.active').removeClass('active');
		$(this).parent().addClass('active');
		$('.lower-content').hide();
		$('.lower-content.'+ activeContent).show();
		return false;
		}
	});

	$('.lower-nav').click(function() {
		activeContent = $(this).attr('class').split(' ')[0];
		$('.fold.active').animate({
			width: '73px'
			});
		$('#accordion .' + activeContent + '.fold').animate({
			width: '648px'
		});
		$('.fold.active').removeClass('active');
		$('#accordion .' + activeContent + '.fold').addClass('active');		
		$('.lower-content').hide();
		$('.lower-content.'+ activeContent).show();
		$('html, body').animate({scrollTop: 300}, "slow");	
		return false;
	});	

/*
		$('.fold').css('width', '73' + 'px');
		$(this).parent().css('width', '648'+ 'px');
	$('.accordion-key').click(function() {
		var activeContent = $(this).parent().attr('class').split(' ')[0];
		$('.fold').animate({
			width: '73' + 'px'
			});
		$(this).parent().animate({
			width: '648'+ 'px'
		});
		$('.lower-content').hide();
		$('.lower-content.'+ activeContent).show();
		return false;
	});
*/

//BIO LIGHTBOXES

$('.bio-thumb').click(function() {
	activeBio = $(this).attr('id');
	$('#overlay').show();
	var b = $(document).height();
	$('#overlay').css('height', b);
	$('.bio-pop.' + activeBio).fadeIn('fast').addClass('active');
	$("#mcs_container").mCustomScrollbar("vertical",400,"easeOutCirc",1.05,"fixed","yes","yes",10);
	$("#mcs_container2").mCustomScrollbar("vertical",400,"easeOutCirc",1.05,"fixed","yes","yes",10);
	$("#mcs_container3").mCustomScrollbar("vertical",400,"easeOutCirc",1.05,"fixed","yes","yes",10);	
	$('html, body').animate({scrollTop: 300}, "slow");	
	return false;
});

$('#overlay').click(function() {
	$('.bio-pop').fadeOut('fast');
	$(this).fadeOut('fast');
	return false;
});

$('.bio-close').click(function() {
	$('.bio-pop').fadeOut('fast');
	$('#overlay').fadeOut('fast');
	return false;
});

});
