/*******************************
*
* elcUtil.js
* 
* generic utilities
*
* Author: DoublePrime
* References: ELCI Clinique various functions created by Razorfish
* Version: 0.1
*
* Comments
*
*******************************/
function elcBrowserDetect(){
	this.win=(navigator.platform=="Win32")?1:0;
	this.mac=(navigator.platform=="MacPPC")?1:0;
	this.ver=navigator.appVersion;
	this.dom=document.getElementById?1:0;
	this.ie5=(this.ver.indexOf("MSIE")!=-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns6=(this.dom && parseInt(this.ver)>=5)?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.ie=(this.ie5 || this.ie4);
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns6);
	
	// examples of specific version detection -- probably not needed
	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';
}
var bw = new elcBrowserDetect();

var allowJsErrors = 1;
function suppressErrors(){
	allowJsErrors=0;
}

function allowErrors(){
	allowJsErrors=1;
}

function onErrorHandler(){
    return (allowJsErrors) ? false : true;
}
window.onerror=onErrorHandler;

/* Generic Form Object */
function Frm(name) {
	formObject = null;
	if (bw.ns4) {
		parentLayer = new Layer("SiteWrapper");
		formObject = eval(parentLayer.layerAlias + ".document." + name);
	} else if (bw.ie4) {
		formObject = document.form[name];
	} else {
		formObject = document.getElementById(name);
	}
	return formObject;
}
