/** * Main Seagull JavaScript library. * * @package seagull * @subpackage SGL */ var SGL = { isReady: false, ready: function(f) { // If the DOM is already ready if (SGL.isReady) { // Execute the function immediately if (typeof f == 'string') { eval(f); } else if (typeof f == 'function') { f.apply(document); } // Otherwise add the function to the wait list } else { SGL.onReadyDomEvents.push(f); } }, onReadyDomEvents: [], onReadyDom: function() { // make sure that the DOM is not already loaded if (!SGL.isReady) { // Flag the DOM as ready SGL.isReady = true; if (SGL.onReadyDomEvents) { for (var i = 0, j = SGL.onReadyDomEvents.length; i < j; i++) { if (typeof SGL.onReadyDomEvents[i] == 'string') { eval(SGL.onReadyDomEvents[i]); } else if (typeof SGL.onReadyDomEvents[i] == 'function') { SGL.onReadyDomEvents[i].apply(document); } } // Reset the list of functions SGL.onReadyDomEvents = null; } } } }; /** * Cross-browser onDomReady solution * Dean Edwards/Matthias Miller/John Resig */ new function() { /* for Mozilla/Opera9 */ if (document.addEventListener) { document.addEventListener("DOMContentLoaded", SGL.onReadyDom, false); } /* for Internet Explorer */ /*@cc_on @*/ /*@if (@_win32) document.write("