protected function registerClientScript($id) {

        $booster = Booster::getBooster();
        $booster->registerPackage('switch');
		$config = CJavaScript::encode($this->options);

		ob_start();
		echo "$('input#$id').bootstrapSwitch({$config})";
		foreach ($this->events as $event => $handler) {
			$event = $event.'.bootstrapSwitch';
			if (!$handler instanceof CJavaScriptExpression && strpos($handler, 'js:') === 0)
				$handler = new CJavaScriptExpression($handler);
			echo ".on('{$event}', " . $handler . ")";
		}

		Yii::app()->clientScript->registerScript(__CLASS__ . '#' . $this->getId(), ob_get_clean() . ';');
	}