//Do this when page loads:
function textSizeCheck() {
	var theSize	= get_cookie("bristolTextSize");
	var theLineHeight 	= get_cookie("bristolLineHeight");

	//Set them

	theContent = document.getElementById("middlecontainer");
	if (theSize)	theContent.style.fontSize = theSize;
	if (theLineHeight)	theContent.style.lineHeight = theLineHeight;	
}

function largerText() {
	theContent = document.getElementById("middlecontainer");
	if (theContent.style.fontSize=="100%" || !theContent.style.fontSize) {
		changeSize("120%","120%");
	}
	else if (theContent.style.fontSize=="120%") {
		changeSize("140%","120%");
	}
}

function smallerText() {
	if (theContent.style.fontSize=="140%") {
		changeSize("120%","120%");
	}
	else if (theContent.style.fontSize=="120%") {
		changeSize("100%","120%");
	}
}

function changeSize(theSize,theLineHeight) {
		theContent.style.fontSize = theSize;
		theContent.style.lineHeight = theLineHeight;
		aDate = new Date();
		set_cookie("bristolTextSize", theSize, aDate.getFullYear()+1, '', '', '/', '', '' );
		set_cookie("bristolLineHeight", theLineHeight, aDate.getFullYear()+1, '', '', '/', '', '' );
}

function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure ) {
	var cookie_string = name + "=" + escape ( value );
	if ( exp_y ) {
		var expires = new Date ( exp_y, exp_m, exp_d );
		cookie_string += "; expires=" + expires.toGMTString();
	}
	if ( path )		cookie_string += "; path=" + escape ( path );
	if ( domain )	cookie_string += "; domain=" + escape ( domain );
	if ( secure )	cookie_string += "; secure";
	document.cookie = cookie_string;
}

function get_cookie ( cookie_name ) {
	var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' );
	if ( results )	return ( unescape ( results[1] ) );
	else 			return null;
}
