$(document).ready(function(){
	$('.accordion .toggler').toggle(function() {
		// Set to 100% height to calculate actual height of box
		$(this).next().css('height', '100%');
		var calc_height = $(this).next().height();
		
		$(this).addClass('minus');
		$(this).next().css('height', '0px');
		$(this).next().animate({height:calc_height}, 'slow');
	}, function() {
		$(this).removeClass('minus');
		$(this).next().animate({height:'0px'}, 'slow');
	});
	
	
	/* Expand all accordions on page */
	$('.expand_all').click(function() {
		// Set to 100% height to calculate actual height of box
		$('.accordion .element').each(function(){
			$(this).css('height', '100%');
			var calc_height = $(this).outerHeight();
		
			$(this).siblings('.toggler').addClass('minus');
			$(this).css('height', '0px');
			$(this).animate({height:calc_height}, 'slow');
		});
	});
	/* END Expand all accordions on page */
	
	/* Collapse all accordions on page */
	$('.collapse_all').click(function() {
		// Set to 100% height to calculate actual height of box
		$('.accordion .element').each(function(){
			$(this).siblings('.toggler').removeClass('minus');
			$(this).animate({height:'0px'}, 'slow');
		});
	});
	/* END Collapse all accordions on page */
	
	/* Fancybox iframe */
	$('.iframe').fancybox({
		overlayColor: '#000000'
	});
	
	/* END Fancybox iframe */
	
	$('.tabHover li').click(function() {
		var this_id = $(this).attr('id');
		$('ul.tabHover .TSTabSel').removeClass('TSTabSel').addClass('TSTab');
		$(this).removeClass('TSTab').addClass('TSTabSel');
		$('.TSTabContentsSelected').removeClass('TSTabContentsSelected').addClass('TSTabContentsNormal');
		$('#'+this_id+'Contents').removeClass('TSTabContentsNormal').addClass('TSTabContentsSelected');
	});
	
	// Dropdown Menu jQuery Override
	$('#header-dropdown').hide();
	$('#toggle').attr('href', '#'); // switch to unlinked
	$('#new-header-image a[class!="toggle"]').mouseover(function() {$('#header-dropdown').hide();});	
	$('#toggle').mouseover(function() {$('#header-dropdown').show();});
	$('#header-dropdown').mouseover(function() {$('#header-dropdown').show();});	
	$('#new-header-image').mouseleave(function() {$('#header-dropdown').hide();});
	
	$('#header-dropdown').mouseout(function() {
	  $('#header-dropdown').hide();
	});
});
