In your page.tpl.php file:
$my_settings = array(
'message' => $message,
);
drupal_add_js(array('my_settings' => $my_settings), 'setting');
Then in your JavaScript file you can access $message
variable like this:
var message = Drupal.settings.my_settings.message;
Reference: HOWTO: Pass PHP variables to JavaScriptThe Drupal JavaScript API