////////////////////////////////////////
// Mega menu configuration and functions
////////////////////////////////////////
var megaConfig = { interval: 20, sensitivity: 4, over: addMega, timeout: 100, out: removeMega };
function addMega(){
	$(this).find('div').stop().fadeTo('fast', 1).show(); //Find sub and fade it in
}
function removeMega(){
	$(this).find('div').stop().fadeTo('fast', 0, function() { //Fade to 0 opactiy
		$(this).hide();  //after fading, hide it
	});
}
$(document).ready(function() {
	/////////////////////////////////////////
	// Activate hoverintent dropdown nav menu
	/////////////////////////////////////////
	$('ul#menu li.mega').hoverIntent(megaConfig);
	if($.browser.msie && $.browser.version.substr(0,1)<7) {
		$('ul#menu li').hover(function() {
			$(this).addClass('hover');
		}, function() {
			$(this).removeClass('hover');
		});
	}
	//////////////////////////////////
	// Activate page font size changer
	//////////////////////////////////
	var bodySize = parseInt($('#content').css('fontSize').replace('px', ''));
	$('.changefont').click(function() {
		thisSize = parseInt($(this).attr('id').replace('size_', '')) + bodySize;
		$('#content').css('fontSize', thisSize+'px');
		return false;
	});
	///////////////////////////////////////////////
	// Activate PrettyPhoto for images that need it
	///////////////////////////////////////////////
	$("a[rel^='prettyPhoto']").prettyPhoto({ theme: 'light_square' });
});
