if (document.layers) {
	rule='<style type="text\/css">body, div, p, blockquote, form, table {font-size: 14px; font-family: Verdana, Arial, Helvetica, sans-serif;}<\/style>';
	document.write(rule)
	}

var fontSizeCookieName = 'fontSize3';
var fontFamilyCookieName = 'fontFamily3';

var sizeA = new Array('70%', '80%', '85%', '90%', '95%', '110%', '115%', '120%', '125%', '135%', '145%', '155%');
//var sizeA = new Array('10px','11px','12px','14px','16px');

sizeA.length=12; // this makes only the first 5 keywords available

var currentSizeAIndex = 1; // this corresponds to the rule "body { font: x-small; }"

if (readCookie(fontSizeCookieName)!='') {
	currentSizeAIndex = readCookie(fontSizeCookieName)
	rule='<style type="text\/css">body{font-size: '+sizeA[currentSizeAIndex]+';}<\/style>';
	document.write(rule)
	}
if (readCookie(fontFamilyCookieName)!='') {
	currentFontFamily = readCookie(fontFamilyCookieName)

	if (document.layers) {
		rule='<style type="text\/css">body, div, p, blockquote, form, table {font-family: '+currentFontFamily+';}<\/style>';
	} else {
		rule='<style type="text\/css">body {font-family: '+currentFontFamily+';}<\/style>';
		}
	document.write(rule)
	}
	
function changeFontSize(i) {
	var newSizeAIndex = currentSizeAIndex-(-i);
	if (newSizeAIndex<0 || newSizeAIndex==sizeA.length) return false;
	activateButton('sizeUp');
	activateButton('sizeDown');
	if (newSizeAIndex==0) fadeButton('sizeDown');
	if (newSizeAIndex==sizeA.length-1) fadeButton('sizeUp');

	document.body.style.fontSize=sizeA[newSizeAIndex];

	currentSizeAIndex = newSizeAIndex;
	// let's stuff it in a cookie so we can remember it
	setCookie(fontSizeCookieName,currentSizeAIndex);
	// NS6 won't properly apply the changes in abs positioned divs unless we do
	// this trickery:
	if (!document.all) { 
		e = document.getElementsByTagName('body')[0];
		e.parentNode.replaceChild(e,e);
		}
	//menu.moveEm()
	}
	
function changeFontFamily(ff) {
	document.body.style.fontFamily=ff;
	// let's stuff it in a cookie so we can remember it
	setCookie(fontFamilyCookieName,ff);
	// NS6 won't properly apply the changes in abs positioned divs unless we do
	// this trickery:
	if (!document.all) { 
		e = document.getElementsByTagName('body')[0];
		e.parentNode.replaceChild(e,e);
		}
	//menu.moveEm()
	}


function writeControls() {	
	if (document.getElementsByTagName) { // kosher
		var formDiv = document.getElementById('preferences');
		if (!formDiv) {
			
			return;
			}
		
		// Because NS6 will try to call writeControls() every time the
		// e.parentNode.replaceChild(e,e) trick is used when writeControls()
		// is called from within a script element in the body of the HTML doc:
		if (formDiv.innerHTML != '') return;
		
		var theForm='';
		theForm+='';
		theForm+='&nbsp;<input type="button" id="sizeDown" class="preferencesEl" onclick="changeFontSize(-1)" value=" - " \/>&#160;';
		theForm+='<input type="button" id="sizeUp" class="preferencesEl" onclick="changeFontSize(1)" value=" + " \/>&nbsp;';
		theForm+='<select id="family" class="preferencesEl" onchange="if(this.selectedIndex>0) {changeFontFamily(this.options[this.selectedIndex].value)}">';
		theForm+='<option value="">Font?<\/option>';
		theForm+='<option value="Arial, Helvetica">Arial<\/option>';
		theForm+='<option value="Tahoma, Verdana, Arial, Helvetica, sans-serif">Tahoma<\/option>';
		theForm+='<option value="Verdana, Arial, Helvetica, sans-serif">Verdana<\/option>';
		theForm+='<option value="\'Trebuchet MS\', sans-serif">Trebuchet<\/option>';
		theForm+='<option value="Georgia, Times Roman, serif">Georgia<\/option>';
		theForm+='<option value="Lucida console, Monaco, monospace">Lucida<\/option>';
		theForm+='<\/select>';

		theForm+='';
		theForm+='</form>';
		formDiv.innerHTML = ""+theForm;
		
		// For IE5.0 Mac (it's fixed in later versions), which puts the contents of elements
		// outside of their containers, unless we do this:
		if (agt.indexOf('msie 5.0; mac') != -1) document.getElementById('fs').innerHTML=document.getElementById('fs').innerHTML;
		
		if (currentSizeAIndex==0) {
			fadeButton('sizeDown');
		} else if (currentSizeAIndex==sizeA.length-1) {
			fadeButton('sizeUp');
			}
		}
	}

function fadeButton(bId) {
	var button = document.getElementById(bId);
	button.blur();
	button.disabled='disabled';
	
	}
	
function activateButton(bId) {
	var button = document.getElementById(bId);
	button.disabled=null;
	}



