

	var hexbase="0123456789ABCDEF";
	var myR,myG,myB;
	
	dateMS=211093115000;
	initTime=new Date();
	function startClock() {
		currentTime=new Date();
		diffMS= currentTime.getTime()-initTime.getTime()+dateMS;

		tmp=""
		pourcent=diffMS/(90000000+420000+40000)-Math.floor(diffMS/(90000000+420000+40000))
		if (pourcent<0.5) {
			myR=Math.floor(-102*pourcent+51)
			myG=Math.floor(2*256*pourcent)
			myB=Math.floor(-102*pourcent+51)
		} else {
			myR=Math.floor(2*51*pourcent-51)
			myG=Math.floor(-2*256*pourcent+2*256)
			myB=Math.floor(2*51*pourcent-51)
		}				
		myColor="#"+DecToHex(myR)+DecToHex(myG)+DecToHex(myB);
		document.bgColor=myColor;	
//		alert(myColor)
		if (document.mainForm) {
			//jour:
			tmp=setSixNumbers(Math.floor(diffMS/(90000000+420000+40000)));
			diffMS=diffMS%(90000000+420000+40000)
			heure:
			tmp=tmp+" // "+setTwoNumbers(Math.floor(diffMS/1000/60/60))
			diffMS=diffMS%(1000*60*60)
			minute:
			tmp=tmp+":"+setTwoNumbers(Math.floor(diffMS/1000/60))
			diffMS=diffMS%(1000*60)
			seconde:
			tmp=tmp+":"+setTwoNumbers(Math.floor(diffMS/1000))
			//tmp=tmp+"  -> RGB="+myR+":"+myG+":"+myB; 
			document.mainForm.clockText.value=tmp;
		}
		if (Math.floor(Math.random()*20)==0) startSmallFading();
		if (Math.floor(diffMS/1000)==30) startFading();
		setTimeout("startClock()",1000);

	}
		
	function startFading() {
		for (i=40;i>=0;i--) {
			if ((i/2)==Math.floor(i/2)) s=-1; else s=1;
			myColor="#"+DecToHex(myR+s*i)+DecToHex(myG+s*i)+DecToHex(myB+s*i);
			document.bgColor=myColor;
		}
	}
		
	function startSmallFading() {
		for (i=10;i>=0;i--) {
			if ((i/2)==Math.floor(i/2)) s=-1; else s=1;
			myColor="#"+DecToHex(myR+s*i)+DecToHex(myG+s*i)+DecToHex(myB+s*i);
			document.bgColor=myColor;
		}
	}
		
	function setTwoNumbers(n) {
		if (n<10) return "0"+n; else return ""+n;
	}
	
	function setSixNumbers(n) {
		if (n<10) return "00000"+n;
		if (n<100) return "0000"+n;
		if (n<1000) return "000"+n;
		if (n<10000) return "00"+n; else return "0"+n;
	}
	
	
	function init() {
		setTimeout('document.location.reload(true)',60000);
	}
	
	document.onload=init();
		
	nbFrames=50;			// Number of frames in the animation.
	origRed=255;			// Initial value used as color parameter for Red, Green and Blue channels. 

	function colorfade() {
		if (nbFrames>0) {
			// Animates until cc >0. It's an animation in 20 steps. Note that cc was initialized with 20. 
			origRed-=5;
	
			// Sets the color value. 
			document.getElementById("myId").style.color="rgb("+origRed+","+origRed+","+origRed+")";
			// Decreases the animation counter. 
			nbFrames--;
			// Call colorfade again...
			setTimeout("colorfade()",20);
		}
	}

	function DecToHex(number) {
		// take a decimal integer, return 2-digit hex string
		return hexbase.charAt((number>> 4)& 0xf)+ hexbase.charAt(number& 0xf);
	}
