window.addEvent('domready', function()
{
	
	//Font Size
	var fontSizeHeader = new Fx.Style('header', 'font-size', {duration: 500, unit: 'em', transition: Fx.Transitions.quadInOut});
	var fontSizeNav = new Fx.Style('nav', 'font-size', {duration: 500, unit: 'em', transition: Fx.Transitions.quadInOut});
	var fontSizeAccessibilityNav = new Fx.Style('accessibilityNav', 'font-size', {duration: 500, unit: 'em', transition: Fx.Transitions.quadInOut});
	var fontSizeWrapper = new Fx.Style('wrapper', 'font-size', {duration: 500, unit: 'em', transition: Fx.Transitions.quadInOut});
	var fontSizeFooter = new Fx.Style('footer', 'font-size', {duration: 500, unit: 'em', transition: Fx.Transitions.quadInOut});
	
	function changeFontSize(newValue)
	{
		fontSizeHeader.start(newValue);
		fontSizeNav.start(newValue);
		fontSizeAccessibilityNav.start(newValue);
		fontSizeWrapper.start(newValue);
		fontSizeFooter.start(newValue);
	}
	
	function setFontSize(newValue)
	{
		fontSizeHeader.set(newValue);
		fontSizeNav.set(newValue);
		fontSizeAccessibilityNav.set(newValue);
		fontSizeWrapper.set(newValue);
		fontSizeFooter.set(newValue);
	}
	
	//Normal Text
	$('normalTextSize').addEvent('click', function()
	{
		changeFontSize('0.85');
		$('normalTextSize').addClass('active');
		$('largestTextSize').removeClass('active');
		$('largerTextSize').removeClass('active');
		Cookie.set("MI_AI_fontSize", "normalTextSize", {duration: 30});
	});
	
	//Larger Text
	$('largerTextSize').addEvent('click', function()
	{
		changeFontSize('1');
		$('normalTextSize').removeClass('active');
		$('largerTextSize').addClass('active');
		$('largestTextSize').removeClass('active');
		Cookie.set("MI_AI_fontSize", "largerTextSize", {duration: 30});
	});
	
	//Largest Text
	$('largestTextSize').addEvent('click', function()
	{
		changeFontSize('1.2');
		$('normalTextSize').removeClass('active');
		$('largerTextSize').removeClass('active');
		$('largestTextSize').addClass('active');
		Cookie.set("MI_AI_fontSize", "largestTextSize", {duration: 30});
	});

	//Cookie check for font size
	if(Cookie.get("MI_AI_fontSize") == "largerTextSize")
	{ 
		setFontSize('1');
		$('normalTextSize').removeClass('active');
		$('largerTextSize').addClass('active');
		$('largestTextSize').removeClass('active');
	}
	else if(Cookie.get("MI_AI_fontSize") == "largestTextSize")
	{
		setFontSize('1.2');
		$('normalTextSize').removeClass('active');
		$('largerTextSize').removeClass('active');
		$('largestTextSize').addClass('active');
	}
	else
	{
		setFontSize('0.85');
		$('normalContrast').addClass('active');
		$('normalTextSize').addClass('active');
		$('largestTextSize').removeClass('active');
		$('largerTextSize').removeClass('active');
	}
	
	//Contrast
	$('highContrast').addEvent('click', function()
	{
		setActiveStyleSheet('highContrast');
		// Removed by JB as DaraCreative hardcoded the affiliates in the JS
		//loadHighContrastImages();
		$('highContrast').addClass('active');
		$('normalContrast').removeClass('active');
	});
	$('normalContrast').addEvent('click', function()
	{
		setActiveStyleSheet('default');
		// Removed by JB as DaraCreative hardcoded the affiliates in the JS
		//loadNormalContrastImages();
		$('normalContrast').addClass('active');
		$('highContrast').removeClass('active');
	});
	
	if(Cookie.get("MI_AI_style") == "highContrast")
	{
		$('highContrast').addClass('active');
		$('normalContrast').removeClass('active');
		// Removed by JB as DaraCreative hardcoded the affiliates in the JS
		// loadHighContrastImages();
	}
	else
	{
		$('normalContrast').addClass('active');
		$('highContrast').removeClass('active');
		// Removed by JB as DaraCreative hardcoded the affiliates in the JS
		// loadNormalContrastImages();
	}
	// Removed by JB as DaraCreative hardcoded the affiliates in the JS
//	function loadHighContrastImages()
//	{
//		$('affiliates').setHTML('<ul><li><a href="http://www.detini.gov.uk/" target="_blank"><img src="images/affiliates/dept_ent_trade_and_investment_hc.png" alt="Department of Enterprise, Trade and Investment" width="144" height="80" /></a></li><li><a href="http://www.dcmnr.gov.ie/" target="_blank"><img src="images/affiliates/dept_comms_energy_and_nat_resources_hc.png" alt="Department of Communications, Energy and Natural Resources" width="265" height="80" /></a></li><li><a href="http://www.bgs.ac.uk/gsni/" target="_blank"><img src="images/affiliates/geological_survey_ni_hc.png" alt="Geological Survey of Northern Ireland" width="170" height="80" /></a></li><li><a href="http://www.mineralsireland.ie/" target="_blank"><img src="images/affiliates/minerals_ireland_hc.png" alt="Minerals Ireland" width="175" height="80" /></a></li><li><a href="http://www.gsi.ie/" target="_blank"><img src="images/affiliates/gsi_hc.png" alt="Geological Survey of Ireland" width="146" height="80" /></a></li></ul>');	
//	}
//	
//	function loadNormalContrastImages()
//	{
//		$('affiliates').setHTML('<ul><li><a href="http://www.detini.gov.uk/" target="_blank"><img src="images/affiliates/dept_ent_trade_and_investment.png" alt="Department of Enterprise, Trade and Investment" width="144" height="80" /></a></li><li><a href="http://www.dcmnr.gov.ie/" target="_blank"><img src="images/affiliates/dept_comms_energy_and_nat_resources.png" alt="Department of Communications, Energy and Natural Resources" width="265" height="80" /></a></li><li><a href="http://www.bgs.ac.uk/gsni/" target="_blank"><img src="images/affiliates/geological_survey_ni.png" alt="Geological Survey of Northern Ireland" width="170" height="80" /></a></li><li><a href="http://www.mineralsireland.ie/" target="_blank"><img src="images/affiliates/minerals_ireland.png" alt="Minerals Ireland" width="175" height="80" /></a></li><li><a href="http://www.gsi.ie/" target="_blank"><img src="images/affiliates/gsi.png" alt="Geological Survey of Ireland" width="146" height="80" /></a></li></ul>');	
//	}
//	
}); //Close domready 

