var io_objectsLoaded = { timeout: 6000, jQuery: false, nivoJS: false } function addEventHandler(oNode, evt, oFunc, bCaptures) { if (document.addEventListener) oNode.addEventListener(evt, oFunc, bCaptures); else if (document.attachEvent) oNode.attachEvent('on' + evt, oFunc); else oNode['on' + evt] = oFunc; } function addScript(url, callback) { var head = document.getElementsByTagName("head")[0] || document.documentElement; var script = document.createElement("script"); script.src = url; // Handle Script loading var done = false; // Attach handlers for all browsers script.onload = script.onreadystatechange = function () { if (!done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) { done = true; callback(); script.onload = script.onreadystatechange = null; if (head && script.parentNode) { head.removeChild(script); } } }; // Use insertBefore instead of appendChild to circumvent an IE6 bug // This arises when a base node is used (#2709 and #4378). head.insertBefore(script, head.firstChild); } function loadjQuery() { if (typeof $ == "undefined") { // addScript("https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js", function () addScript("/jquery/jquery-1.7.2.min.js", function () { io_objectsLoaded.jQuery = true; loadNivoSliderJS(); }); } else { io_objectsLoaded.jQuery = true; loadNivoSliderJS(); } } function loadNivoSliderJS() { $(function() { if (typeof $(window).nivoSlider == "undefined") { var script = document.createElement("script"); addScript("/globalincludes/slider/jquery.nivo.slider.pack.js", function () { io_objectsLoaded.nivoJS = true; }); } else { io_objectsLoaded.nivoJS = true; } }); } function loadNivoSliderCSS() { var style = document.createElement("link"); style.rel = "stylesheet"; style.href = "/globalincludes/slider/nivo-slider.css"; var head = document.getElementsByTagName("head")[0]; head.appendChild(style); style = document.createElement("link"); style.rel = "stylesheet"; style.href = "/globalincludes/slider/themes/default/default.css"; head.appendChild(style); } function waitForLoad(i, uid, props) { if (!io_objectsLoaded.jQuery || !io_objectsLoaded.nivoJS) { if (i < io_objectsLoaded.timeout / 30) { setTimeout(function () { waitForLoad(i + 1, uid, props); }, 30); } } else { $("#imageSlideshowContainer" + uid).children().each(function() { $(this).css({display: "block"}); }); $("#imageSlideshowContainer" + uid).nivoSlider(props); } } loadjQuery(); loadNivoSliderCSS();