var curFontSize = 11;
var fontModifier = 1;
var baseUrl = 'http://www.cciwa.com/';

function fontSize(act) 
{
	var fontChangeDiv = document.getElementById("leftColumn");
	
	// if 1, increase font size
	if (act == 1)
	{
		curFontSize += fontModifier;
		curFontSize = Math.min(curFontSize, 41);
	}
	// if 0, decrease font size
	else if (act == 0)
	{
		curFontSize -= fontModifier;
		curFontSize = Math.max(curFontSize, 7);
	}

	// change the <div> element's properties
	fontChangeDiv.style.fontSize = curFontSize + "px";

	// change all the <p> element's properties
	for (v = 0; v < fontChangeDiv.getElementsByTagName("p").length; v++) 
	{
		fontChangeDiv.getElementsByTagName("p")[v].style.fontSize = curFontSize + "px";
	}

	// set cookie with font size value
	SetCookie('fontSizeCookie', curFontSize);
}

var userFontSize = GetCookie ('fontSizeCookie');

// if the font is larger than 1 do nothing, otherwise set it
if (userFontSize > 1) 
{
	// don't do anything
}
else
{
	// less than one so hardcode it
	userFontSize = 11;
}

// get a value from a cookie with a specified offset
function getCookieVal(offset)
{
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
	{
		endstr = document.cookie.length;
	}
		
	return unescape(document.cookie.substring(offset, endstr));
}

// get a cookie with the specified name
function GetCookie(name)
{
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i=0;
	
	while (i < clen)
	{	
		var j = i + alen;
		
		if (document.cookie.substring(i, j) == arg)
		{
			return getCookieVal (j);
		}
		
		i = document.cookie.indexOf(" ", i) + 1;
		
		if (i == 0)
		{
			break;
		}
	}
	
	return null;
}

function SetCookie(name,value)
{
	document.cookie = name + "=" + escape(value);
}

function OpenRefer(link)
{
	var w = window.open(baseUrl + 'ReferFriend.aspx?Link=' + link,'refer','width=700,height=500');
}