Bentornato dalle ferie

Questa la mia versione (molto grezza) dello script: ho riscritto diverse parti... compreso alcuni attributi del css.
codice:
var a;
var cc;

function capture() {
 initColor();
 if(document.layers) {
  layobj = document.layers['wheel'];
  layobj.document.captureEvents(Event.MOUSEMOVE);
  layobj.document.onmousemove = mouseMoved;
 }
 else if (document.all) {
  layobj = document.all["wheel"];
  layobj.onmousemove = mouseMoved;
   }
 else if (document.getElementById) {
  window.document.getElementById("wheel").onmousemove = mouseMoved;
 }
}

function mouseMoved(e) {
 if (document.layers) {
  x = e.layerX;
  y = e.layerY;
 }
 else if (document.all) {
  x = event.offsetX;
  y = event.offsetY;
 }
 else if (document.getElementById) {
  x = (e.pageX - document.getElementById("wheel").offsetLeft);
  y = (e.pageY - document.getElementById("wheel").offsetTop);
 }

// identifico il range

rd=255 // valori dei colori base a destra
gd=255
bd=255

rs=0 // valori dei colori base a sinistra
gs=0
bs=0

px=x-363 // posizione del cursore - posoizione inizio colore attuale
rng=416-363 // range della finestra fra due colori

if(x<363) {
	rd=rs
	gd=gs
	bd=bs
	rs=0
	gs=255
	bs=0
	px=x-313
	rng=50
} 
if(x<313) {
	rd=rs
	gd=gs
	bd=bs
	rs=0
	gs=255
	bs=255
	px=x-260
	rng=53
} 
if(x<260) {
	rd=rs
	gd=gs
	bd=bs
	rs=0
	gs=0
	bs=255
	px=x-207
	rng=47
} 
if(x<207) {
	rd=rs
	gd=gs
	bd=bs
	rs=255
	gs=0
	bs=255
	px=x-155
	rng=52
} 
if(x<155) {
	rd=rs
	gd=gs
	bd=bs
	rs=255
	gs=0
	bs=0
	px=x-103
	rng=48
} 
if(x<103) {
	rd=rs
	gd=gs
	bd=bs
	rs=255
	gs=255
	bs=0
	px=x-52
	rng=51
} 
if(x<52) {
	rd=rs
	gd=gs
	bd=bs
	rs=255
	gs=255
	bs=255
	px=x
	rng=52
} 
// ora calcolo la percentuale di ciascun colore
pr = parseInt((rd-rs)/rng*px+rs)%256
pg = parseInt((gd-gs)/rng*px+gs)%256
pb = parseInt((bd-bs)/rng*px+bs)%256

// trasformo in exa
c="0123456789ABCDEF"
cc = "#" + 
	c.charAt(parseInt(pr/16))+c.charAt(parseInt(pr%16))+
	c.charAt(parseInt(pg/16))+c.charAt(parseInt(pg%16))+
	c.charAt(parseInt(pb/16))+c.charAt(parseInt(pb%16))


   hoverColor();
   return false;
}

function hoverColor() {
 document.getElementById(a+'Div').style.backgroundColor = cc;
 document.forms[0].elements[a].value = cc;
 return false;
}

function pickColor() {
 document.getElementById(a+'Div').style.backgroundColor = cc;
 document.forms[0].elements[a].value = cc;
 document.getElementById('wheel').style.visibility='hidden';
 document.getElementById('wheel').style.display='none';
}

function initColor() {
	document.getElementById('wheel').style.visibility='visible';
	document.getElementById('wheel').style.display='inline';
}

function mostraDiv(dd){
	if(document.getElementById(dd).style.visibility=='hidden'){	
		nascondiSelect('hidden');
		document.getElementById(dd).style.visibility='visible';
		document.getElementById(dd).style.display='inline';
	}else{
		nascondiSelect('visible');
		document.getElementById(dd).style.visibility='hidden';
		document.getElementById(dd).style.display='none';
	}
}
ciao