﻿ok = (document.styleSheets) ? 1 : 0;
IE = ((ind1 = navigator.appVersion.indexOf("MSIE")) > -1) ? 1 : 0;

IE4 = (IE && document.all) ? 1:0;

NN = (navigator.appName.indexOf("Netscape")>-1) ? 1 : 0;

NN4 = (NN && document.layers) ? 1 : 0;

NN6 = (NN && document.getElementById) ? 1:0;

if(ok) {

	if(IE4) stile = document.styleSheets[0].rules
	
	if(NN6) stile = document.styleSheets[0].cssRules
}

var sizeBase; var h2; var footer;

function aumenta() {
	if(ok) {
	sizeBase = stile[0].style.fontSize.substring(0,2)
	sizeBase = parseInt(sizeBase,10)
	sizeBase;
	sizeBase += 1;
	
	h2 = stile[1].style.fontSize.substring(0,2)
	h2 = parseInt(h2 ,10)
	h2 += 1;

	footer = stile[2].style.fontSize.substring(0,2)
	footer = parseInt(footer ,10)
	footer += 1;

	if (sizeBase > 18) {
		sizeBase = 18;
		h2 = 21;
		footer = 17;
	}
	
	stile[0].style.fontSize = sizeBase + 'px';
	stile[1].style.fontSize = h2 + 'px';
	stile[2].style.fontSize = footer + 'px';
	}
}


function diminuisci(){
	if(ok) {
	sizeBase = stile[0].style.fontSize.substring(0,2)
	sizeBase = parseInt(sizeBase,10)
	sizeBase -= 1;
	
	h2 = stile[1].style.fontSize.substring(0,2)
	h2 = parseInt(h2 ,10)
	h2 -= 1;

	footer = stile[2].style.fontSize.substring(0,2)
	footer = parseInt(footer ,10)
	footer -= 1;

	if (sizeBase < 10) {
		sizeBase = 10;
		h2 = 13;
		footer = 9;
	}
	
	stile[0].style.fontSize = sizeBase + 'px';
	stile[1].style.fontSize = h2 + 'px';
	stile[2].style.fontSize = footer + 'px';
	}
}

var x='';
function handler(e) 
{
	if (document.all) {
	var evnt = window.event; 
	x=evnt.keyCode;
	}
	else
	x=e.charCode;
	if (x=="+") aumenta();
	if (x=="-") diminuisci();
}

if (!document.all){
	window.captureEvents(Event.KEYPRESS);
	window.onkeypress=handler;
}
else {
	document.onkeypress = handler;
} 

