//Browser checking
var bCategory = 0; // default no chopper dhtml

// START BROWSER VERSION DETECTION
var useragent = navigator.userAgent;
var bName = (useragent.indexOf('Opera') > -1) ? 'Opera' : navigator.appName;
var pos = useragent.indexOf('MSIE');
if (pos > -1) {
	bVer = useragent.substring(pos + 5);
	var pos = bVer.indexOf(';');
	var bVer = bVer.substring(0,pos);
}
var pos = useragent.indexOf('Opera');
if (pos > -1)	{
	bVer = useragent.substring(pos + 6);
	var pos = bVer.indexOf(' ');
	var bVer = bVer.substring(0, pos);
}

if (bName == "Netscape") {
	var bVer = useragent.substring(8);
	var pos = bVer.indexOf(' ');
	var bVer = bVer.substring(0, pos);
}

if (bName == "Netscape" && parseInt(navigator.appVersion) >= 5) {
	var pos = useragent.lastIndexOf('/');
	var bVer = useragent.substring(pos + 1);
}

/*
cleaning bVer (Browser Version Number)
it is currently a string.  So browsers, NN 6 for example
return a value that can not be directly converted to a number
because it has multiple decimal point.  The following code will
remove all but the first decimal point example: 6.2.1 -> 6.21
*/

while (bVer.indexOf(".") < bVer.lastIndexOf(".")){
	bVer = bVer.substring(0,bVer.lastIndexOf(".")) + bVer.substring((bVer.lastIndexOf(".")+1), bVer.length)
}	
// END BROWSER VERSION DETECTION

/*
For this script I only care about the following categories
|=======================================================|
| IE | NN | Opera | Version | bCategory | chopper dhtml |
|=======================================================|
| X  | X  |       | < 4     | -1        | No            |
|    |    | X     | Any     |  0        | No            |
| X  |    |       | > 4     |  1        | Yes           |
|    | X  |       | 4.x     |  2        | Yes           |
|    | X  |       | 6.x     |  3        | Yes           |
|    | X  |       | 7.x     |  3        | No            |
|=======================================================|
*/
//if ((bName.indexOf('Microsoft Internet Explorer') > -1) && (bVer >= 4)){bCategory = 1};
bVer = parseFloat(bVer);
if (bName.indexOf('Microsoft Internet Explorer') > -1){
	if (bVer >= 4){
		bCategory = 1;
	}else{
		bCategory = -1;
	}
}
if (bName.indexOf('Netscape') > -1){
	if (bVer >= 4){
		if(bVer >= 6){
			bCategory = 3;
		}else{
			bCategory = 2;
		}
	}else{
		bCategory = -1;
	}
}

