﻿/* VW - 10.25.2011 (FEAT11872) */
var fontsize = 0;

function cc_fontsizechangeup()
{
	var fileName = null;

	if (fontsize == 0)
	{
		fontsize++;

		fileName = "up1";
	}
	else if (fontsize == -1)
	{
		fontsize++;

		fileName = "default";
	}

	if (fileName != null)
	{
		updateStyleSheet(fileName);
		updateFontSize("+");
	}
}

function cc_fontsizechangedown()
{
	var fileName = null;

	if (fontsize == 0)
	{
		fontsize--;

		fileName = "down1";
	}
	else if (fontsize == 1)
	{
		fontsize--;

		fileName = "default";
	}

	if (fileName != null)
	{
		updateStyleSheet(fileName);
		updateFontSize("-");
	}
}

function updateStyleSheet(fileName)
{
	if (fileName != null)
	{
		var fileref = document.createElement("link");

		fileref.setAttribute("rel", "stylesheet");
		fileref.setAttribute("type", "text/css");
		fileref.setAttribute("href", "/Style%20Library/fonts_508_" + fileName + ".css");
		document.getElementsByTagName("head")[0].appendChild(fileref);
	}
}

function updateFontSize(pType)
{
	$("div[id*='_RightColumn'],div[id*='_ColumnRight'],div[id*='_CenterColumn'],div[id*='_ColumnCenter']").each
	(
		function()
		{
			var controlID = $(this).attr("id");

			$("#" + controlID + " span").each
			(
				function()
				{
					adjustFontSize(pType, $(this))
				}
			);

			if (controlID.toLowerCase() == "cc_homepage_columncenter")
			{
				$("div[id*='_MoreCCNews_']").each
				(
					function()
					{
						var control = $(this);

						adjustFontSize(pType, control);

						control.children().each
						(
							function()
							{
								adjustFontSize(pType, $(this));
							}
						)
					}
				);
			}
		}
	);
}

function adjustFontSize(pType, pControl)
{
	var fontSizeValue = parseFloat(pControl.css("font-size")) + ((pType == "+") ? 2 : -2);

	pControl.css("font-size", fontSizeValue);
}
