  var inpsw0 = 0;
  var key = "";
  navi = navigator.appName.toUpperCase();
//alert(navi);
  if (navi.indexOf("NETSCAPE") >= 0){
    window.document.onkeydown = keydwn_event;
  }

function rgbchg(){
  r0 = eval(document.getElementById("r00").value);
  g0 = eval(document.getElementById("g00").value);
  b0 = eval(document.getElementById("b00").value);
  clr0 = r0 * 0x10000 + g0 * 0x100 + b0;
//alert(clr0.toString(16));
  setclr(clr0.toString(16));
}

function inpon(obj){
  obj.style.backgroundColor = "#ffccff";
  inpsw0 = 1;
}

function inpoff(obj){
  obj.style.backgroundColor = "#ffffff";
  inpsw0 = 0;
}

function codchg16(){
  clr0 = document.getElementById("box16").value;
  if (clr0.substring(0,1) == "#") clr0 = clr0.substring(1);
  setclr(clr0);
}

function codchg10(){
  clr0 = eval(document.getElementById("box10").value);
//alert(clr0.toString(16));
  setclr(clr0.toString(16));
}

function keydwn_event(kevent){
  if (navi.indexOf("EXPLORER") >= 0){
    key = event.keyCode;//InternetExplorer
  }
  if (navi.indexOf("NETSCAPE") >= 0){
    key = kevent.which;
  }
  if (navi.indexOf("OPERA") >= 0){
    key = event.keyCode;//InternetExplorer
//alert(key);
    if (key ==  49) key =  97;
    if (key ==  50) key =  98;
    if (key ==  51) key =  99;
    if (key ==  52) key = 100;
    if (key ==  53) key = 101;
    if (key ==  54) key = 102;
    if (key ==  55) key = 103;
    if (key ==  56) key = 104;
    if (key ==  57) key = 105;
    if (key ==  35) key =  35;
  }
  keydwn();
  exit();
  return false;
}

function keydwn(){
  if (inpsw0 == 1) return;

  key0 = "";
  if (key ==  97) key0 = "01";
  if (key ==  98) key0 = "02";
  if (key ==  99) key0 = "03";
  if (key == 100) key0 = "04";
  if (key == 101) key0 = "05";
  if (key == 102) key0 = "06";
  if (key == 103) key0 = "07";
  if (key == 104) key0 = "08";
  if (key == 105) key0 = "09";
  if (key ==  35) key0 = "11";
  if (key ==  40) key0 = "12";
  if (key ==  34) key0 = "13";
  if (key ==  37) key0 = "14";
  if (key ==  12) key0 = "15";
  if (key ==  39) key0 = "16";
  if (key ==  36) key0 = "17";
  if (key ==  38) key0 = "18";
  if (key ==  33) key0 = "19";
//alert(key);
  if (key0 != "") chgclr(key0);

  return false;
}

function chgclr(key0){
//  alert(key0);
  clr0 = eval(document.getElementById("box10").value);
  clr1 = 0;
  if ((key0 == '01') && ((clr0 & 0xff)     >=      0x1)) clr1 =      -0x1;
  if ((key0 == '03') && ((clr0 & 0xff)     <      0xff)) clr1 =       0x1;
  if ((key0 == '11') && ((clr0 & 0xf0)     >=     0x10)) clr1 =     -0x10;
  if ((key0 == '13') && ((clr0 & 0xf0)     <      0xf0)) clr1 =      0x10;
  if ((key0 == '04') && ((clr0 & 0xff00)   >=    0x100)) clr1 =    -0x100;
  if ((key0 == '06') && ((clr0 & 0xff00)   <    0xff00)) clr1 =     0x100;
  if ((key0 == '14') && ((clr0 & 0xf000)   >=   0x1000)) clr1 =   -0x1000;
  if ((key0 == '16') && ((clr0 & 0xf000)   <    0xf000)) clr1 =    0x1000;
  if ((key0 == '07') && ((clr0 & 0xff0000) >=  0x10000)) clr1 =  -0x10000;
  if ((key0 == '09') && ((clr0 & 0xff0000) <  0xff0000)) clr1 =   0x10000;
  if ((key0 == '17') && ((clr0 & 0xf00000) >= 0x100000)) clr1 = -0x100000;
  if ((key0 == '19') && ((clr0 & 0xf00000) <  0xf00000)) clr1 =  0x100000;
  clr0 = clr0 + clr1;
  if (key0 == '08') {
    r0 = eval(document.getElementById("r00").value);
    clr0 = r0 * 0x10000 + r0 * 0x100 + r0;
  }
  if (key0 == '05') {
    g0 = eval(document.getElementById("g00").value);
    clr0 = g0 * 0x10000 + g0 * 0x100 + g0;
  }
  if (key0 == '02') {
    b0 = eval(document.getElementById("b00").value);
    clr0 = b0 * 0x10000 + b0 * 0x100 + b0;
  }
//alert(clr0.toString(16));
  setclr(clr0.toString(16));
  return false;
}

function putclr(tnam0){
  clr0 = document.getElementById("box16").value;
  document.getElementById("td" + tnam0).style.backgroundColor = clr0;
}

function getclr(tnam0){
  clr0 = document.getElementById("td" + tnam0).style.backgroundColor;
  if (clr0.indexOf("rgb")>=0){
    setclr(clr0);
  }else{
    setclr(clr0.toString(16));
  }
}

function chrput(snam0){
  clr0 = document.rgb.box16.value;
  document.getElementById("spn" + snam0).style.backgroundColor = clr0;
  if (clr0 > "#7700") {
    document.getElementById("spn" + snam0).style.color = "#000000";
  } else {
    document.getElementById("spn" + snam0).style.color = "#ffffff";
  }
}

function chrget(snam0){
  clr0 = document.getElementById("spn" + snam0).style.backgroundColor;
  setclr(clr0);
}

function setclr(clr0){
  if (clr0.indexOf("rgb")>=0){
    document.getElementById("td00").style.backgroundColor = clr0;
  }else{
    if (clr0.substring(0,1) == "#") clr0 = clr0.substring(1);
    clr1 = eval('0x' + clr0);
    r0 = Math.floor(clr1 / 0x10000);
    g0 = Math.floor((clr1 - r0 * 0x10000) / 0x100);
    b0 = clr1 - r0 * 0x10000 - g0 * 0x100;
    document.getElementById("r00").value = r0;
    document.getElementById("g00").value = g0;
    document.getElementById("b00").value = b0;
    document.rgb.box16.value = "#" + clr0;
    document.rgb.box10.value = eval('0x' + clr0).toString(10);
    document.getElementById("td00").style.backgroundColor = "#"+clr0;
  }
  return false;
}

