/*******************************
* $Id: elcUtil.js,v 1.2 2003/08/25 17:36:23 chalfant Exp $
*******************************/
function elcBrowserDetect(){
	this.win=(navigator.platform=="Win32");
	this.mac=(navigator.platform=="MacPPC");
	this.ver=navigator.appVersion;
	this.dom=document.getElementById;
	this.ie5=(this.ver.indexOf("MSIE")!=-1 && this.dom);
	this.ie4=(document.all && !this.dom);
	this.ns6=(this.dom && parseInt(this.ver)>=5);
	this.ns4=(document.layers && !this.dom);
	this.ie=(this.ie5 || this.ie4);
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns6);
	
	this.ns408=(this.ns4 &&	this.ver.substring(0,4) == "4.08");
	this.ns404=(this.ns4 &&	this.ver.substring(0,4) == "4.04");
	this.macIE50=(this.mac && navigator.userAgent.indexOf("MSIE 5.0")!=-1);

	if (this.ns4) {
		lastWidth = window.innerWidth;
		lastHeight = window.innerHeight;
	}

	this.osid = this.mac?'mac':'win';
	this.bwid = this.ns4?'ns4':this.ns6?'ns6':this.ie4?'ie4':this.macIE50?'macIE50':'ie5';
	return this;
}
var bw = new elcBrowserDetect();

var allowJsErrors = false;
function suppressErrors(){
	allowJsErrors=false;
}

function allowErrors(){
	allowJsErrors=true;
}

function onErrorHandler(){
    return (allowJsErrors) ? false : true;
}
window.onerror=onErrorHandler;

function resetStatus(){
	status="";
	return false;
}

var elcPopupWindow;
function showPopup(url,width,height){
	popupWindow = open(url, 'elcpopup', 'toolbar=0,location=0,directories=0,status=0,menubars=0,resizable=0,scrollbars=no,width='+width+',height='+height+',top=20,left=20');
	if (popupWindow != null) {
		popupWindow.focus();
	}
}

function onResizeHandler() {
	if (bw.ns4) {
		var winWidth = window.innerWidth;
		var winHeight = window.innerHeight
		if (!(lastWidth == winWidth) && (lastHeight == winHeight)){
			lastWidth = winWidth;
			lastHeight = winHeight;
			window.history.go(0);
		} else {
			return true;
		}
	}
	return true;
}
window.onresize=onResizeHandler;
