var isNetscape4 = (document.layers) ? true : false;
var isNetscape6 = (document.getElementById && !document.all) ? true : false;
var isIE4 = (document.all && !document.getElementById) ? true : false;
var isIE5 = (document.all && document.getElementById) ? true : false;



var mouseX;
var mouseY;

/*
var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;

if (checkIt('konqueror'))
{
	browser = "Konqueror";
	OS = "Linux";
}
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (!checkIt('compatible'))
{
	browser = "Netscape Navigator"
	version = detect.charAt(8);
}
else browser = "An unknown browser";

if (!version) version = detect.charAt(place + thestring.length);

if (!OS)
{
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "an unknown operating system";
}

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

*/

function setMouseClickCapture() {
	if( isNetscape4 || isNetscape6 ) {
		document.captureEvents(Event.CLICK);
	}
	document.onclick=captureClickLocation;
}

function captureClickLocation(e) {
	if( isIE4 || isIE5 ) {
		mouseX = event.clientX;
		mouseY = event.clientY;
	} else {
		mouseX = e.pageX;
		mouseY = e.pageY;
	}
}

function getMouseX() {
	return mouseX;
}

function getMouseY() {
	return mouseY;
}


function setVisibility( layerName, visible ) {
	if( visible ) {
		getStyle( layerName ).visibility = "visible";
	} else {
		getStyle( layerName ).visibility = "hidden";
	}
}

function show( layerName ) {
	setVisibility( layerName, true );
}

function hide( layerName ) {
	setVisibility( layerName, false );
}


function getLayer( layerName ) {
	if( isNetscape4 ) {
		return eval( "document."+layerName );
	} else if( isNetscape6 ) {
		return document.getElementById( layerName );
	} else {
		return eval( "document.all."+layerName );
	}
}

function getStyle( layerName ) {
	if( isNetscape4 ) {
		return getLayer( layerName );
	} else {
		return getLayer( layerName ).style;
	}
}
