public function addJsVar($vars, $value, $encode = false) {
        if (is_array($vars)) {
            foreach ($vars as $key => $value) {
                // if JSONencode it's enable then is because it doesn't want json_encode.
                $this->addJsVar($key, $value);
            }
        } else { // apply the logic
            $this->scriptVars = $this->scriptVars . "var $vars = " . ($encode ? json_encode($value) : $value) . ";";
        }
    }