﻿jQuery(document).ready(function() {
    var sDomain = new String('');
    var slocation = new String(document.location);
    slocation = slocation.toLowerCase();

    var njsDev = slocation.indexOf('.dev');
    var njsStg = slocation.indexOf('.stg');
    var njsLive = slocation.indexOf('www.');
    var njsDevSharePoint = slocation.indexOf('.spdev');
    var njsStgSharePoint = slocation.indexOf('.spstg');

    if ((njsDev > 0) || (njsDevSharePoint > 0)) {
        sDomain = 'http://dev1.';
    }
    else {
        if ((njsStg > 0) || (njsStgSharePoint > 0)) {
            sDomain = 'http://stg1.';
        }
        else {
            sDomain = 'http://www.';

            //Make sure site loads in www. mode
            if (njsLive <= 0) {
                slocation = slocation.replace("http://", "http://www.");
                window.location = slocation;
            }

        }
    }

    sDomain = sDomain + 'auctiontime.com/hostedsitejs/HostedAuctionTimeIFrameJSWithSubnav.aspx';

    var fileref = document.createElement('script')
    fileref.setAttribute("type", "text/javascript")
    fileref.setAttribute("src", sDomain)
    document.getElementsByTagName("body")[0].appendChild(fileref)
});
