// <body onload="icbCBoxtoImgCB(*id*,*state*,'*ImageTrue*','*ImageFalse*','*width*,*height*);" >
// *id*         = id of the image checkbox (string)
// *state*      = the initial condition (true or false )
// *ImageTrue*  = the image to be displayed for the 'true' condition (string)
// *ImageFalse* = the image to be displayed for the 'false' condition (string)
// *width*      = the width of the image (optional)(digits)
// *height*     = the height of the image (optional)(digits)

function icbCheckBoxMoniter(icb){
  //alert('CheckBox '+icb.id+' is '+icb.checked);
}

var icbUpdater=false;
var icbCursor='pointer';
if (document.all){ icbCursor='hand'; }

function icbCBoxtoImgCB(icb,icbs,icbT,icbF,icbw,icbh,updater){
	icbUpdater=updater;
  icbNewImg=document.createElement('img');
  icbNewImg.id='icb'+icb;
  icbcb=document.getElementById(icb);
  icbcb.parentNode.insertBefore(icbNewImg,icbcb);
  icbNewImg.style.cursor=icbCursor;
  if (icbw!=null&&icbh!=null){ icbNewImg.width=icbw; icbNewImg.height=icbh; }
  icbNewImg.cb=icbcb;
  icbNewImg.icbT=icbT;
  icbNewImg.icbF=icbF;
  icbNewImg.onclick=function(){ icbImgCBox(this); };
  if (icbs){ icbNewImg.src=icbT; } else { icbNewImg.src=icbF; }
  icbcb.checked=icbs;
  icbcb.style.position='absolute';
  icbcb.style.visibility='hidden';
}

function icbImgCBox(icb) {
  if (icb.cb.checked) {
    icb.src=icb.icbF;
    icb.cb.checked=false;
  } else {
    icb.src=icb.icbT;
    icb.cb.checked=true;
  }
  icbCheckBoxMoniter(icb.cb);
  
  if (icbUpdater == "demo") UpdateCheckedDemo();
  else if(icbUpdater == true) Selection_Update();
}

function icbImgUpdate(icb) {
  if (icb.cb.checked) icb.src=icb.icbT;
  else icb.src=icb.icbF;
  icbCheckBoxMoniter(icb.cb);
}