// JavaScript Document

function moduleHeight(extra)
{
	/* The content modules area will become the same height as the content body if smaller 
	   This will help the vertical content divider gif repeat-Y all the way to the footer */
	var contentH = parseInt($("#contentBody").height()) + parseInt($("#contentBody").css("padding-top")) + parseInt($("#contentBody").css("padding-bottom"));
	var headerH = parseInt($("#contentHeader").height()) + parseInt($("#contentBody").css("padding-top"));// + parseInt($("#contentBody").css("padding-bottom"));
	var moduleH = parseInt($("#contentModules").height()) + parseInt($("#contentModules").css("padding-top"));// + parseInt($("#contentModules").css("padding-bottom"));
	var newH = contentH + headerH;
	
	
	if (typeof extra == "undefined") {
		extra = 0;
	}

	if(newH > moduleH) {
		newH = parseInt(newH) - parseInt($("#contentModules").css("padding-top"));// - parseInt($("#contentModules").css("padding-bottom"));
		$("#contentModules").height(extra+newH+10);
	}

}

function runCommonScripts() {
	// replace custom fonts with images
	Cufon.replace('#siteSelectTop', { fontFamily: 'FrutigerLTStd-Roman' });
	Cufon.replace('#navLinks', { fontFamily: 'FrutigerLTStd-Bold' });
	Cufon.replace('.contentHeader', { fontFamily: 'FrutigerLTStd-Bold' });
	Cufon.now();
	
	$(document).ready(function(){	
		moduleHeight();
		
		//language selector animation
		$('#langSelect').live('click',function() {
			$('#'+this.id).stop().animate({height:'102px'});
		});
		$('#langSelect').bind('mouseleave',function() {
			$('#'+this.id).stop().animate({height:'34px'});
		});

	});
}