
/*
/////////////////////////////////////////////////////////////////////

Concepts, inspiration, and ideas originated from:
	John Weir [info@smokinggun.com] and his multi-column text formatting and his text size increase/decrease function!
	
/////////////////////////////////////////////////////////////////////
*/

var gnfontsize = 1;
var fontSize   = 13;
var gnFonts = 'arial,verdana,helvetica';

function initFonts() 
{
	initstLoads();
	setGNFonts();
}

function setStoryText()
{
	storyTxt = (document.getElementById) ? document.getElementById('articleCopy') : document.all('articleCopy');
};


function fontsmall()
{
	fontSize -= 1;
	if (gnfontsize == 1)
		{
			if (fontSize < 10) fontSize = 10;
		}

	else 
		{
			if (fontSize < 11) fontSize = 11;
		}

	
	setStoryText();
	storyTxt.style.fontSize = fontSize + 'px';
	saveGNfonts();
};


function fontBig()
{
	fontSize += 1;
	if (gnfontsize == 1)
	{
		if (fontSize > 16) fontSize = 16;
	}

	else 
	{
		if (fontSize > 14) fontSize = 14;
	}

	setStoryText();
	storyTxt.style.fontSize = fontSize + 'px';
	saveGNfonts();
};


function saveGNfonts()
{
		fntcookie = 'gnFontList=';
		fntcookie = fntcookie + '*gnfontsize=' + gnfontsize + '*fontSize=' + fontSize;
		fontCookies = fntcookie + '; path=/; gnFontDeletes=';
  		document.cookie = fontCookies;
};


function setGNFonts()
{
	setStoryText();
	storyTxt.style.fontSize = fontSize + 'px';
	storyTxt.style.gnFonts = gnFonts;
	saveGNfonts();
};

function resizeBodyText()
		{
		if (document.getElementById("bodyNode") != null)
		{
			var mod;
			
			if (window.innerWidth) nW = window.innerWidth;
			else nW = document.getElementById("bodyNode").offsetWidth;
			
			mod = Math.round(nW/reSizeMod);
			
			obj = document.getElementById("bodyNode");
			//obj.style.padding = mod*5+"px";
			
						
			if (mod < 9) mod = 9;
			if (mod > 24) mod = 24;
		
			obj.style.fontSize = mod+"px";
			obj.style.lineHeight = (mod*1.0)+"px";
			

		
			}
		}

function initstLoads()
{
	stLoad = false;
	fontList = document.cookie.split('|');

	for (fList = 0; fList < fontList.length; fList++)
	{
		if (fontList[fList].indexOf('gnFontList=') > -1)
	{
		fontLoc = fontList[fList].indexOf('=') + 2;
		stLoad = fontList[fList].substring(fontLoc, fontList[fList].length);
		}
	}

		if (stLoad != false)
		{
			fontList = stLoad.split('*');
			for (fList = 0; fList < fontList.length; fList++)
		{

		if (fontList[fList].indexOf('gnfontsize') > -1)
		{
			myfSize = fontList[fList].split('=');
			gnfontsize  = parseInt(myfSize[1]);
		}

		if (fontList[fList].indexOf('fontSize') > -1)

		{
			myFontSize = fontList[fList].split('=');
			fontSize  = parseInt(myFontSize[1]);

		}

		}

	}

};
