// Dim the Output for tips on what to do
var W_output = "";
var tip_output = "";
var tip2_output = "";

// Setup the output information for the user
var check = 1;
var B_brow = navigator.appName;
var B_version = navigator.appVersion;
var B_platform = navigator.userAgent;
var B_color = window.screen.colorDepth;
var B_width = window.screen.width;
var B_height = window.screen.height;
var SC_Win = false;
var SC_Mac = false;

// Active agt to the Browser Agent
var agt=navigator.userAgent

// Start Sniffing for a specific browser
if ((agt.indexOf("Win95") != -1) || (agt.indexOf("Windows 95") != -1)) {
	B_platform = 'Windows 95';
	SC_Win = true;
}

if ((agt.indexOf("Win98") != -1) || (agt.indexOf("Windows 98") != -1)) {
	B_platform = 'Windows 98';
	SC_Win = true;
}

if ((agt.indexOf("WinNT") != -1) || (agt.indexOf("Windows NT") != -1)) {
	B_platform = 'Windows NT';
	SC_Win = true;
}

if ((agt.indexOf("Windows NT 5.0") != -1) || (agt.indexOf("Windows NT 5.1") != -1)) {
	B_platform = 'Windows 2000/XP';
	SC_Win = true;
}

if ((agt.indexOf("Win16") != -1) || (agt.indexOf("Windows 3.1") != -1)) {
	B_platform = 'Windows 3.<i>x</i>';
	SC_Win = true;
}

if (agt.indexOf("Mac") != -1) {
	if (agt.indexOf("PC") != -1) {
		B_platform = 'Mac PPC';
	SC_Mac = true;
	}
	else {
		B_platform = 'Mac 68K';
	SC_Mac = true;
	}
}

if (agt.indexOf("SunOS") != -1) {
	B_platform = 'Unix Sun'
}

if (agt.indexOf("IRIX") != -1) {
	B_platform = 'Unix SGI'
}

if (agt.indexOf("HP-UX") != -1) {
	B_platform = 'Unix HP'
}

if (agt.indexOf("AIX") != -1) {
	B_platform = 'Unix IBM'; 
}

if (agt.indexOf("Linux") != -1) {
	B_platform = 'Linux/Red Hat'; 
}

// Setup the version by specific properties to that browser
var SC_IE = (document.all) ? true : false;
var SC_DOM = (document.getElementById) ? true : false;
var SC_IE55 = (SC_IE && SC_DOM);

// Netscape and Mozilla based browsers
var NS6 = ((navigator.vendor == ("Netscape6/6.2")) || (navigator.vendor == ("Gecko")));
//var Moz = (navigator.vendor == ("Gecko"));
var NS4 = (document.layers) ? true : false;
var NSOLD = (NS4 && (parseFloat(navigator.appVersion) < 4.02));

// Internet Explorer Browsers
var IE55W = (SC_IE55 && SC_Win);
var IE55M = (SC_IE55 && SC_Mac); 
var IE50 = (SC_IE && ((parseFloat(navigator.appVersion) > 4 ) && !SC_IE55));
var IE4 = (SC_IE && ((parseFloat(navigator.appVersion) > 4 ) && !SC_IE55));
var IEOLD = (SC_IE && ((parseFloat(navigator.appVersion) <= 4 ) && !SC_IE55));

var SCG_NS4 = (document.layers) ? true : false;
var SCG_Mac = (navigator.appVersion.indexOf("Mac") != -1);

// Setup UPGRADE TIPS section for upgrading
var tip_upgr1 = " Please consider upgrading to Netscape 6.0 for best results.";
var tip_upgr2 = " Netscape 6.0 supports a few extra minor features.";
var tip_upgr3 = " Please consider upgrading to Netscape 6.0 or Internet Explorer 5.5 SP2 .";
var tip_upgr4 = " Some table borders and spacing may appear better in Internet Explorer 5.5 SP2.";

// Setup VERSION TIPS based on the version of browser and then add the proper UPGRADE tip
var tip_ns6 = "Netscape 6.0 supports almost all of the features of this website." + tip_upgr4; 
var tip_ns4 = "Netscape 4.x on Windows or Mac supports some of the features of this website." + tip_upgr1;
var tip_nsold = "You appear to have an older version of Netscape." + tip_upgr1;
var tip_ie55w = "Internet Explorer 5.5 on Windows supports almost all of the features of this website.";
var tip_ie55m = "Internet Explorer 5.5 on Mac supports many of the features of this website but there are some known JavaScript bugs." + tip_upgr1;
var tip_ie50 = "Internet Explorer 5.0 has some known bugs." + tip_upgr3;
var tip_ie4 = "Internet Explorer 4.x on Windows or Mac supports some of the features of this website." + tip_upgr3;
var tip_ieold = "You appear to have an older version of Internet Explorer." + tip_upgr3;
var tip_unkn = "You are using a browser we have no information or recommendations for.";
	tip_unkn += " You may have trouble with many of the advanced features in this online tool,";
	tip_unkn += " or other unknown problems." + tip_upgr3;

/*
Concatenate for output
VERSION, VERSION TIP, and UPGRADE TIPS
*/

var check = "2";
if (NS6) {
	check = "ns6";
	tip_output = tip_ns6;
	B_brow = "Netscape 6";
}
else if (NS4) {
	check = "ns4";
	tip_output = tip_ns4;
	B_brow = "Netscape 4";
}
else if (NSOLD) {
	check = "nsold";
	tip_output = tip_nsold;
	B_brow = "Netscape 3 or earlier";
}
else if (IE55W) {
	check = "ie55w";
	tip_output = tip_ie55w;
	B_brow = "Internet Explorer 5.5";
}
else if (IE55M) {
	check = "ie55m";
	tip_output = tip_ie55m;
	B_brow = "Internet Explorer 5.5"; 
}
else if (IE50) {
	check = "ie50";
	tip_output = tip_ie50; 
	B_brow = "Internet Explorer 5";
}
else if (IE4) {
	check = "ie4";
	tip_output = tip_ie4; 
	B_brow = "Internet Explorer 4";
}
else if (IEOLD) {
	check = "ieold";
	tip_output = tip_ieold; 
	B_brow = "Internet Explorer 3 or earlier";
}
else {
	check = "unk";
	tip_output = tip_unkn;
	B_brow = navigator.appName;
}

// Check browser size for standard 800 X 600
if (B_width < 800) {
   tip2_output = 'Your screen size appears to be set lower than this application has been set for.  Some monitors do not support resolutions above 640 x 480. ';
   tip2_output += 'Check with your system documentation or administrator to see if you can increase your resolution to 800 x 600 or higher.';
} 

var W_brow = "Unknown";
var W_browVersion = "Unknown";
var W_platform = "Unknown";
var W_color = "Unknown";
var W_size = "Unknown";

// Give the user what they need to see
W_brow = "\nBrowser Name: " + String(B_brow) + "\n";
W_browVersion = "Version: " + String(B_version) + "\n";
W_platform = "Platform: " + String(B_platform) + "\n";
W_color = "Color Depth: " + String(B_color) + " bit \n";
W_size = "Screen Size: " + String(B_width) + " x " + String(B_height) + "\n";

// When activated show user the output for tech-support
W_output = W_brow + W_platform + W_color + W_size;

// Activate the appropriate Javascript Version for detection
document.write('<script language="JavaScript">var jsversnum = "1.0"</script>');
document.write('<script language="JavaScript1.1">jsversnum = "1.1"</script>');
document.write('<script language="JavaScript1.2">jsversnum = "1.2"</script>');
document.write('<script language="JavaScript1.3">jsversnum = "1.3"</script>');
document.write('<script language="JavaScript1.4">jsversnum = "1.4"</script>');

// Give the user the verdict on the Javascript Version
var jsversion = 'JavaScript version ' + jsversnum + " is installed and enabled! \n";
if (jsversnum < 1.3) {
	jsversion += 'This version of JavaScript is found on obsolete browsers. Many JavaScript functions ';
	jsversion += 'will be disabled or may produce errors. For a better web experience, please consider upgrading to ';
	jsversion += 'Netscape 6 or Internet Explorer 5.5';
}
else {
	jsversion += 'Your browser should be free of browser-related JavaScript errors on this website.';
}
