var hexc=new Array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
var currentid="";

function mMouseOver(id,v,r1,g1,b1,r2,g2,b2) {
	currentid=id;
	mFadeIn(id,0,v,r1,g1,b1,r2,g2,b2);
}

function mMouseOut(id,v,r1,g1,b1,r2,g2,b2) {
	currentid="";
	mFadeOut(id,0,v,r1,g1,b1,r2,g2,b2);
}

function mLink(lien) {
  location.href = lien;
}  

function mFadeIn(id,x,v,r1,g1,b1,r2,g2,b2) {
	if(x<=100&&id==currentid) {
    col=Math.floor(r1+((r2-r1)*x/100));
    h1=hexc[Math.floor(col/16)];
    h2=hexc[col%16];
	  col=Math.floor(g1+((g2-g1)*x/100));
	  h3=hexc[Math.floor(col/16)];
	  h4=hexc[col%16];
	  col=Math.floor(b1+((b2-b1)*x/100));
	  h5=hexc[Math.floor(col/16)];
	  h6=hexc[col%16];
	  document.getElementById(id).style.color = "#"+h1+h2+h3+h4+h5+h6;
	  nextstep="mFadeIn('"+id+"',"+(x+v)+","+v+","+r1+","+g1+","+b1+","+r2+","+g2+","+b2+")";
	  timer=setTimeout(nextstep,1);
  }
}

function mFadeOut(id,x,v,r1,g1,b1,r2,g2,b2) {
	if(x<=100&&id!=currentid) {
	  col=Math.floor(r1+((r2-r1)*x/100));
	  h1=hexc[Math.floor(col/16)];
	  h2=hexc[col%16];
	  col=Math.floor(g1+((g2-g1)*x/100));
	  h3=hexc[Math.floor(col/16)];
	  h4=hexc[col%16];
	  col=Math.floor(b1+((b2-b1)*x/100));
	  h5=hexc[Math.floor(col/16)];
	  h6=hexc[col%16];
	  document.getElementById(id).style.color = "#"+h1+h2+h3+h4+h5+h6;
	  nextstep="mFadeOut('"+id+"',"+(x+v)+","+v+","+r1+","+g1+","+b1+","+r2+","+g2+","+b2+")";
	  timer=setTimeout(nextstep,1);
	}
}

function tMouseOver(id,v,r1,g1,b1,r2,g2,b2) {
	currentid=id;
	tFadeIn(id,0,v,r1,g1,b1,r2,g2,b2);
}

function tMouseOut(id,v,r1,g1,b1,r2,g2,b2) {
	currentid="";
	tFadeOut(id,0,v,r1,g1,b1,r2,g2,b2);
}

function tLink(lien) {
  location.href = lien;
}  

function tFadeIn(id,x,v,r1,g1,b1,r2,g2,b2) {
	if(x<=100&&id==currentid) {
    col=Math.floor(r1+((r2-r1)*x/100));
    h1=hexc[Math.floor(col/16)];
    h2=hexc[col%16];
	  col=Math.floor(g1+((g2-g1)*x/100));
	  h3=hexc[Math.floor(col/16)];
	  h4=hexc[col%16];
	  col=Math.floor(b1+((b2-b1)*x/100));
	  h5=hexc[Math.floor(col/16)];
	  h6=hexc[col%16];
	  document.getElementById(id).style.background = "#"+h1+h2+h3+h4+h5+h6;
	  nextstep="tFadeIn('"+id+"',"+(x+v)+","+v+","+r1+","+g1+","+b1+","+r2+","+g2+","+b2+")";
	  timer=setTimeout(nextstep,1);
  }
}

function tFadeOut(id,x,v,r1,g1,b1,r2,g2,b2) {
	if(x<=100&&id!=currentid) {
	  col=Math.floor(r1+((r2-r1)*x/100));
	  h1=hexc[Math.floor(col/16)];
	  h2=hexc[col%16];
	  col=Math.floor(g1+((g2-g1)*x/100));
	  h3=hexc[Math.floor(col/16)];
	  h4=hexc[col%16];
	  col=Math.floor(b1+((b2-b1)*x/100));
	  h5=hexc[Math.floor(col/16)];
	  h6=hexc[col%16];
	  document.getElementById(id).style.background = "#"+h1+h2+h3+h4+h5+h6;
	  nextstep="tFadeOut('"+id+"',"+(x+v)+","+v+","+r1+","+g1+","+b1+","+r2+","+g2+","+b2+")";
	  timer=setTimeout(nextstep,1);
	}
}

function bMouseOver(id) {
  document.getElementById(id).style.color = "#ff0000";
}

function bMouseOut(id) {
  document.getElementById(id).style.color = "#543A12";
}
