final private function getMessageScript() {
		
		$script = '';
		
		if (count($this->messages)) {

			foreach ($this->messages as $m) {
		
				$types = array('info', 'warning', 'error');
				if (!in_array($m->type, $types)) $m->type = 'info';
				$script .= '$.showMessage("' .
					addslashes($m->title) . '","' .
					addcslashes($m->text,"\"\n\r") . '","' . // removes carriage returns and quotes
					addslashes($m->type) . "\");\n";
				
			}
			
		}

		return $script;
		
	}