/*-Javascript autorégénéré- A modifier à la source -*/

// textscroll by rod morelos (rod@dhtmlcentral.com) www20.brinkster.com/viewsrc 
// keep these two lines and you're free to use this code

// variables to set:
var scrollstep=30; // the speed of the timeout between each scroll
var scrollables=8; // number of scrollable content

// variables not to set:
var scrolltimer=0; // timer variable for vscroll function

// vertical scroll
function vscroll(num,speed)
{
if (isloaded)
{
if ((speed>0&&ocontent[num].y>-ocontent[num].h+ocontainer[num].h)||(speed<0 && ocontent[num].y<0)) ocontent[num].moveto(0,ocontent[num].y-speed);
scrolltimer=setTimeout('vscroll('+num+','+speed+')',scrollstep);
}
}

// horizontal scroll // Ryad
function hscroll(num,speed)
{
if (isloaded)
{
if ((speed>0&&ocontent[num].x>-ocontent[num].w+ocontainer[num].w)||(speed<0 && ocontent[num].x<0)) ocontent[num].moveto(ocontent[num].x-speed,0);
scrolltimer=setTimeout('hscroll('+num+','+speed+')',scrollstep);
}
}

// disable scroll
function noscroll() { clearTimeout(scrolltimer); }

// initialise function
var isloaded=false;
/*
ocontainer=new Array();
ocontent=new Array();
oup=new Array();
odown=new Array();
*/
var scrollinitialized=0;
function init()
{
if (scrollinitialized!=0) return true;
// patch Ryad : maintenant scrollables = Max de div que la fonction peut gérer
for (var i=1;i<=scrollables;i++)
  if (MM_findObj('divcontainer'+i)==null) scrollables=i-1;
ocontainer=new Array();
ocontent=new Array();
oup=new Array();
odown=new Array();
oright=new Array();
oleft=new Array();
for (var i=1;i<=scrollables;i++)
{
ocontainer[i]=new dhtmlobject('divcontainer'+i);
ocontent[i]=new dhtmlobject('divcontent'+i);
if (d.getElementById('divup'+i)) { // Ryad vérification d'existance div
	oup[i]=new dhtmlobject('divup'+i);
	odown[i]=new dhtmlobject('divdown'+i);
	if (ocontent[i].h > ocontainer[i].h) { oup[i].setv(1); odown[i].setv(1); }
	else if (ocontainer[i].h >= ocontent[i].h) { oup[i].setv(0); odown[i].setv(0); } // Ryad : Modif de > en >=
}
/* Ryad : scroll horizondal */
if (d.getElementById('divleft'+i)) {
	oleft[i]=new dhtmlobject('divleft'+i);
	oright[i]=new dhtmlobject('divright'+i);
	if (ocontent[i].w > ocontainer[i].w) { oright[i].setv(1); oleft[i].setv(1); } // Ryad : >= à cause de mozilla
	else if (ocontainer[i].w >= ocontent[i].w) { oright[i].setv(0); oleft[i].setv(0); }
}
if (bw.ns6) ocontent[i].css.position='relative'; // scrollbar hack for ns6
ocontent[i].moveto(0,0);
ocontainer[i].setv(1);
}
isloaded=true;
}

function hideshow_scroll(snum,vis) {
if (ocontent[snum].h > ocontainer[snum].h) { oup[snum].setv(vis); odown[snum].setv(vis); }
else if (ocontainer[snum].h > ocontent[snum].h) { oup[snum].setv(0); odown[snum].setv(0); }
ocontent[snum].moveto(0,0);
ocontent[snum].setv(vis);
ocontainer[snum].setv(vis);
}
function showthisscroll() {
init();
scrolltoshow=(arguments.length==0||isNaN(arguments[0]))?1:arguments[0];
for (var i=1;i<=scrollables;i++)
	hideshow_scroll(i,((i==scrolltoshow)?1:0));
}
// initiate script on page load
onload=init;
