/*CHECKBOX*/
function initRichCheckbox() { 
    var els = document.getElementsByTagName('input');
    for(var i=0; i<els.length; i++) {
       if (els[i].type=='checkbox'){
        new RichCheckbox(els[i]); 
       } 
    }
} 
   
function RichCheckbox(org) {
    this.state=false;
    this.orgcheckbox=org;
    this.checkboxDiv;
    this.initialize();
} 
RichCheckbox.prototype.initialize = function () {
    this.checkboxDiv = document.createElement('div');
    if(this.orgcheckbox.checked==true) {
        this.checkboxDiv.className='richCheckboxOn';
    }
    else {
        this.checkboxDiv.className='richCheckboxOff';
    }
    this.orgcheckbox.parentNode.insertBefore(this.checkboxDiv, this.orgcheckbox);
    var self=this;
    this.checkboxDiv.onclick = function() { 
        self.togglebox();
    }
    this.orgcheckbox.style.display='none';

}
RichCheckbox.prototype.togglebox = function(num) {
    if(this.orgcheckbox.checked==true) {
        this.orgcheckbox.checked=false;
        this.checkboxDiv.className='richCheckboxOff';
    }
    else {
        this.orgcheckbox.checked=true;
        this.checkboxDiv.className='richCheckboxOn';
    }
}
function initRichForms() { initRichCheckbox();  }
    


if (window.addEventListener) {
	window.addEventListener("load",initRichForms,false);
} else if (window.attachEvent) {
	window.attachEvent("onload",initRichForms);
} else {
	window.onload = function() {initRichForms();}
}
