// JavaScript Document

function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}


var clipTop = 0;
var clipWidth = 238; /* largeur du contener +20 */
var clipBottom = 91;
var topper = 18;
var lyrheight = 0;
var time,amount,theTime,theHeight,DHTML;


function init() {
	
	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;
	var x = new getObj('example');
	if (document.layers)
	{
		lyrheight = x.style.clip.bottom;
		lyrheight += 20;
		x.style.clip.top = clipTop;
		x.style.clip.left = 0;
		x.style.clip.right = clipWidth;
		x.style.clip.bottom = clipBottom;
	}
	else if (document.getElementById || document.all)
	{
		lyrheight = x.obj.offsetHeight;
		x.style.clip = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
	}
}

function scrollayer(layername,amt,tim)
{
	if (!DHTML) return;
	thelayer = new getObj(layername);
	if (!thelayer) return;
	amount = amt;
	theTime = tim;
	realscroll();
}

function realscroll()
{
	if (!DHTML) return;
	clipTop += amount;
	clipBottom += amount;
	topper -= amount;
	if (clipTop < 0 || clipBottom > lyrheight)
	{
		clipTop -= amount;
		clipBottom -= amount;
		topper += amount;
		return;
	}
	if (document.getElementById || document.all)
	{
		clipstring = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
		thelayer.style.clip = clipstring;
		thelayer.style.top = topper + 'px';
	}
	else if (document.layers)
	{
		thelayer.style.clip.top = clipTop;
		thelayer.style.clip.bottom = clipBottom;
		thelayer.style.top = topper;
	}
	time = setTimeout('realscroll()',theTime);
}

function stopScroll()
{
	if (time) clearTimeout(time);
}


// 2ème scrolling

var clipTop2 = 0;
var clipWidth2 = 238; /* largeur du contener +20 */
var clipBottom2 = 49;
var topper2 = 18;
var lyrheight2 = 0;
var time2,amount2,theTime2,theHeight2,DHTML2;


function init2() {
	
	DHTML2 = (document.getElementById || document.all || document.layers)
	if (!DHTML2) return;
	var x = new getObj('calendrier');
	if (document.layers)
	{
		lyrheight2 = x.style.clip.bottom;
		lyrheight2 += 20;
		x.style.clip.top = clipTop2;
		x.style.clip.left = 0;
		x.style.clip.right = clipWidth2;
		x.style.clip.bottom = clipBottom2;
	}
	else if (document.getElementById || document.all)
	{
		lyrheight2 = x.obj.offsetHeight;
		x.style.clip = 'rect('+clipTop2+'px,'+clipWidth2+'px,'+clipBottom2+'px,0)';
	}
}

function scrollayer2(layername2,amt2,tim2)
{
	if (!DHTML2) return;
	thelayer2 = new getObj(layername2);
	if (!thelayer2) return;
	amount2 = amt2;
	theTime2 = tim2;
	realscroll2();
}

function realscroll2()
{
	if (!DHTML2) return;
	clipTop2 += amount2;
	clipBottom2 += amount2;
	topper2 -= amount2;
	if (clipTop2 < 0 || clipBottom2 > lyrheight2)
	{
		clipTop2 -= amount2;
		clipBottom2 -= amount2;
		topper2 += amount2;
		return;
	}
	if (document.getElementById || document.all)
	{
		clipstring2 = 'rect('+clipTop2+'px,'+clipWidth2+'px,'+clipBottom2+'px,0)';
		thelayer2.style.clip = clipstring2;
		thelayer2.style.top = topper2 + 'px';
	}
	else if (document.layers)
	{
		thelayer2.style.clip.top = clipTop2;
		thelayer2.style.clip.bottom = clipBottom2;
		thelayer2.style.top = topper2;
	}
	time2 = setTimeout('realscroll2()',theTime2);
}

function stopScroll2()
{
	if (time2) clearTimeout(time2);
}
