/// <summary>
/// Return if we're in IE or not
/// </summary>
function isIE()
{
	// The below Xml Function isnt available in IE
	return (typeof XMLHttpRequest=='undefined') 
}

/// <summary>
///  Shows or hides an element in the document
/// </summary>
function ShowHide(elementname,truefalse)
{
	try
	{
		var theElement = document.getElementById(elementname);
		
		if (!truefalse)
		{
			theElement.style.display='none';
		}
		else
		{
			if (theElement.tagName == "DIV")
			{
				if (isIE())
				{
					theElement.style.display='block';
				}
				else
				{
					theElement.style.removeProperty("display");
				}	
			}
			else
			{
				if (isIE())
				{
					theElement.style.display='inline';
				}
				else
				{
					theElement.style.removeProperty("display");
				}	
			}
		}
	}
	catch(e)
	{
		alert("Error Show/Hiding- " + elementname);
	}
}

/// <summary>
///  Shows or hides an element in the document
/// </summary>
function displayThawteDate()
{
	// Calculate Date Function
	var today = new Date(); 
	var myMonth = new String(today.getMonth()+1);
	var myDate = new String(today.getDate());
	
	// Prefix with a zero
	if (myDate.length == 1)
		myDate = "0" + myDate;
		
	if (myMonth.length==1)
		myMonth = "0" + myMonth;
		
	//if (isIE())
	//{
		position = "top : 42px; left : 14px;";
	//}
	//else
	//{
		//position = "top : -5px; left : 130px;";
	//}
	// Write Date Above the Thawte Logo
	document.write("<div style='position : absolute; " + position + "color : white; font-size : 7pt; font-weight : bold;'>" + myDate + "-" + myMonth  + "-" + today. getFullYear() + "</div>");
}

/// <summary>
/// Increase the font on the page
/// </summary>
function IncreaseFont()
{
	var amount = new String(document.body.style.fontSize);
	if (amount == "")
		amount="80%";

	var intAmount = new Number(amount.substring(0, amount.length-1));

	intAmount = intAmount + 10;
	document.body.style.fontSize = intAmount.toString() + "%";
	
	document.cookie = "textsize=" + document.body.style.fontSize;
}

/// <summary>
/// Decrease the font on the page
/// </summary>
function DecreaseFont()
{
	var amount = new String(document.body.style.fontSize);
	if (amount == "")
		amount="80%";

	var intAmount = new Number(amount.substring(0, amount.length-1));
	intAmount = intAmount - 10;
	document.body.style.fontSize = intAmount.toString() + "%";

	document.cookie = "textsize=" + document.body.style.fontSize;
}

/// <summary>
/// Check and set font size for the page
/// </summary>
function CheckFontSize()
{
	// Get Cookie from the browser and set the font size
	var Cookies = new String(document.cookie);
	var CookieCollection = Cookies.split(';');
	
	for (var count=0; count <CookieCollection.length; count++)
	{
		var Cookie = new String(CookieCollection[count]);
		var CookieInfo = Cookie.split('=');
		if (CookieInfo[0].substring(1, CookieInfo[0].length) == "textsize")
		{
			document.body.style.fontSize = CookieInfo[1];
		}
	}	
}
