// Browser Detect - v2.1.6
// Documentation: http://dithered.com/javascript/browser_detect/index.html
// License: http://creativecommons.org/licenses/by/1.0/
// Code by: Chris Nott (chris[at]dithered[dot]com)

// Note: modified slightly to include IE7 and above. This is a modified version of the original code provided, for cleanliness. Many unnecessary lines
// have been removed for use with ashevilleNC.com. See browser_detect_full.js for the original version with all lines intact.

function browserDetect() {
	var ua = navigator.userAgent.toLowerCase();
	
	// Browser name.
	this.isGecko = (ua.indexOf('gecko') != -1 && ua.indexOf('safari') == -1);
	this.isSafari = (ua.indexOf('safari') != -1);
	this.isOmniweb = (ua.indexOf('omniweb') != -1);
	this.isOpera = (ua.indexOf('opera') != -1);
	this.isIcab = (ua.indexOf('icab') != -1);
	this.isIE = (ua.indexOf('msie') != -1 && !this.isOpera && (ua.indexOf('webtv') == -1));
	this.isWebtv = (ua.indexOf('webtv') != -1);
	this.isMozilla = (this.isGecko && (ua.indexOf('gecko/') + 14) == ua.length);
	this.isNS = ((this.isGecko) ? (ua.indexOf('netscape') != -1) : ((ua.indexOf('mozilla') != -1) && !this.isOpera && !this.isSafari && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1)));
	
	// Browser version.
	this.versionMinor = parseFloat(navigator.appVersion);
	
	// Correct the version numbers.
	if(this.isGecko && !this.isMozilla) {
		this.versionMinor = parseFloat(ua.substring(ua.indexOf('/', ua.indexOf('gecko/') + 6) + 1));
	}
	else if(this.isMozilla) {
		this.versionMinor = parseFloat(ua.substring(ua.indexOf('rv:') + 3));
	}
	else if(this.isIE && this.versionMinor >= 4) {
		this.versionMinor = parseFloat(ua.substring(ua.indexOf('msie ') + 5));
	}
	else if(this.isKonqueror) {
		this.versionMinor = parseFloat(ua.substring(ua.indexOf('konqueror/') + 10));
	}
	else if(this.isSafari) {
		this.versionMinor = parseFloat(ua.substring(ua.lastIndexOf('safari/') + 7));
	}
	else if(this.isOmniweb) {
		this.versionMinor = parseFloat(ua.substring(ua.lastIndexOf('omniweb/') + 8));
	}
	else if(this.isOpera) {
		this.versionMinor = parseFloat(ua.substring(ua.indexOf('opera') + 6));
	}
	else if(this.isIcab) {
		this.versionMinor = parseFloat(ua.substring(ua.indexOf('icab') + 5));
	}
	
	// Browser version.
	this.versionMajor = parseInt(this.versionMinor);
	
	// Platform.
	this.isWin = (ua.indexOf('win') != -1);
	this.isWin32 = (this.isWin && (ua.indexOf('95') != -1 || ua.indexOf('98') != -1 || ua.indexOf('nt') != -1 || ua.indexOf('win32') != -1 || ua.indexOf('32bit') != -1 || ua.indexOf('xp') != -1));
	this.isMac = (ua.indexOf('mac') != -1);
	this.isUnix = (ua.indexOf('unix') != -1 || ua.indexOf('sunos') != -1 || ua.indexOf('bsd') != -1 || ua.indexOf('x11') != -1);
	
	// Internet Explorer detection.
	this.isIE55up = (this.isIE && this.versionMinor >= 5.5);
	this.isIE7up = (this.isIE && this.versionMajor >= 7);
}; // End function browserDetect()