Initial version of the script for asynchronous ad-fetching from OpenX
openx.js replaces the OpenX-script spcjs.php. It is modified in such a
way, that it can be called at the bottom of the HTML-page, just before the
closing </body>-tag, so that the ads are loaded, when the rendering of the
page is already completed and, thus, do not block the rendering of the
page.
Implementation-details:
* openx.js searches via jQery for DOM-elements, that are marked with the
CSS-class "oa". It fetches banners for all found elements (which banners
are to fetch is encoded in a second CSS-class).
* openx.js takes seperate steps to
1. fetch the banners,
2. render them in the page and
3. show them.
This is necessary, because most of the second-party ad-scripts work
with document.write(), so that the created banners first become
accessable via the DOM, when the script returns.
* Banners are rendert first into a div-block marked with "display:none".
They are moved to their final destination afterwards. This is necessary,
because "document.write()" always writes to the actual position of the
HTML-document, that is the position, where the browser found the
openx.js-script he is just executing. Hence, all ad-scripts that call
"document.write()" itself, would render their banner at the bottom of
the page, albeit the script itself was appended to the right DOM
-element. The Banners are renderd in a hidden div-block, because it has
shown, that some ad-scripts produce errors, when they are moved, so that
the ad was visible in two places afterwards: the div-block at the end of
the page and at the intended position.
TODO:
* Not tested with IE yet!