//---------------------------------------------------------------------------
// File.......: checkbver.js     
// Author.....: Jack Roy                   
// Created....: Sept 15, 2003                                                  
// Purpose....: this file contains the scripts to detect if we support the 
//				browser                                         
// Application: EC
// Revisions..:  
// Copyright © 2003 Max Digital Broadcasting Corporation. All rights reserved.
//---------------------------------------------------------------------------
function detectBver(){

	var bwInfo = {					// this is the browser information
		vendor: null,				// this is the browser vendor ns or ie
		version: null,				// this is the browser version
		supported: false,			// this is the support flag
		ie: false,					// ie flag
		ns: false					// ns flag
		};
	
	// convert all characters to lowercase to simplify testing
    var agt=navigator.userAgent.toLowerCase();

    // *** BROWSER VERSION ***
    // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
    var is_major = parseInt(navigator.appVersion);
    var is_minor = parseFloat(navigator.appVersion);

    // Note: Opera and WebTV spoof Navigator.  We do strict client detection.
    // If you want to allow spoofing, take out the tests for opera and webtv.
    bwInfo.ns  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));

    bwInfo.ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	
	if (bwInfo.ns){   // is the browser vendor netscape
		bwInfo.vendor = "netscape";
		if (is_major == 4){ 
			bwInfo.version = 4;
			bwInfo.supported = false;
		}else if ((is_major >= 5)&& (agt.indexOf('netscape6/6')!=-1)){
			bwInfo.version = 6;
			bwInfo.supported = false;
		}else if((is_major >= 5) && (agt.indexOf('netscape/7')!=-1)){
			bwInfo.version = 7;
			bwInfo.supported = true;
		}else{
			bwInfo.version = 0;
			bwInfo.supported = false;
		}
		return bwInfo;
	}else if(bwInfo.ie){   // is the browser vendor microsoft
		bwInfo.vendor = "microsoft";
		// we start at ie4 as if it is earlier it is not supported
		if ((is_major == 4) && (agt.indexOf("msie 4")!=-1)){
			bwInfo.version = 4;
			bwInfo.supported = true;
		}else if ((is_major == 4) && (agt.indexOf("msie 5.0")!=-1)){ 
			bwInfo.version = 5;
			bwInfo.supported = true;
		}else if ((is_major == 4) && (agt.indexOf("msie 5.5")!=-1)){
			bwInfo.version = 55;
			bwInfo.supported = true;
		}else if ((is_major == 4) && (agt.indexOf("msie 6.")!=-1)){ 
			bwInfo.version = 6;
			bwInfo.supported = true;
		}else if ((is_major == 4) && (agt.indexOf("msie 7.")!=-1)){ 
			bwInfo.version = 6;
			bwInfo.supported = true;
		}else{
			bwInfo.version = 0;
			bwInfo.supported = false;
		}
		return bwInfo;

	}else {
		bwInfo.supported = false;
		bwInfo.version = 0;
		bwInfo.vendor = "unknown";
		return bwInfo;
	}

}

