
/*!
* .browserIE
* .browserIE6
* .browserIE7
* .browserIE8
* .browserChrome_win	(For all Versions of Windows)
* .browserChrome_win1	(EX: .browserChrome_win(version))
* .browserChrome_mac	(For All Versions of Mac)
* .browserChrome_mac1	(EX: .browserChrome_mac(version))
* .browserChrome1		(For All OS)
* .browserSafari_win	(For all Versions of Windows)
* .browserSafari_win1	(EX: .browserSafari_win(version))
* .browserSafari_mac	(For All Versions of Mac)
* .browserSafari_mac1	(EX: .browserSafari_mac(version))
* .browserSafari		(For All OS)
* .browserMozilla		(For All OS)
* .browserFirefox_win	(For all Versions of Windows)
* .browserFirefox_win1	(EX: .browserFirefox_win(version))
* .browserFirefox_mac	(For All Versions of Mac)
* .browserFirefox_mac1	(EX: .browserFirefox_mac(version))
* .browserFirefox		(For All OS)
* .browserOpera_mac		(For All Versions of Mac)
* .browserOpera_win		(For all Versions of Windows)
* .browserOpera			(For All OS)
*/

// Checks the browser,OS and adds classes to the body to reflect it.
$(document).ready(function(){

    // This is Script to Find UserAgent(OS) -->
	var os, ua = navigator.userAgent;
	if (ua.match(/Win(dows )?NT 6\.0/)) {
	os = "Windows Vista";            // Windows Vista ???
	}
	else if (ua.match(/Win(dows )?NT 5\.2/)) {
	os = "Windows Server 2003";         // Windows Server 2003 ???
	}
	
	// Enable This code if you want to specify version of windows
	
	/*else if (ua.match(/Win(dows )?(NT 5\.1|XP)/)) {
	os = "Windows XP";            // Windows XP ???
	}
	else if (ua.match(/Win(dows)? (9x 4\.90|ME)/)) {
	os = "Windows ME";            // Windows ME ???
	}
	else if (ua.match(/Win(dows )?(NT 5\.0|2000)/)) {
	os = "Windows 2000";            // Windows 2000 ???
	}
	else if (ua.match(/Win(dows )?98/)) {
	os = "Windows 98";            // Windows 98 ???
	}
	else if (ua.match(/Win(dows )?NT( 4\.0)?/)) {
	os = "Windows NT";            // Windows NT ???
	}
	else if (ua.match(/Win(dows )?95/)) {
	os = "Windows 95";            // Windows 95 ???
	}*/
	
	// END
	
	else if (ua.match(/Win(dows )/)) {
	os = "Windows";            // Windows ???
	}
	else if (ua.match(/Mac|PPC/)) {
	os = "Mac OS";               // Macintosh ???
	}
	else if (ua.match(/Linux/)) {
	os = "Linux";               // Linux ???
	}
	else if (ua.match(/(Free|Net|Open)BSD/)) {
	os = RegExp.$1 + "BSD";            // BSD ????
	}
	else if (ua.match(/SunOS/)) {
	os = "Solaris";               // Solaris ???
	}
	else {
	os = "N/A";               // ???? OS ???
	}   
    // END -->
   
    // Browser Detection Code -->
    var userAgent = navigator.userAgent.toLowerCase();
    $.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase()); 
    
    // Is this a version of IE?
    if($.browser.msie){
        $('body').addClass('browserIE');
        
        // Add the version number
        $('body').addClass('browserIE' + $.browser.version.substring(0,1));
    }
    
    
    // Is this a version of Chrome?
    if($.browser.chrome){
    	// For Mac Chrome
    	if(os == "Mac OS"){
	        $('body').addClass('browserChrome_mac');
	        
	        //Add the version number
	        userAgent = userAgent.substring(userAgent.indexOf('chrome/') +7);
	        userAgent = userAgent.substring(0,1);
	        $('body').addClass('browserChrome_mac' + userAgent);
	        
	        // If it is chrome then jQuery thinks it's safari so we have to tell it it isn't
	        $.browser.safari = false;
    	}
    	// For Windows Chrome
    	else if(os == "Windows"){
			$('body').addClass('browserChrome_mac');
			
			//Add the version number
			userAgent = userAgent.substring(userAgent.indexOf('chrome/') +7);
			userAgent = userAgent.substring(0,1);
			$('body').addClass('browserChrome_mac' + userAgent);
			
			// If it is chrome then jQuery thinks it's safari so we have to tell it it isn't
			$.browser.safari = false;
    	}
    	// For All OS
		$('body').addClass('browserChrome');
		
		//Add the version number
		userAgent = userAgent.substring(userAgent.indexOf('chrome/') +7);
		userAgent = userAgent.substring(0,1);
		$('body').addClass('browserChrome' + 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){
    	// For Mac Safari
    	if(os == "Mac OS"){
	        $('body').addClass('browserSafari_mac');
	        
	        // Add the version number
	        userAgent = userAgent.substring(userAgent.indexOf('version/') +8);
	        userAgent = userAgent.substring(0,1);
	        $('body').addClass('browserSafari_mac' + userAgent);
	    }
	    // For Windows Safari
	    else if(os == "Windows"){
		$('body').addClass('browserSafari_win');
		
		// Add the version number
		userAgent = userAgent.substring(userAgent.indexOf('version/') +8);
		userAgent = userAgent.substring(0,1);
		$('body').addClass('browserSafari_win' + userAgent);
	    }
		// For All OS
		$('body').addClass('browserSafari');
		
		// Add the version number
		userAgent = userAgent.substring(userAgent.indexOf('version/') +8);
		userAgent = userAgent.substring(0,1);
		$('body').addClass('browserSafari' + userAgent);
	}
    
    // Is this a version of Mozilla?
    if($.browser.mozilla){
    	// For Mac Firefox
        if(os == "Mac OS"){
	        //Is it Firefox?
	        if(navigator.userAgent.toLowerCase().indexOf('firefox') != -1){
	            $('body').addClass('browserFirefox_mac');
	            
	            // Add the version number
	            userAgent = userAgent.substring(userAgent.indexOf('firefox/') +8);
	            userAgent = userAgent.substring(0,1);
	            $('body').addClass('browserFirefox_mac' + userAgent);
	        }
	        // If not then it must be another Mozilla
	        else{
	            $('body').addClass('browserMozilla_mac');
	        }
		}
		// For Windows Firefox
		else if(os == "Windows"){
			//Is it Firefox?
			if(navigator.userAgent.toLowerCase().indexOf('firefox') != -1){
			    $('body').addClass('browserFirefox_win');
			    
			    // Add the version number
			    userAgent = userAgent.substring(userAgent.indexOf('firefox/') +8);
			    userAgent = userAgent.substring(0,1);
			    $('body').addClass('browserFirefox_win' + userAgent);
			}
			// If not then it must be another Mozilla
			else{
			    $('body').addClass('browserMozilla_win');
			}
			
		}
		// For All OS
		//Is it Firefox?
		if(navigator.userAgent.toLowerCase().indexOf('firefox') != -1){
		    $('body').addClass('browserFirefox');
		    //alert(userAgent);
		    // Add the version number
		    userAgent = userAgent.substring(userAgent.indexOf('firefox/') +8);
		    userAgent = userAgent.substring(0,1);
		    $('body').addClass('browserFirefox' + userAgent);
		}
		// If not then it must be another Mozilla
		else{
		    $('body').addClass('browserMozilla');
		}
    }
    
    // Is this a version of Opera?
    if($.browser.opera){
    	// For Mac Opera
    	if(os == "Mac OS"){
        	$('body').addClass('browserOpera_mac');
        }
        // For Windows Opera
        else if(os == "Windows"){
        	$('body').addClass('browserOpera_win');
        }
        // For All OS
        $('body').addClass('browserOpera_win');
    }
    // END  -->
    
});

