﻿//This code block attaches to the DOMContentLoaded event and runs firedocumentreadyevents() when it is ready.
var alreadyrunflag = 0
if (document.addEventListener) {
    document.addEventListener("DOMContentLoaded", function() { alreadyrunflag = 1; }, false)
}
else if (document.all && !window.opera) 
{
    document.write('<script type="text/javascript" id="contentloadtag" defer="defer" src="javascript:void(0)"><\/script>')
    var contentloadtag = document.getElementById("contentloadtag")
    contentloadtag.onreadystatechange = function() {
        if (this.readyState == "complete") {
            alreadyrunflag = 1
            firedocumentreadyevents();
        }
    }
}

if (document.addEventListener) {
    document.addEventListener("DOMContentLoaded", firedocumentreadyevents, false)
}

//Safari has its own way of doing things....bastards.
if (/Safari/i.test(navigator.userAgent)) {
    var _timer = setInterval(function() {
        if (/loaded|complete/.test(document.readyState)) {
            clearInterval(_timer)
            firedocumentreadyevents();
        }
    }, 50)
}

//This code is a backup plan in case DOMContentLoaded event is not available to browser.
window.onload = function() {
    curvedivs();
    setTimeout("if (!alreadyrunflag){firedocumentreadyevents();}", 50)
}

//This is the firedocumentreadyevents() function. Add methods that you wish launched on document ready here.
function firedocumentreadyevents() {
    curvedivs();
}