public function registerScripts()
 {
     parent::registerScripts();
     $chartTypesRequiringSecondInputs = ChartRules::getChartTypesRequiringSecondInputs();
     $script = '
             if ($(".chart-selector:checked").val() != "")
             {
                 $("#series-and-range-areas").detach().insertAfter( $(".chart-selector:checked").parent()).removeClass("hidden-element");
             }
             $(".chart-selector").live("change", function()
                 {
                     onChangeChartType(this);
                 }
             );
             function onChangeChartType(changedChartObject)
             {
                 $("#series-and-range-areas").detach().insertAfter( $(changedChartObject).parent()  ).removeClass("hidden-element");
                 arr = ' . CJSON::encode($chartTypesRequiringSecondInputs) . ';
                 if ($(changedChartObject).val() == "")
                 {
                     $("#series-and-range-areas").addClass("hidden-element")
                     $(".first-series-and-range-area").hide();
                     $(".first-series-and-range-area").find("select option:selected").removeAttr("selected");
                     $(".first-series-and-range-area").find("select").prop("disabled", true);
                 }
                 else
                 {
                     $(".first-series-and-range-area").show();
                     $(".first-series-and-range-area").find("select").prop("disabled", false);
                 }
                 if ($.inArray($(changedChartObject).val(), arr) != -1)
                 {
                     $(".second-series-and-range-area").show();
                     $(".second-series-and-range-area").find("select").prop("disabled", false);
                 }
                 else
                 {
                     $(".second-series-and-range-area").hide();
                     $(".second-series-and-range-area").find("select option:selected").removeAttr("selected");
                     $(".second-series-and-range-area").find("select").prop("disabled", true);
                 }
             }
         ';
     Yii::app()->getClientScript()->registerScript('ChartChangingScript', $script);
 }
 protected function registerScripts()
 {
     parent::registerScripts();
     $script = '
             $(".droppable-dynamic-rows-container.' . static::getTreeType() . '").live("drop", function(event, ui)
             {
                 ' . $this->getAjaxForDroppedAttribute() . '
             });
             $(".item-to-place", "#' . static::getTreeType() . 'TreeArea").live("dblclick", function(event)
             {
                 ' . $this->getAjaxForDoubleClickedAttribute() . '
             });
             $(".remove-dynamic-row-link.' . static::getTreeType() . '").live("click", function()
             {
                 var size = $("#' . get_class($this) . ' .dynamic-rows > ul > li").length;
                 $(this).parent().parent().remove(); //removes the <li>
                 if (size < 2)
                 {
                     $(".' . static::getZeroComponentsClassName() . '").fadeIn(400);
                 }
                 ' . $this->getReportAttributeRowAddOrRemoveExtraScript() . '
                 return false;
             });
         ';
     Yii::app()->getClientScript()->registerScript(static::getTreeType() . 'ReportComponentForTreeScript', $script);
 }