//	********************************************************************
//	** ^^^^^^^^^^^^^^^^^^^^^^^ * ^^^^ autore:   Stefano Ghezzi ^^^^^^ **
//	** ~~~~~~~~~~~~~~~~~~~~~~~ * ~~~~ azienda:  Seisnet s.r.l. ~~~~~~ **
//	** ~~~~~> VSCROLLOO <~~~~~ * ~~~~ web:      http://www.seisnet.it **
//	** ~~~~~~~~~~~~~~~~~~~~~~~ * ~~~~ e-mail:   info@seisnet.it ~~~~~ **
//	** -[scroller  verticale]- * ---- versione: 1.0 - 25/08/2003 ---- **
//	********************************************************************
//
//
//	***********************
//	*** Ultima Modifica ***
//	***** 15/10/20003 *****
//	***********************


//Costruttore dello scroller
function vscrolloo(lOuter, lInner, pxScroll, iter)
	{
	this.pxScroll = pxScroll;  //num di pixel di spostamento di una singola scrollata (consigliato)
	this.iter     = iter;      //velocità relativa dello scroll (sconsigliato)
	this.lOuter   = lOuter;    //Nome del livello esterno
	this.lInner   = lInner;    //Nome del livello annidato (interno)

	this.cb = new crossbrowser (this.lOuter, this.lInner)
	
	//Elenco dei metodi
	this.movedown  = movedown;
	this.moveup    = moveup;
	this.stop      = stop;
	this.necessary = necessary;
	}


function movedown()
	{
	hInner = eval(this.cb.hInner);
	hOuter = eval(this.cb.hOuter);
	this.interval = setInterval ("move_down(" 
			+ this.cb.styleRef + ", " + this.pxScroll + ", " + hInner + ", " + hOuter +
			")", this.iter);
	}
function move_down(lStyle, nPx, hInner, hOuter)
	{
	if (!lStyle.top) lStyle.top = 0;
	if (((parseInt(lStyle.top) == 0) || lStyle.top) && (Math.abs(parseInt(lStyle.top)) < parseInt(hInner) - parseInt(hOuter)))
		lStyle.top = parseInt(lStyle.top) - nPx;
	}


function moveup()
	{
	this.interval = setInterval ("move_up(" + this.cb.styleRef + ", " + this.pxScroll + ")", this.iter);
	}
function move_up(lStyle, nPx)
	{
	if (lStyle.top && (parseInt(lStyle.top) < 0))
		lStyle.top = parseInt(lStyle.top) + nPx;
	}


function stop()
	{
	clearInterval(this.interval);
	}


function necessary() //Ritorna true o false a sconda che lo scroll sia necessario o no
	{
	if (parseInt(eval(this.cb.hInner)) > parseInt(eval(this.cb.hOuter)))
		return true;
	else
		return false;
	}




//Costruttore di oggetti 'cross-browser'
function crossbrowser(cblOuter, cblInner)
	{
	this.cblOuter = cblOuter;
	this.cblInner = cblInner;
	
	this.layerRef = "";  //Campo di riferimento per accedere a (questo) livello interno
	this.styleRef = "";  //Campo di riferimento per accedere agli stili di (questo) livello interno
	this.hInner   = 0;   //Altezza di (questo) livello interno
	this.hOuter   = 0;   //Altezza di (questo) livello esterno

	if (document.getElementById) // NN>=6; MSIE>5
		{
		this.layerRef = "document.getElementById('" + this.cblInner + "')";
		this.styleRef = this.layerRef + ".style";
		this.hInner   = this.layerRef + ".offsetHeight";
		this.hOuter   = "document.getElementById('" + this.cblOuter + "').offsetHeight";	
		}	
	else if (document.layers) // NN<6
		{
		this.layerRef = "document.layers['" + cblOuter + "'].document.layers['" + cblInner + "']";
		this.styleRef = this.layerRef;
		this.hInner   = this.layerRef + ".clip.height";
		this.hOuter   = "document.layers['" + cblOuter + "'].clip.height";
		}
	else if (document.all) // MSIE
		{
		this.layerRef = "document.all['" + cblOuter + "'].document.all['" + cblInner + "']";
		this.styleRef = this.layerRef  + ".style";
		this.hInner   = this.layerRef  + ".offsetHeight";
		this.hOuter   = "document.all['" + cblOuter +"'].offsetHeight";
		}
	}