/*  ADD-IE-CLASS.JS
*
*   Fixes for Internet Explorer -> Adds an appropriate class to the <body>-tag.
*
*   Author: John Sundell
*/

window.onload = function addIEClass() {
    
    //Get user agent and check for IE
    var userAgent = window.navigator.userAgent;
    var ieVersionString = userAgent.indexOf("MSIE");

    if (ieVersionString >= 0) {

        //User agent is Internet Explorer, determine version number
        ieVersionNumber = parseInt(userAgent.substring(ieVersionString + 5, userAgent.indexOf(".", ieVersionString)));

        //Add the appropriate class to the <body>-tag
        if (ieVersionNumber) {
            
            //Set Classname
            var className = "ie" + ieVersionNumber;

            //Add the classname to the body-tag
            $("body").addClass(className);

        }

    }

}
