if (document.layers) {
	rule='<style type="text\/css">body, div, p, blockquote, td, form {font-size: 14px; font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;}<\/style>';
	document.write(rule)
	}
var fontSizeCookieName = 'fontSize3';
var fontFamilyCookieName = 'fontFamily3';
var sizeA = new Array('xx-small','x-small','small','medium','large','x-large','xx-large');
sizeA.length=5; // 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, td {font-size: '+sizeA[currentSizeAIndex]+';}<\/style>';
	document.write(rule)
	}
if (readCookie(fontFamilyCookieName)!='') {
	currentFontFamily = readCookie(fontFamilyCookieName)

	if (document.layers) {
		rule='<style type="text\/css">body, td, div, p, blockquote, form {font-family: '+currentFontFamily+';}<\/style>';
	} else {
		rule='<style type="text\/css">body, td {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;
	setCookie(fontSizeCookieName,currentSizeAIndex);
	if (!document.all) { 
		e = document.getElementsByTagName('body')[0];
		e.parentNode.replaceChild(e,e);
		}
	location.reload(true);

	}
function changeFontFamily(ff) {
	document.body.style.fontFamily=ff;
	setCookie(fontFamilyCookieName,ff);
	if (!document.all) { 
		e = document.getElementsByTagName('body')[0];
		e.parentNode.replaceChild(e,e);
		}
	location.reload(true);

	}
function writeControls() {	
	if (document.getElementsByTagName) { // kosher
		var formDiv = document.getElementById('preferences');
		if (!formDiv) {
			return;
			}
		if (formDiv.innerHTML != '') return;
		var theForm='<form id="preferencesForm">';
		theForm+='<fieldset id="fs">';
		theForm+='<input type="button" id="sizeDown" class="preferencesEl" onclick="changeFontSize(-1)" value=" A - " \/>&#160;';
		theForm+='<input type="button" id="sizeUp" class="preferencesEl" onclick="changeFontSize(1)" value=" A+ " \/>';
		theForm+='<br \/><select id="family" class="preferencesEl" onchange="if(this.selectedIndex>0) {changeFontFamily(this.options[this.selectedIndex].value)}">';
		theForm+='<option value="">cambia carattere:<\/option>';
		theForm+='<option value="Arial, Helvetica">Arial<\/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+='</fieldset>';
		theForm+='</form>';
		formDiv.innerHTML = "<h3 id='preferencesHeader'>Grandezza e stile dei caratteri<\/h3>"+theForm;
		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';
	button.style.borderColor='#999';
	button.style.color='#999';
	}
	
function activateButton(bId) {
	var button = document.getElementById(bId);
	button.disabled=null;
	button.style.borderColor='#000';
	button.style.color='#000';
	}
