textSizes = ['normaltext', 'largetext', 'hugetext'];

var entitiesWithResizableText = [];
var cookieStoredTextSizeIndex = GetCookie("textsizestyleindex");

/* move the following to an on-page load section or by where text is being resized */
/* if (cookieStoredTextSizeIndex !== undefined) {
		textResize('maincontent', cookieStoredTextSizeIndex);
} */

/* id = element id to change
 * size = index into textSizes array
 *
 * if passed an array as 'id', recurse over array
 */
function textResize(id, size){
	if (size == undefined) { size = 0; }
	if (id instanceof Array) {
		for (i=0; i<id.length; i++) {
			textResize(id[i], size);
		} 
		return;
	}
	var obj = document.getElementById(id);
	if (obj){
		obj.className = obj.className.replace(new RegExp('(' + textSizes.join(')|(') + ')', 'g'), ''); // remove previously added text size classes
		obj.className = obj.className.replace(/(^\s+)|(\s+$)/g, ''); // chomp
		obj.className += ' ' + textSizes[size];
		if (cookieStoredTextSizeIndex != size) {
			SetCookie("textsizestyleindex", size, 365);
			cookieStoredTextSizeIndex = size;
		}
	}
}


