Create a new global PApp::ECMAScript object, storing it in the (exported) variable $js, which should be shared between all modules for caching purposes. Consequently, this function should be called once in the request callback or in the global stylesheet.

Escape the given string as required and return it (escape_string_sq will use single quotes to delimit the string, escape_string_dq will use double quotes). Remember that many browsers do not like quoting, so use the right function to minimize impact.

js => the javascript object to use (default $PApp::ECMAScript::js)
id => the name (html id), default autogenerated
content => the content of the layer/div element
element => the element used for the layer

Return the javascript code used to create the (initially hidden) layer. The best place for this is the top of the document, just below the BODY tag, but that's not a requirement for working browsers ;)

Please note that all javascript code returned is not quoted, which is not a problem when outputting it directly since browsers actually EXPECT misquoted input, but it is a problem when you output strict html (xml) or want to feed this into an XSLT stylesheet, in which case you need to escape_html() the code first and use disable-output-escaping in your stylesheet to deliberatly create broken HTML on output.