function getHex ( C ) {
	if ( C < 16 ) return  "0" + C.toString(16);
	else return C.toString(16);
}

function getVal ( id ) {
	return parseInt(document.getElementById ( 'value_display_' + id ).value);
}

function CheckColor () {
	k = 1.8;
	R = getVal ( 3 );
	G = getVal ( 1 );
	B = getVal ( 2 );
	newcolor = "#" + getHex(R) + getHex(G) + getHex(B);
	r = 255 - parseInt(( 256 - R ) / k);
	g = 255 - parseInt(( 256 - G ) / k);
	b = 255 - parseInt(( 256 - B ) / k);
	oldcolor = "#" + getHex(r) + getHex(g) + getHex(b);	
	document.getElementById ( 'newmsg' ).style.color = newcolor;
	document.getElementById ( 'oldmsg' ).style.color = oldcolor;
}

