function impostaCarattere(grandezza){
	// scrive sul cookie
setCookieRF(grandezza);
$('tuttapagina').removeClassName('normale'); 
$('Apiccolo').removeClassName('sel');
$('Amedio').removeClassName('sel');
$('Agrande').removeClassName('sel');
if(grandezza=='normale'){$('Apiccolo').addClassName('sel');}
if(grandezza=='grande'){$('Amedio').addClassName('sel');}
if(grandezza=='moltoGrande'){$('Agrande').addClassName('sel');}
$('tuttapagina').removeClassName('grande'); 
$('tuttapagina').removeClassName('moltoGrande'); 
$('tuttapagina').className=grandezza;
}
Event.observe($('Apiccolo'), 'click',  function(){impostaCarattere('normale');})
Event.observe($('Amedio'), 'click',  function(){impostaCarattere('grande');})
Event.observe($('Agrande'), 'click',  function(){impostaCarattere('moltoGrande');})
Event.observe(window, 'load',  function(){getCookieRF();})

function getCookieRF(){
	if (document.cookie.length > 0) {
		var source = new Array();
		source = document.cookie.split(';');
		//alert(source[0]);
		for(i=0;i<source.length;i++){
			if(source[i].indexOf('rf') == 0){
				//alert('ok');
				var rfto = source[i].substr(source[i].indexOf("=")+1);
				//alert(rfto);
				impostaCarattere(rfto);
			}else if(source[i].charAt(0) == ' ' && source[i].indexOf(' rf') == 0){
				var rfto = source[i].substr(source[i].indexOf("=")+1);
				//alert(rfto);
				impostaCarattere(rfto);
			}
		}
	}	
}


function setCookieRF(type){
	if(type != ''){
		document.cookie = 'rf-to' + '='+type+'' + '; path=/';
	}
}
