
// Checks the browser and adds classes to the body to reflect it.

$j(document).ready(function(){
	
	var userAgent = navigator.userAgent.toLowerCase();
	$j.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase()); 
	
	// Is this a version of IE?
	if ($j.browser.msie) {
		$j('body').addClass('browserIE');
		
		// Add the version number
		$j('body').addClass('browserIE' + $j.browser.version.substring(0, 1));
	}
	
	
	// Is this a version of Chrome?
	if ($j.browser.chrome) {

		$j('body').addClass('browserChrome');
		
		//Add the version number
		userAgent = userAgent.substring(userAgent.indexOf('chrome/') +7);
		userAgent = userAgent.substring(0,1);
		$j('body').addClass('browserChrome' + userAgent);
		
		// If it is chrome then jQuery thinks it's safari so we have to tell it it isn't
		$j.browser.safari = false;
	}
	
	// Is this a version of Safari?
	if ($j.browser.safari) {
		$j('body').addClass('browserSafari');
		
		// Add the version number
		userAgent = userAgent.substring(userAgent.indexOf('version/') +8);
		userAgent = userAgent.substring(0,1);
		$j('body').addClass('browserSafari' + userAgent);
	}
	
	// Is this a version of Mozilla?
	if ($j.browser.mozilla) {
		
		//Is it Firefox?
		if(navigator.userAgent.toLowerCase().indexOf('firefox') != -1){
			$j('body').addClass('browserFirefox');
			
			// Add the version number
			userAgent = userAgent.substring(userAgent.indexOf('firefox/') +8);
			userAgent = userAgent.substring(0,1);
			$j('body').addClass('browserFirefox' + userAgent);
		}
		// If not then it must be another Mozilla
		else{
			$j('body').addClass('browserMozilla');
		}
	}
	
	// Is this a version of Opera?
	if ($j.browser.opera) {
		$j('body').addClass('browserOpera');
	}
	
	
});
