/********************************************************************************************
* BlueShoes Framework; This file is part of the php application framework.
* NOTE: This code is stripped (obfuscated). To get the clean documented code goto 
*       www.blueshoes.org and register for the free open source *DEVELOPER* version or 
*       buy the commercial version.
* 
* @copyright see www.blueshoes.org
* @author    Samuel Blume <sam at blueshoes dot org>
* @author    Andrej Arn <andrej at blueshoes dot org>
*/function Bs_Checkbox() {this.objectName;this.value = 0;this.disabled = false;this.guiNochange;this.caption;this.checkboxName;this.imgDir = 'images/img/win2k/';this.imgWidth  = '20';this.imgHeight = '20';this.useMouseover = false;this._spanId;this.eventOnClick;this.eventOnChange;this.constructor = function() {}
this.render = function(spanId) {if (spanId) {this._spanId = spanId;}
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._spanId + '\');"';}
out[outI++] = ' style="cursor:hand;"';if (this.useMouseover && !this.guiNochange) {out[outI++] = ' onMouseOver="' + this.objectName + '.onMouseOver(\'' + this._spanId + '\');"';out[outI++] = ' onMouseOut="' + this.objectName + '.onMouseOut(\'' + this._spanId + '\');"';}
out[outI++] = '>';}
out[outI++] = '<img id="' + this._spanId + 'icon" src="' + this.imgDir + img + '.gif" border="0" width="' + this.imgWidth + '" height="' + this.imgHeight + '"';out[outI++] = '>';if (this.caption) {out[outI++] = '&nbsp;' + this.caption;}
if (!this.disabled) {out[outI++] = '</span>';}
if (!this.checkboxName) {this.checkboxName = 'checkbox' + this._spanId;}
out[outI++] = '<input value="' + this.value + '" type=checkbox name="' + this.checkboxName + '" id="' + this.checkboxName + '" style="display:none; visibility:hidden;"';if (this.value) out[outI++] = ' checked';out[outI++] = '>';return out.join('');}
this.onMouseOver = function() {var img = document.getElementById(this._spanId + '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._spanId + 'icon');img.src = img['swapOut' + this.value].src;}
this.draw = function(spanId) {if (spanId) {this._spanId = spanId;}
var out = this.render(this._spanId);var spanTag = document.getElementById(this._spanId);spanTag.innerHTML = out;}
this.write = function() {document.write(this.render(this._spanId));}
this.onClick = function() {switch (this.value) {case 0:
this.value = 2;break;case 1:
case 2:
this.value = 0;this.value = 0;break;default:
this.value = 0;}
this.draw();if (this.eventOnClick) this._fireEvent(this.eventOnClick);if (this.eventOnChange) this._fireEvent(this.eventOnChange);}
this.setTo = function(value, cancelEventOnChange) {this.value = value;this.draw();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.constructor();}

