function Checkbox(title){
	var self = {
		render: function(){
			if(this.checked)
				main.context.drawImage(this.img_checkboxOn, this.x+1, this.y+1, 16, 16);
			else
				main.context.drawImage(this.img_checkboxOff, this.x+1, this.y+1, 16, 16);
			main.context.miterLimit = 2;
			main.context.lineJoin = 'round';
			main.context.strokeStyle = "rgb(0, 0, 0)";
			main.context.lineWidth = 3;
			main.context.strokeText(this.title, this.x+18, this.y+15);
			main.context.fillStyle = "rgb(255, 255, 255)";
			main.context.lineWidth = 1;
			main.context.fillText(this.title, this.x+18, this.y+15);
		},
		setPosition: function(x, y){
			this.x = x;
			this.y = y;
		},
		setTitle: function(title){
			this.title = title;
		},
		onClick: function(x, y){
			if(x>=this.x+1&&x<this.x+15&&y>=this.y+1&&y<this.y+15){
				this.checked = !this.checked;
				this.updateRun();
			}
		},
		updateRun: function(){
			if(this.checked){
				if(this.runOnSelected!=null)
					this.runOnSelected();
			}else{
				if(this.runOnDeselected!=null)
					this.runOnDeselected();
			}
		}
	}
	self.title = title;
	self.x = 0;
	self.y = 0;
	self.checked = false;
	self.img_checkboxOn = new Image();
	self.img_checkboxOn.src = "/files/map/Checkbox On.png";
	self.img_checkboxOff = new Image();
	self.img_checkboxOff.src = "/files/map/Checkbox Off.png";
	return self;
}