function inputCheck(iContainer, iName, iValue) {
    var self = this;
    this.container = iContainer;
    this.name = iName;
    this.value = iValue;

    this.leftImg = null;
    this.rightImg = null;
    this.input = null;

    this.checked;

    this.setState = function(iState) {
        switch (iState) {
            case 0 :
                this.leftImg.src = "images/photo/perm_grant_off.gif";
                this.rightImg.src = "images/photo/perm_deny_on.gif";

                if (this.value != "") {
                    this.checked = "";
                    this.input.value = "";
                } else {
                    this.checked = iState;
                    this.input.value = iState;
                }
                break;

            case -1 :
                this.leftImg.src = "images/photo/perm_grant_off.gif";
                this.rightImg.src = "images/photo/perm_deny_off.gif";

                if (this.value != "") {
                    this.checked = "";
                    this.input.value = "";
                } else {
                    this.checked = iState;
                    this.input.value = iState;
                }
                break;

            default :
                this.leftImg.src = "images/photo/perm_grant_on.gif";
                this.rightImg.src = "images/photo/perm_deny_off.gif";

                if (this.value != "") {
                    this.checked = this.value;
                    this.input.value = this.value;
                } else {
                    this.checked = 1;
                    this.input.value = 1;
                }
                break;
        }
    }

    this.check = function() {
        this.setState(1);
    }

    this.uncheck = function() {
        this.setState(0);
    }

    this.inicialize = function() {
        this.container.style.width = "36px";

        this.leftImg = document.createElement("IMG");
        this.leftImg.src = "images/photo/perm_grant_off.gif";
        this.leftImg.style.cursor = "hand";
        this.leftImg.style.cursor = "pointer";
        this.leftImg.onclick = function() { self.check(); }

        this.rightImg = document.createElement("IMG");
        this.rightImg.src = "images/photo/perm_deny_off.gif";
        this.rightImg.style.marginLeft = "8px";
        this.rightImg.style.cursor = "hand";
        this.rightImg.style.cursor = "pointer";
        this.rightImg.onclick = function() { self.uncheck(); }

        this.input = document.createElement("INPUT");
        this.input.type = "hidden";
        this.input.name = this.name;

        this.container.appendChild( this.leftImg );
        this.container.appendChild( this.rightImg );
        this.container.appendChild( this.input );
    }
    
    this.inicialize();
}
