var decreaseButtonId = 'decreasefont';
var increaseButtonId = 'increasefont';

var currentFontSize;
var maxFontSize = 12;
var minFontSize = 8;

// Decrease the font size
function __TextSizeAdjuster_Decrease()
{
	currentFontSize = __TextSizeAdjuster_GetCurrentFontSize();
	
	if (currentFontSize > minFontSize)
	{
		currentFontSize -= 2;
		document.body.style.fontSize = currentFontSize.toString() + 'pt';

		// Disable the decrease button
		if (currentFontSize == minFontSize)
		{
			document.getElementById(decreaseButtonId).src = 'images/font/less-off.gif';                            
		}

		if (currentFontSize < maxFontSize)
		{
			document.getElementById(increaseButtonId).src = 'images/font/more.gif';
		}
	}
}

// Increase the font size
function __TextSizeAdjuster_Increase()
{
	currentFontSize = __TextSizeAdjuster_GetCurrentFontSize();
	if (currentFontSize < maxFontSize)
	{
		currentFontSize += 2;
		document.body.style.fontSize = currentFontSize.toString() + 'pt';
		// Disable the increase button
		if (currentFontSize == maxFontSize)
		{
			document.getElementById(increaseButtonId).src = 'images/font/more-off.gif';
		}

		if (currentFontSize > minFontSize)
		{
			document.getElementById(decreaseButtonId).src = 'images/font/less.gif';
		} 
	}
}

// Get the page's current font size
function __TextSizeAdjuster_GetCurrentFontSize()
{
	if (document.body.style.fontSize == '')
	{
		return (10 * 1);
	}

	else
	{
		_fontSize = document.body.style.fontSize;
		_fontSize = _fontSize.substring(0, _fontSize.lastIndexOf('pt'));
		
		return (_fontSize * 1);
	}
}

//favorites icon
function bookmarksite(title, url){
	if (document.all)
		window.external.AddFavorite(url, title);
	else if (window.sidebar)
		window.sidebar.addPanel(title, url, "")
}
