
// This var defines the page to load if browser is unsupported.  
// To override this setting for a particular file/site, 
// include this .js file, then re-define urlUnsupported prior to calling browserCheck();
var urlUnsupported = "../unsupported.asp";	



function Browser() {
	// Get browser specs
	this.userAgent = navigator.userAgent.toLowerCase();
    this.ver_major = parseInt(navigator.appVersion);
    this.ver_minor = parseFloat(navigator.appVersion);
    
    this.DOM = (document.getElementById) ? 1 : 0    // does the browser support the "standard" DOM (Document Object Model)?
    this.IE  = (document.all) ? 1 : 0;              // is this a version (4+) of Internet Explorer
    this.IE4 = this.IE && !this.DOM;          // is this IE 4.x? (IE4 doesn't support the DOM)
    this.NS4 = (document.layers) ? 1 : 0;           // is this Netscape Navigator 4.x?
    this.Konqueror = (this.userAgent.indexOf("konqueror") != -1);
    this.Opera     = (this.userAgent.indexOf("opera") != -1);

	// Whenever possible, we will test for support, rather than specific browsers.
	// This lets us tweak things for new browsers w/o major updates.
	this.support = new Object();
	this.support.onResize = (this.Opera) ? 0 : 1;	//Browsers that don't support the onResize event;
	this.support.imageResize = (this.Opera || this.NS4) ? 0 : 1;	//NS4 and Opera won't resize an image if you change the src
}



function browserCheck(formName) {
	// Called by default.asp -- checks for supported browser

	var theBrowser = new Browser();
	var h = w = 0;
	var supported = true;
	
	
	if (theBrowser.IE) {
		h = document.body.clientHeight;
		w = document.body.clientWidth;
	}
	else if (theBrowser.DOM) {
		h = window.innerHeight;
		w = window.innerWidth;
	}
	else if (theBrowser.NS4) {
		h = window.innerHeight;
		w = window.innerWidth;
	}
	
	if ((theBrowser.Konqueror) && (theBrowser.ver_major < 3)) {
		supported = false;	//Konqueror v2 claims to support the DOM, but is inadequate
	}
	
	if (h>0 && w>0 && supported!=false) {
		// supported browser
		eval("theForm = document."+formName);
		theForm.h.value = h;
		theForm.w.value = w;
		theForm.submit();
	}
	else {
		// unsupported browser, redirect to info page
		document.location.href = urlUnsupported;	// "urlUnsupported" defined near the top of this file.
	}
	
}

