//Classe Scroller ***********************************************************************
Scroller = function()
{
	this.Height='250px';
	this.Width='150px';
	this.MainClass='';
	this.SubClass='';
	this.ScrollTop=0;
	this.ScrollSpeed=10;
	this.ScrollPause=3000;
	this.Collection=new Array();
	this.CurItem=-1;
	this.DivHeader='';
	this.Direction=-1
	this.Vertical=true;
}
Scroller.prototype.Show=function()
{
	var tmpStr='';
	var isIE=document.all&&navigator.userAgent.indexOf("Opera")==-1
	
	//Construction du Div Bug affichage sous netscape
	if (!isIE) tmpStr+='<DIV STYLE="overflow:hidden;">';
	//Construction du Div Principal
	tmpStr+='<DIV ID="'+this.DivHeader+'MAIN"';
	if (this.MainClass.length>0) tmpStr+=' class="'+this.MainClass+'"'
	tmpStr+=' STYLE="' + ((isIE)?'':'position:relative;') + 'overflow:hidden;width:' + this.Width + ';height:' + this.Height + ';">'
	for (var t=0;t<this.Collection.length;t++) {
		//Construction des Div Secondaire
		tmpStr+='<DIV ID="'+this.DivHeader+'SUB'+t+'"';
		if (this.SubClass.length>0) tmpStr+=' class="'+this.SubClass+'"'
		tmpStr+=' STYLE="position:absolute;overflow:hidden;">'
		tmpStr+=this.Collection[t];
		tmpStr+='</DIV>'
	}
	//Cloture du Div Principal
	tmpStr+='</DIV>'
	//Cloture du Div Bug affichage sous netscape
	if (!isIE) tmpStr+='</DIV>'
	//Ecriture dans le document
	document.write(tmpStr);
	this.SetNextSub();
}
Scroller.prototype.GetHeight=function()
{
	var obj=null;
	obj=document.getElementById(this.DivHeader+'MAIN');
	return obj.clientHeight;
}
Scroller.prototype.GetWidth=function()
{
	var obj=null;
	obj=document.getElementById(this.DivHeader+'MAIN');
	return obj.clientWidth;
}
Scroller.prototype.SetNextSub=function()
{
	var t=this.CurItem+1;
	var obj=null;
	if (this.Collection.length>=0) {
		if (t<this.Collection.length)
			this.CurItem=t;
		else
			this.CurItem=0;
	}
	for (var u=0;u<this.Collection.length;u++) {
		obj=document.getElementById(this.DivHeader+'SUB'+u);
		obj.style.top=(obj.id==this.GetFirstSub()) ? '0px' : this.Height;
		obj.style.left=0;
		obj.style.width=(this.GetWidth()==0) ? '100%' : this.GetWidth()+'px';
		obj.style.height=(this.GetHeight()==0) ? '100%' : this.GetHeight()+'px';
	}
	this.ScrollTop=0;
}
Scroller.prototype.GetFirstSub=function()
{
	var t=this.CurItem;
	var tmp='';
	if (this.Collection.length>=0) {
		if (t<this.Collection.length && t>=0)
			tmp=this.DivHeader+"SUB"+t;
		else
			tmp=this.DivHeader+"SUB0";
	}
	return tmp;
}
Scroller.prototype.GetNextSub=function()
{
	var t=this.CurItem+1;
	var tmp='';
	if (this.Collection.length>=0) {
		if (t<this.Collection.length && t>=0)
			tmp=this.DivHeader+"SUB"+t;
		else
			tmp=this.DivHeader+"SUB0";
	}
	return tmp;
}
Scroller.prototype.Count=function()
{
   return this.Collection.length;
}
Scroller.prototype.Item=function(Index)
{
   return this.Collection[Index];
}
Scroller.prototype.Add=function(Texte)
{
	var Tmp=Texte;				
	this.Collection[this.Collection.length]=Tmp;
}
//Fin Classe Scroller ***********************************************************************
function ScrollerAction(ScrollerName)
{
	var Scr,Sub1,Sub2,max;
	Scr=eval(ScrollerName);
	Scr.ScrollTop += 1;
	Sub1=document.getElementById(Scr.GetFirstSub());
	Sub2=document.getElementById(Scr.GetNextSub());
	if (Scr.Vertical) {
		max=Scr.GetHeight();
		Sub1.style.top = Scr.ScrollTop*Scr.Direction;
		Sub1.style.left = 0;
		Sub2.style.top = (max*Scr.Direction*-1)+(Scr.ScrollTop*Scr.Direction);
		Sub2.style.left = 0;
	}
	else {
		max=Scr.GetWidth();
		Sub1.style.top = 0;
		Sub1.style.left = Scr.ScrollTop*Scr.Direction;
		Sub2.style.top = 0;
		Sub2.style.left = (max*Scr.Direction*-1)+(Scr.ScrollTop*Scr.Direction);
	}	
	if(Scr.ScrollTop < max)
		setTimeout("ScrollerAction('"+ScrollerName+"')",Scr.ScrollSpeed);
	else {
		Scr.SetNextSub();
		setTimeout("ScrollerAction('"+ScrollerName+"')",Scr.ScrollPause);
	}
}

function ValidForm(frm)
	{
		var res = false;
		if (frm != null)
		{
			var reg = /^[A-Z]{2}\d{2}[A-Z]\d$/i
			var coord = frm.txtCoord.value;
			if (!reg.exec(coord))
			{
				var span = document.getElementById("spanInfo");
				if (span != null)
				{
					span.style.color = "#800000";
					span.style.fontWeight = 'bold';
					span.style.fontSize = 'x-small';
				}
				alert("La valeur de coordonnée est incorrecte !");
			}
			else
				res = true;
		}
		return res;
	}
