function aggiungiOnLoad(nuovaFunzione)
{	
	var oldonload = window.onload;
	if (typeof window.onload != 'function'){
    	window.onload = nuovaFunzione;
	} else {
		window.onload = function(){
		oldonload();
		nuovaFunzione();
		}
	}

}

function transizioneSin(t,b,c,d) {
	return c/2 * (1 - Math.cos(Math.PI*t/d)) + b;
}

function trovaHPagina() {
	var y;
	var test1 = document.body.scrollHeight;
	var test2 = document.body.offsetHeight;
	if (test1 > test2) {						
		y = document.body.scrollHeight;
	} else {
		y = document.body.offsetHeight;
	}
	return y+60;
}

function trovaHScreen() {
	var y;
	if (self.innerHeight) { // tutti tranne Explorer
			y = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {// IE6
			y = document.documentElement.clientHeight;
	} else if (document.body) { // tutti gli altri Explorers
			y = document.body.clientHeight;
	}
	return y;
}

function prendiConId(id) 
{
	var oggetto = null;
	if (document.getElementById) {    
		oggetto = document.getElementById(id);   
	} else if (document.layers) {   
		oggetto = document.layers[id];   
	} else if (document.all) {    
		oggetto = document.all[id];   
	}  
	return oggetto;
}


function prendiOggetto(id) {
	var object = null;
	if( document.layers ) {   
    	object = document.layers[id];
	} else if( document.all ) {
    	object = document.all[id];
	} else if( document.getElementById ) {
    	object = document.getElementById(id);
   	}
   	return object;
}

function modificaStile(valore, qualeDiv, qualeStile){
    var ilDiv = document.getElementById(qualeDiv);
    var nuovoValore = parseInt(valore);
	ilDiv.style[qualeStile]= nuovoValore +"px";
}

function trovaY() {
	var coordY;
	if (window.scrollY) 
		coordY = window.scrollY;
	else if (document.documentElement.scrollTop) 
		coordY = document.documentElement.scrollTop;
	else
		coordY = document.body.scrollTop;
	return coordY;
}