// // OnReady Utilities v 1.1 by steven@datafeedfile.com // var dff_tool = { }; dff_tool.execute_on_dom_ready = function(callback) { // execute callback on DOM ready var callback_executed = false, execute_callback = function() { if ( callback_executed ) return; callback_executed = true; callback(); }; if ( document.addEventListener ) { // Mozilla, Opera, webkit nightlies document.addEventListener("DOMContentLoaded",function() { document.removeEventListener( "DOMContentLoaded", arguments.callee, false ); execute_callback(); },false); // browsers with window and addEventListener but no DOMContentLoaded event if ( typeof window == "object" && window.addEventListener ) { window.addEventListener("load",execute_callback,false); } } else if ( document.attachEvent ) { // IE document.attachEvent("onreadystatechange",function() { if ( document.readyState === "complete" ) { document.detachEvent("onreadystatechange",arguments.callee); execute_callback(); } }); if ( document.documentElement.doScroll && window == window.top ) (function() { if ( callback_executed ) return; try { document.documentElement.doScroll("left"); } catch ( error ) { setTimeout(arguments.callee,0); return; } execute_callback(); })(); } // if none of the above browsers is used, then the script does nothing }; dff_tool.execute_on_jquery_ready = function(callback) { // load jQuery 1.7.2 if jQuery 1.7.2+ is not loaded, then execute callback if ( typeof jQuery != 'undefined' && /[1-9]\.[7-9]\.[2-9]/.test(jQuery.fn.jquery) ) { callback(); } else { var head = document.getElementsByTagName('head')[0], s = document.createElement('script'); // do not save context s.type = 'text/javascript'; s.src = '//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js'; head.appendChild(s); var i = setInterval(function() { if ( typeof jQuery != 'undefined' && /[1-9]\.[7-9]\.[2-9]/.test(jQuery.fn.jquery) ) { clearInterval(i); callback(); jQuery.noConflict(true); } },10); } };dff_tool.execute_on_dom_ready(function() { /* dff_tool version of jQuery's ready() (needed because jQuery may not be loaded) */ dff_tool.execute_on_jquery_ready(function() { /* if jQuery is not loaded, then load jQuery on DOM ready and execute callback */ /*