// VSO Script consolidation by Doug Ashbaugh 5/22/10
// Function added by Doug Ashbaugh to attach onload events
function dlaAddOnLoadEvent(func)
{
    try
    {
        var oldonload = window.onload;
        if (typeof window.onload != "function")
        {
            window.onload = func;
        }
        else
        {
            window.onload = function ()
            {
                oldonload();
                func();
            }
        }
    }
    catch (e)
    {
        alert("Ooops... An error occurred in function /scripts/vsodla.js/dlaAddOnLoadEvent(). Function name:" + func + ", Error: " + e);
    }
}
// Bookmark Script - recoded by Doug Ashbaugh 5/22/10 - did not rename function as site calling it somewhere potentially...
function vsoBookmarkSite(title, url)
{
    // IE 
    try
    {
        if (document.all)
        {
            window.external.AddFavorite(url, title);
            return (true);
        }
    }
    catch (e)
    {
        alert("Oops. Due to browser security settings, we could not automatically add the bookmark. You will have to bookmark the site manually. Sorry for the inconvenience.");
        return (false);
    }
    // Firefox
    try
    {
        if (window.sidebar)
        {
            window.sidebar.addPanel(title, url, "");
            return (true);
        }
    }
    catch (e)
    {
        alert("Oops. Due to browser security settings, we could not automatically add the bookmark. You will have to bookmark the site manually. Sorry for the inconvenience.");
        return (false);
    }
    // Opera
    try
    {
        if (window.opera && window.print)
        {
            var elem = document.createElement('a');
            elem.setAttribute('href', url);
            elem.setAttribute('title', title);
            elem.setAttribute('rel', 'sidebar');
            elem.click();
            return (true);
        }
    }
    catch (e)
    {
        alert("Oops. Due to browser security settings, we could not automatically add the bookmark. You will have to bookmark the site manually. Sorry for the inconvenience.");
        return (false);
    }
}
function makeLink()
{
    //alert("Function makeLink() has been called. Started.");
    var url = 'http://www.vegassports-odds.com';
    var title = 'Vegas Sports Odds';
    vsoBookmarkSite(title, url);
    //alert("Function makeLink() has been called. Finished.");
}
function dlaMain()
{
    var step = '';
    try
    {
        step = 'dlaFixupHovers';
        dlaFixupHovers();
    }
    catch (err)
    {
        alert('Oops. An error has occurred during script /scripts/vsodla.js/ function dlaMain() during execution at step " + step " during page setup. Kindly send this message to the site web master. Error: ' + err.message);
    }
}
function dlaFixupHovers()
{
    try
    {
        var sfEls = document.getElementById("nav").getElementsByTagName("LI");
        for (var i = 0; i < sfEls.length; i++)
        {
            sfEls[i].onmouseover = function ()
            {
                this.className += " sfhover";
            }
            sfEls[i].onmouseout = function ()
            {
                this.className = this.className.replace(new RegExp(" sfhover\\b"), "");
            }
        }
    }
    catch (err)
    {
        alert('Ooops... An error occurred in function dlaFixupHovers(). Error: ' + err.message);
    }
}
function dlaRunTrackers()
{
    try
    {
        var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
        document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    }
    catch (err)
    {
        alert('Ooops... An error occurred in script /scripts/vsodla.js/ atfunction dlaRunTrackers(). Error: ' + err.message);
    }
}
dlaRunTrackers();
dlaAddOnLoadEvent(dlaMain);
