 /************************************************\
 |       BROWSER - OS COMPATIBILITY SCRIPT        |
 \************************************************/

/* NOTICE: This is a jQuery-dependent Script */

/* Detects the current Web Browser and Operating System then adds a designated css class
   to the body. This allows css to be target-specific.
  
   LIST OF COMPATIBILITY CLASSES
 
	[OPERATING SYSTEM]
    - WinOS
    - MacOS
 
	[BROWSER + (VERSION SAMPLE)]
    - Firefox	(Firefox3)
    - Safari	(Safari3)
    - Chrome
    - IE		(IE6, IE7, etc)
    - Opera
 
 	[USAGE]
	
	- When adding more than one specification in the CSS, you must make sure that
	  they are combined or multi-classed.
	  
	  Example: Specifying CSS for Windows and Firefox only.
	  
	           .WinOS.Firefox .foo { ... }
			   		 .WinOS.Firefox.Firefox3 .foo { ... }
 
*/


jQuery(document).ready(function($){
    
    var userAgent = navigator.userAgent.toLowerCase();
  $.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase()); 
    
    // Is this a version of IE?
    if($.browser.msie){
        $('body').addClass('IE');
        
        // Add the version number
        $('body').addClass('IE' + $.browser.version.substring(0,1));
    }
    
    
    // Is this a version of Chrome?
    if($.browser.chrome){
    
        $('body').addClass('Chrome');
        
        //Add the version number
        userAgent = userAgent.substring(userAgent.indexOf('chrome/') +7);
        userAgent = userAgent.substring(0,1);
        $('body').addClass('Chrome' + userAgent);
        
        // If it is chrome then jQuery thinks it's safari so we have to tell it it isn't
        $.browser.safari = false;
    }
    
    // Is this a version of Safari?
    if($.browser.safari){
        $('body').addClass('Safari');
        
        // Add the version number
        userAgent = userAgent.substring(userAgent.indexOf('version/') +8);
        userAgent = userAgent.substring(0,1);
        $('body').addClass('Safari' + userAgent);
    }
    
    // Is this a version of Mozilla?
    if($.browser.mozilla){
        
        //Is it Firefox?
        if(navigator.userAgent.toLowerCase().indexOf('firefox') != -1){
            $('body').addClass('Firefox');
            
            // Add the version number
            userAgent = userAgent.substring(userAgent.indexOf('firefox/') +8);
            userAgent = userAgent.substring(0,1);
            $('body').addClass('Firefox' + userAgent);
        }
        // If not then it must be another Mozilla
        else{
            $('body').addClass('Mozilla');
        }
    }
    
    // Is this a version of Opera?
    if($.browser.opera){
        $('body').addClass('Opera');
    }
	
	// OS dectection
	if(navigator.userAgent.toLowerCase().indexOf('win') != -1){
            $('body').addClass('WinOS');
	}
	if(navigator.userAgent.toLowerCase().indexOf('mac') != -1){
            $('body').addClass('MacOS');
	}    
    
});
