function Bs_Checkbox(objectName) {
this.checkboxName;this.value = 0;this.noPartly = false;this.disabled = false;this.guiNochange = false;this.caption;this.imgDir = '../../../Global/JS/Bs/CheckBox/img/win2k/';this.imgWidth  = '11';this.imgHeight = '11';this.imgStyle = 'margin:3px; vertical-align:middle;';this.useMouseover = true;this.objectName;this.eventOnClick;this.eventOnChange;this._tagId;this.render = function(tagId) {
if (this.noPartly && (this.value == 1)) this.value = 2;if (!bs_isEmpty(tagId)) {
this._tagId = tagId;}
var out  = new Array();var outI = 0;var img = '';img += (this.disabled) ? 'disabled' : 'enabled';img += '_' + this.value;if (!this.disabled) {
out[outI++] = '<span';if (!this.guiNochange) {
out[outI++] = ' onClick="' + this.objectName + '.onClick(\'' + this._tagId + '\');"';}
out[outI++] = ' style="cursor:hand;"';if (this.useMouseover && !this.guiNochange) {
out[outI++] = ' onMouseOver="' + this.objectName + '.onMouseOver(\'' + this._tagId + '\');"';out[outI++] = ' onMouseOut="' + this.objectName + '.onMouseOut(\'' + this._tagId + '\');"';}
out[outI++] = '>';}
out[outI++] = '<img id="' + this._tagId + 'icon" src="' + this.imgDir + img + '.gif" border="0" width="' + this.imgWidth + '" height="' + this.imgHeight + '"';if (!bs_isEmpty(this.imgStyle)) out[outI++] = ' style="' + this.imgStyle + '"';out[outI++] = '>';if (this.caption) {
out[outI++] = '&nbsp;' + this.caption;}
if (!this.disabled) {
out[outI++] = '</span>';}
if (!this.checkboxName) {
this.checkboxName = 'checkbox' + this._tagId;}
var tV = this.value;
if(tV==2)tV=1;
out[outI++] = '<input value="' + tV + '" type=hidden name="' + this.checkboxName + '" id="' + this.checkboxName + '" style="display:none; visibility:hidden;"';if (this.value) out[outI++] = ' checked';out[outI++] = '>';return out.join('');}
this.drawInto = function(tagId) {
if (!bs_isEmpty(tagId)) {
this._tagId = tagId;}
document.getElementById(this._tagId).innerHTML = this.render(this._tagId);}
this.draw = function(tagId) {
this.drawInto(tagId);}
this.write = function() {
document.write(this.render(this._tagId));}
this.convertField = function(fieldId) {
document.getElementById(fieldId).outerHTML = this.render(this._tagId);}
this.onMouseOver = function() {
var img = document.getElementById(this._tagId + 'icon');if (!img.swapOver0) {
img.swapOver0 = new Image();img.swapOver0.src = this.imgDir + 'enabled_0_over.gif';img.swapOver1 = new Image();img.swapOver1.src = this.imgDir + 'enabled_1_over.gif';img.swapOver2 = new Image();img.swapOver2.src = this.imgDir + 'enabled_2_over.gif';img.swapOut0 = new Image();img.swapOut0.src = this.imgDir + 'enabled_0.gif';img.swapOut1 = new Image();img.swapOut1.src = this.imgDir + 'enabled_1.gif';img.swapOut2 = new Image();img.swapOut2.src = this.imgDir + 'enabled_2.gif';}
img.src = img['swapOver' + this.value].src;}
this.onMouseOut = function() {
var img = document.getElementById(this._tagId + 'icon');img.src = img['swapOut' + this.value].src;}
this.onClick = function() {
var cN = document.getElementById(this.checkboxName);
switch (this.value) {
case 0:
this.value = 2;
cN.value = 1;
break;
case 1:
case 2:
this.value = 0;
cN.value=0;
break;
default:
this.value = 0;
cN.value=0;
}
this._updateIcon();if (this.eventOnClick)  this._fireEvent(this.eventOnClick);if (this.eventOnChange) this._fireEvent(this.eventOnChange);}
this.setTo = function(value, cancelEventOnChange) {
this.value = value;this._updateIcon();if (!cancelEventOnChange) {
if (this.eventOnChange) this._fireEvent(this.eventOnChange);}
}
this.attachOnClick = function(globalFunctionName) {
this.eventOnClick = globalFunctionName;}
this.attachOnChange = function(globalFunctionName) {
this.eventOnChange = globalFunctionName;}
this._fireEvent = function(e) {
if (e) {
if (typeof(e) != 'array') {
e = new Array(e);}
for (var i=0; i<e.length; i++) {
if (typeof(e[i]) == 'function') {
e[i](this);} else if (typeof(e[i]) == 'string') {
eval(e[i]);}
}
}
}
this._updateIcon = function() {
var iconElm = document.getElementById(this._tagId + 'icon');if (iconElm != null) {
var img = '';img += (this.disabled) ? 'disabled' : 'enabled';img += '_' + this.value;iconElm.src = this.imgDir + img + '.gif';}
}
if (typeof(objectName) == 'string') {
this.objectName = objectName;}
}

