// JavaScript Document

$(function()
{
    //text sizing script    
	//note: the h5 has to have the "a" with it or else it acts strangely
    function setTextSize(size, applyTo, uniqueCookieSig) 
    {
        $(applyTo).click(function()
        {
            $('#textSizeChanger a').removeClass('active');
            $('#leftColumn, #navLeft, #content, #content h2, #content .highlightTitle a, #contentWrapper, #contentWrapper h2, #contentWrapper .highlightTitle a, .mediaSpotlight .highlightTitle a, #footer, #disclaimer').css('font-size',size); //name the divs you want to affect - main, footer, disclaimer
            $(applyTo).addClass('active'); //I don't think I need to worry about this one - this affects the underline to the font changing "As"
            $.cookie('textSizeCookie', uniqueCookieSig, { expires: 7, path: '/'}); 
            return false;
        }
    );
}

setTextSize('100%','#normalTextSize', 1);   //this can be set as pixels, ems or percents
setTextSize('130%','#enlargeTextSize', 2);

checkTextCookie = $.cookie('textSizeCookie');
if (checkTextCookie == "2") 
{
    $('#largeText').trigger('click');
}
else 
{
    $('#normalText').trigger('click');
}

});
//

$(function(){
	$('#geoSelect').hover(function(){
		$(this).addClass('showFlyover');	
	},function(){
		$(this).removeClass('showFlyover');			 
	});
		   
	$('#navMain>ul>li>').hover(function(){
		$(this).addClass('active');	
	},function(){
		$(this).removeClass('active');			 
	});
	
	$("table.newsroom tr:last th").css('border', 'none');
	$("table.newsroom tr:last td").css('border', 'none');
	$("div.event:last").css('border-bottom', 'none');
	$("div.result:last").css('border-bottom', 'none');
});

//toggle Left Menu 	
/*
	$('#navLeftList>li>a').click(function(){
		$(this).parent().toggleClass('active');
		return false;
		});
*/

//Adjust caption sizes to image sibling
	$('.caption').each(function(){
	var x = $(this).siblings('img').attr('width');	
	$(this).css('width',x);	
	});