function setCookie(name, value, expires, path, domain, secure) {
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

function changeStyle(title) {
    if (title.length > 0 && title != null) {
        if (document.styleSheets.length) {
            for (var y = 0; y < document.styleSheets.length; y++ ) {
                if (document.styleSheets[y].title == title) {
                    document.styleSheets[y].disabled = false;
                } else if (document.styleSheets[y].title.length > 0 && !document.styleSheets[y].isDisabled) {
                    document.styleSheets[y].disabled = true;
                }
            }
        }
    }
}

function checkStyle() {
    if (!document.all && document.getElementById) {
    } else if (document.all) {
        changeStyle('ie');
    } else {
        alert('Our web site may not display properly based on the browser you are using.');
    }
}

/*
function trackUser() {
    var cook = getCookie('trionTracker');
    var curLoco = new String();
    //var delimiter = '][';
    curLoco = document.location.pathname + document.location.search;

    var msg = new String();
    if (cook == null) {
        setCookie('trionTracker', curLoco, null, '/');
    } else {
        setCookie('trionTracker', cook + "\n" + curLoco, null, '/');
    }
}
*/

function init() {
    // handle IE
    checkStyle();

    // track the user using cookies
    //trackUser();

    //var tmp = getCookie('trionTracker');
    //alert(tmp);
}

if (navigator) {
    var ie = (navigator.appName.indexOf('Microsoft') != -1) ? true : false;
    var mac = (navigator.appVersion.indexOf('Macintosh') != -1) ? true : false;
    if (ie && mac) {
        // make sure that the person is only warned once this session
        var warned = getCookie('warnedMacIE');
        if (warned == null) {
            setCookie('warnedMacIE', 'ISureDid');
            alert('Please note: To assure you of the best possible viewing experience while using a Macintosh computer, Trion Online is optimized for use with Safari and Firefox browsers. We cannot guarantee the functionality while using Internet Explorer.');
        }
    }
}

/* wait for the body to load before we try and resize */
window.onload = init;