function ImgCheckbox(imgId, inputId, imgOn, imgOff) {
    this.imgOn   = imgOn
    this.imgOff  = imgOff
    this.image   = document.getElementById(imgId)
    this.input   = document.getElementById(inputId)
    this.preload_imgOn      = new Image()
    this.preload_imgOn.src  = imgOn
    this.preload_imgOff     = new Image()
    this.preload_imgOff.src = imgOff
    this.input.style.display = "none"
    this.image.style.display = "inline"
    this.setState(this.input.checked)
}

ImgCheckbox.prototype.setState = function(state) {
    this.input.checked     = state
    this.image.src   = state ? this.imgOn : this.imgOff
}

ImgCheckbox.prototype.flip = function() {  this.setState(!this.input.checked)}

function check_certify(errmgs){

if(!$('chbox').checked){$('errors').innerHTML='<div>'+errmsg+'</div>';}
else{$('errors').style.display='none';}
}