9fb0125e89f6f8185ab346133d23c98380655874
[com.zyxware.civiwci.git] / extern / wciembed.js
1 // Cleanup functions for the document ready method
2 if ( document.addEventListener ) {
3 DOMContentLoaded = function() {
4 document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
5 onReady();
6 };
7 } else if ( document.attachEvent ) {
8 DOMContentLoaded = function() {
9 // Make sure body exists, at least, in case IE gets a little overzealous
10 if ( document.readyState === "complete" ) {
11 document.detachEvent( "onreadystatechange", DOMContentLoaded );
12 onReady();
13 }
14 };
15 }
16 if ( document.readyState === "complete" ) {
17 // Handle it asynchronously to allow scripts the opportunity to delay ready
18 setTimeout( onReady, 1 );
19 }
20
21 // Mozilla, Opera and webkit support this event
22 if ( document.addEventListener ) {
23 // Use the handy event callback
24 document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
25 // A fallback to window.onload, that will always work
26 window.addEventListener( "load", onReady, false );
27 // If IE event model is used
28 } else if ( document.attachEvent ) {
29 // ensure firing before onload,
30 // maybe late but safe also for iframes
31 document.attachEvent("onreadystatechange", DOMContentLoaded);
32
33 // A fallback to window.onload, that will always work
34 window.attachEvent( "onload", onReady );
35 }
36
37 function onReady( ) {
38 document.getElementById('widgetwci').innerHTML = wciwidgetcode;
39 }