
ox = {};

/* taken from api.js */
ox.browser = (function () {
    // adopted from prototype.js
    var ua = navigator.userAgent,
        isOpera = Object.prototype.toString.call(window.opera) === "[object Opera]",
        isIE = !!window.attachEvent && !isOpera,
        webkit = ua.indexOf('AppleWebKit/') > -1,
        chrome = ua.indexOf('Chrome/') > -1;
    return {
        /** @lends ox.browser */
        /** is IE? */
        IE: isIE,
        /** is IE9? */
        IE9: isIE && /MSIE 9/.test(ua),
        /** is Opera? */
        Opera: isOpera,
        /** is WebKit? */
        WebKit: webkit,
        /** Safari */
        Safari: webkit && !chrome,
        /** Safari */
        Chrome: webkit && chrome,
        /** is Gecko/Firefox? */
        Gecko:  ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') === -1,
        /** MacOS **/
        MacOS: ua.indexOf('Macintosh') > -1
    };
}());

// get html tag
var html = document.getElementsByTagName("html")[0],
    htmlClass = "";
if (html) {
    // set browser class
    if (ox.browser.Gecko) {
        htmlClass = "firefox";
    } else if (ox.browser.WebKit) {
        htmlClass = "webkit";
    } else if (ox.browser.IE9) {
        htmlClass = "IE9";
    } else if (ox.browser.IE) {
        htmlClass = "IE";
    }
    // add os
    if (ox.browser.MacOS) {
        htmlClass += " macos";
    }
    // set
    html.className = htmlClass;
}

