// Set event handler to initialize API
var isCSS, isW3C, isIE4, isIE6CSS, isNN4, isNN6; 
var widthWindow, heightWindow;
var heightHTML;

// let all IBrowsers establish content objects
function checkIBrowser() {
	if (document.images) {
		// check browser
		isCSS = (document.body && document.body.style) ? true : false;
		isW3C = (isCSS && document.getElementById) ? true : false;
		isIE4 = (isCSS && document.all) ? true : false;
		isIE6CSS = (document.compatMode && document.compatMode.indexOf("CSS1") >= 0) ? true : false;
		isNN4 = (document.layers) ? true : false;
		isNN6 = (document.getElementById && !document.all) ? true : false;
		
		getObject("divclose").position      = "absolute";
    	getObject("divclose").left          = "-100px";
    	getObject("divclose").top			= "-100px";
		return true;
	}
	else
		return false;
}

// Set the background color of an object
function setBGColor(obj, color) {
	var theObj = getObject(obj);
	if (theObj) {
		if (isNN4) {
			theObj.bgColor = color;
		} else if (isCSS) {
			theObj.backgroundColor = color;
		}
	}
}

// Convert object name string or object reference
// into a valid style (or NN4 layer) reference
function getObject(obj) {
	var theObj = getRawObject(obj);
	if (theObj && isCSS) {
		theObj = theObj.style;
	}
	return theObj;
}

// Convert object name string or object reference
// into a valid element object reference
function getRawObject(obj) {
	var theObj;
	if (typeof obj == "string") {
		if (isW3C) {
			theObj = document.getElementById(obj);
		} else if (isIE4) {
			theObj = document.all(obj);
		} else if (isNN4) {
			theObj = seekLayer(document, obj);
		}
	} else {
		// pass through object reference
		theObj = obj;
	}
	return theObj;
}

// Set the visibility of an object to visible - true or hidden - false
function showHideObject(obj, sw) {
    var theObj = getObject(obj);
    if (theObj) {
    	if (sw)
        	theObj.visibility = "visible";
        else
        	theObj.visibility = "hidden";
    }
}

// change cursor style
function cursorStyle(obj) {
	if (isCSS) {
		if (isNN4 || isNN6)
			obj.style.cursor='pointer';
		else
			obj.style.cursor='hand';
	}
	return;
}

window.onresize = checkIBrowser;
