


//##########################################
function SVP(ASC,AF)	//## Installation ##
//##########################################
{
	this.ASC=ASC;
	this.AF=AF;
	this.timg=new Array();	//~~~~ positions initiales ~~~~
	this.h=new Array();
	var i=-1;
	for ( var n=0;n<this.ASC.childNodes.length;n++ )
	{	// tous les éléments
		if (this.ASC.childNodes[n].src)
		{	// les 3 1ères images
			i++;
			this.timg[i]=this.ASC.childNodes[n];
			this.Adresses(i);
			if ( i>=2) n=this.ASC.childNodes.length;
		}
	}
	this.timg[3]=this.ASC;
	this.Adresses(3);
	this.FH=this.timg[0];
	this.FH.style.position="absolute";
	this.FH.style.top=this.h[0];
	this.CUR=this.timg[1];
	this.CUR.style.position="absolute";
	this.CUR.style.top=this.h[1];
	this.FB=this.timg[2];
	this.FB.style.position="absolute";
	this.FB.style.top=	this.h[3] +
						this.ASC.offsetHeight -
						this.FB.offsetHeight;
	this.dispo=	parseInt(this.FB.style.top,10) -
				parseInt(this.FH.style.top,10) -
				this.FH.offsetHeight;
	this.CurDep=false;
	var Lui=this;
	this.ie = false;	/*@cc_on	this.ie = true;	@*/
	if (!this.ie)
			{	//~~~~ FireFox ~~~~
				this.ASC.onmousemove = function(e) { Lui.DeplaceFF(e); };
				document.captureEvents(Event.MouseMove);
			}
	else	{	//~~~~ Internet Explorer ~~~~
				this.ASC.onmousemove = function() { Lui.DeplaceIE(); };
			}
	this.ASC.onblur =	function() { Lui.CurDep=false; };
	this.ASC.onclick =	function() { Lui.Cliquer(); }
	this.AF.onscroll =	function() { Lui.Affiche(); };
	this.CUR.onclick =	function() { Lui.CurDep=!Lui.CurDep; };
	this.FB.onclick =	function() { Lui.Bouge(1); };	
	this.FH.onclick =	function() { Lui.Bouge(-1); };
}
//###################################################################
SVP.prototype.Adresses=function(i)	//## adresses des "composants" ##
//###################################################################
{
	var p=this.timg[i];
	this.h[i]=0;
	do
	{	// position image + position des parents
		this.h[i]+=p.offsetTop;
		if ( p.style.position.toLowerCase()=="absolute" )
				{
					p=false;
				}
		else	{
					p=p.offsetParent;
				}
	} while (p)
}			
//###########################################################
SVP.prototype.Bouge=function(sens)	//## click sur flêches ##
//###########################################################
{
	this.CurDep=false;
	var tmp=this.AF.scrollTop+(sens*this.AF.offsetHeight);
	if (tmp<0)
			{
				tmp=0;
			}
	else	{
				if (tmp>this.AF.scrollHeight) 
				{
					tmp=this.AF.scrollHeight;
				}
			}
	this.AF.scrollTop=tmp;
	this.Affiche();
}
//########################################################################
SVP.prototype.DeplaceFF=function(evt) 	//## déplace le curseur FireFox ##
//########################################################################
{
	this.Deplace(evt.clientY);
}
//##############################################################################
SVP.prototype.DeplaceIE=function() 	//## déplace le curseur Internet Explorer ##
//##############################################################################
{	
	this.Deplace(event.y);
}
//##################################################################
SVP.prototype.Deplace=function(tmp)	//## déplace curseur (commun) ##
//##################################################################
{
	if (this.CurDep)
	{
		if ( 	tmp >= ( 	parseInt(this.FH.style.top,10) +
							this.FH.offsetHeight ) && 
				tmp <= (  	parseInt(this.FB.style.top,10) -
							this.CUR.offsetHeight ) )
		{
			this.CUR.style.top=tmp;
			tmp=((tmp-this.h[0]-this.FH.offsetHeight)/this.dispo)*100
			this.AF.scrollTop=(this.AF.scrollHeight*tmp)/100;
		}
	}
}
//##########################################################
SVP.prototype.Affiche=function()	//## déplace le texte ##
//##########################################################
{
	if ( ( this.AF.scrollTop+this.AF.offsetHeight ) >= 
					( this.AF.scrollHeight-this.AF.offsetHeight ) )
			{
				this.CUR.style.top=this.h[0]+this.dispo;
			}
	else	{
				var rel=(this.AF.scrollTop/this.AF.scrollHeight)*this.dispo;
				this.CUR.style.top=	rel+this.h[0]+this.FH.offsetHeight;
			}
}
//###############################################################
SVP.prototype.Cliquer=function()	//## click sur l'Ascenseur ##
//###############################################################
{
}

