// JavaScript Document

$(document).ready(function(){
	
	// home styles
	// remove newsPreview sIFR h3 - on the left side
	$('#newsPreview h3').removeClass('sIFR-replaced');
	
	//shut all expandable Panels - except the last one
	$('.expandPanelContent').hide();
	$('.expandPanel .expandPanelContent:last').addClass('open').show();
	
	//when expandPanel h4 is clicked, show panel
	$('.expandPanel h4').click(function(){
		if($(this).siblings('.expandPanelContent').attr('class').match(/open/)){
			$(this).siblings('.expandPanelContent').slideUp(50).removeClass('open');
		}
		else{ $(this).siblings('.expandPanelContent').slideDown(50).addClass('open');	}
	});
	
	//shut all expandable PanelsN
	$('.expandPanelContentN').hide();
	
	//when expandPanelN h4 is clicked, show panel
	$('.expandPanelN h4').click(function(){
		if($(this).siblings('.expandPanelContentN').attr('class').match(/open/)){
			$(this).siblings('.expandPanelContentN').slideUp(50).removeClass('open');
		}
		else{ $(this).siblings('.expandPanelContentN').slideDown(50).addClass('open');	}
	});

	
	// for FontSizer
	if($('body').attr('id') != 'home'){
		var options = { min: -2.5, max: 5};
		//Initialize the font sizer for the site.
		$.FontSizer.Init(options);
		}
	
	// so font sizer links go nowhere...
	$('.sizeDown').click(function(){ 
		$.FontSizer.DecreaseSize();
		return false; 
		});
	$('.sizeUp').click(function(){ 
		$.FontSizer.IncreaseSize();
		return false; 
		});
	
	// transparent hover
	$('#auxNav li a').hover(function(){
		$(this).css({'opacity': 0.8});
	}, function(){
		$(this).css({'opacity': 1});
	});
	
	$('.previous, .next, .usersItemControl li a, .searchButton, #resize a, #controls a, .backTop, .submitButton').hover(function(){
		$(this).css({'opacity': 0.5});
	}, function(){
		$(this).css({'opacity': 1});
	});
	
	$('.usersItemControl li a').hover(function(){
		$(this).css({'opacity': 0.2});
	}, function(){
		$(this).css({'opacity': 1});
	});
	
	$('.factSheets li a').hover(function(){
		$(this).children('img').css({'opacity': 0.6});
	}, function(){
		$(this).children('img').css({'opacity': 1});
	});

	// expand Panel rollover for IE6
	$('.expandPanel h4').hover(function(){
		$(this).css({'color': '#911454'});
	}, function(){
		$(this).css({'color': '#3c0220'});
	});
	
	// expand Panel N rollover for IE6
	$('.expandPanelN h4').hover(function(){
		$(this).css({'color': '#911454'});
	}, function(){
		$(this).css({'color': '#3c0220'});
	});

});