//<script>
function myScrollerFixer( barName , refreshTime , positionY , thisName ){
	
	//nome della barra
	this.myMovingObj = barName;
	
	//contiene le dimensioni della finestra
	this.winDim = {};
	
	//contiene lo scroll attuale della pagina
	this.winScroll = {};
	
	//tempo di refresh della barra
	if( refreshTime != undefined )
		this.timeRefresh = refreshTime;
	else
		this.timeRefresh = 1000;
		
	//posizione:
	//accetta i seguenti valori:
	//    bottom
	//    top
	this.positionY = positionY;
	
	//nome della variabile:
	this.currentName = thisName;

	//questa funzione fa il riposizionamento della barra:
	this.repositionBar = function() {
		
		this.GetWindowSize();
		
		this.getScrollXY();
		
		//alert( this.winScroll.offsetX + " - " + this.winScroll.offsetY );
		
		try{
			
			var obj = document.getElementById( this.myMovingObj );
			
			if( this.positionY == "bottom" )
				obj.style.top = ( this.winDim.height + this.winScroll.offsetY - obj.offsetHeight ) + "px";
			else
				obj.style.top = ( this.winScroll.offsetY ) + "px";
				
			//obj.style.left = ( this.winScroll.offsetX ) + "px";
			
			//setTimeout( this.currentName + ".repositionBar()" , this.timeRefresh );
			
		}catch(exc){
			alert("Errore");
		}
	};
	
	this.GetWindowSize = function( ){
		w =  window;
		var width = w.innerWidth || (w.document.documentElement.clientWidth || w.document.body.clientWidth);
		var height = w.innerHeight || (w.document.documentElement.clientHeight || w.document.body.clientHeight);
		
		this.winDim.width = width;
		this.winDim.height = height;
		
	};
	
	this.getScrollXY = function(){
		var scrOfX = 0, scrOfY = 0;
		if( typeof( window.pageYOffset ) == 'number' ) {
			//Netscape compliant
			scrOfY = window.pageYOffset;
			scrOfX = window.pageXOffset;
		} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
			//DOM compliant
			scrOfY = document.body.scrollTop;
			scrOfX = document.body.scrollLeft;
		} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
			//IE6 standards compliant mode
			scrOfY = document.documentElement.scrollTop;
			scrOfX = document.documentElement.scrollLeft;
		}
		
		this.winScroll.offsetX = scrOfX;
		this.winScroll.offsetY = scrOfY;
		
	};
	
	//fa partire il posizionamento:
	this.repositionBar();
}
