function supportedBrowser(codeName, minVersion){
	/*
		INPUT PARAMETERS:
		---------------------------------------
		codeName ...	name of the browser
						posible values:	MSIE
										Netscape
										Mozilla
										Opera
		minVersion ...	minimal version number					
	*/
	this.codeName  = codeName;
	this.minNumVer = minVersion;
}

function navigatorChecker(){
	this.userAppCodeName		= navigator.appCodeName;
	this.userAppMinorVersion	= navigator.appMinorVersion;
	this.userAppName			= navigator.appName;
	this.userAppVersion			= navigator.appVersion;
	this.userBrowserLanguage	= navigator.browserLanguage;
	this.userCookieEnabled		= navigator.cookieEnabled;
	this.userCpuClass			= navigator.cpuClass;
	this.userOnLine				= navigator.onLine;
	this.userPlatform			= navigator.platform;
	this.userSystemLanguage		= navigator.systemLanguage;
	this.userAgent				= navigator.userAgent;
	this.userLanguage			= navigator.userLanguage;
	this.currentBrowser			= "Unknown";
	this.currentBrowserVer		= "Unknown";
	this.isIreadyFriendly		= false;
	this.supportedBrowsers		= new Array();
	this.browsersCount			= 0;
	//---------------------------------------------------------
	
	this.addSupportedBrowser = function(browserName, minVersion){
		this.supportedBrowsers[this.browsersCount] = new supportedBrowser(browserName, minVersion);
		this.browsersCount ++;
	}
	
	this.checkPreferences = function(){
		// MSIE
		if(this.userAppName == "Microsoft Internet Explorer"){
			// Opera 6.0
			if(this.userAgent.search("Opera") != -1){
				this.currentBrowser = "Opera";
				this.currentBrowserVer = this.userAgent.substring(this.userAgent.lastIndexOf("Opera")+6, this.userAgent.lastIndexOf(" ["))
			}
			// MSIE 4.0
			else if(this.userAgent.search("MSIE 4.0") != -1){
				this.currentBrowser = "MSIE";
				this.currentBrowserVer = "4.0";
			}
			// MSIE 5.0
			else if(this.userAgent.search("MSIE 5.0") != -1){
				this.currentBrowser = "MSIE";
				this.currentBrowserVer = "5.0";
			}
			// MSIE 5.5
			else if(this.userAgent.search("MSIE 5.5") != -1){
				this.currentBrowser = "MSIE";
				this.currentBrowserVer = "5.5";
			}
			// MSIE 6.0
			else if(this.userAgent.search("MSIE 6.0") != -1){
				this.currentBrowser = "MSIE";
				this.currentBrowserVer = "6.0";
			}
			// MSIE 7.0
			else if(this.userAgent.search("MSIE 7.0") != -1){
				this.currentBrowser = "MSIE";
				this.currentBrowserVer = "7.0";
			}
			// MSIE 8.0
			else if(this.userAgent.search("MSIE 8.0") != -1){
				this.currentBrowser = "MSIE";
				this.currentBrowserVer = "8.0";
			}
			// MSIE unknown
			else{
				this.currentBrowser = "Unknown";
				this.currentBrowserVer = "Unknown";
			}
		}
		// Netscape
		else if(this.userAppName == "Netscape"){
			if(this.userAgent.search("Netscape") != -1){
				this.currentBrowser = "Netscape";
				this.currentBrowserVer = this.userAgent.substring(this.userAgent.lastIndexOf("/")+1, this.userAgent.length)
			}
			// Safari
			else if(this.userAgent.search("Safari") != -1){
				this.currentBrowser = "Safari";
				this.currentBrowserVer = this.userAgent.substring(this.userAgent.lastIndexOf("/")+1, this.userAgent.length)
			}
			// Mozilla
			else{
				this.currentBrowser = "Mozilla";
				this.currentBrowserVer = this.userAgent.substring(this.userAgent.lastIndexOf("rv:")+3, this.userAgent.lastIndexOf(")"))
			}
		}
		// Opera 7.0
		else if(this.userAppName == "Opera"){
			if(this.userAgent.substring(0,6) == "Opera/"){
				this.currentBrowser = "Opera";
				this.currentBrowserVer = this.userAgent.substring(this.userAgent.indexOf("/")+1, this.userAgent.indexOf(" ("))
			}	
		}
		
		this.currentBrowserVer = parseFloat(this.currentBrowserVer);
		for(i = 0; i < this.supportedBrowsers.length; i++){
			if(this.supportedBrowsers[i].codeName == this.currentBrowser && this.supportedBrowsers[i].minNumVer <= this.currentBrowserVer){
				this.isIreadyFriendly = true;
			}
		}
		return this.isIreadyFriendly;
	}
}

var navigatorAgent = new navigatorChecker();
// define suported browsers and theirs minimal version numbers
navigatorAgent.addSupportedBrowser("MSIE", "5");		// Microsoft Internet Explorer 5 and higher
navigatorAgent.addSupportedBrowser("Netscape", "6.02");	// Netscape 6.02 and higher
navigatorAgent.addSupportedBrowser("Mozilla", "1");		// Mozilla 1.0 and higher
navigatorAgent.addSupportedBrowser("Safari", "1");		// Safari 1.0 and higher

// current browser is not supported by iReady
if(!navigatorAgent.checkPreferences()){
	document.location = "NotSupportedBrowser.aspx";		// redirect to NotSupportedBrowser.aspx
}