// Simple Browser Detection
BrVersion = parseInt(navigator.appVersion) 
isIE5 = (document.all && document.getElementById) ? true : false; // IE5/6, IE5 Mac
isNS6 = (!document.all && document.getElementById) ? true : false; // NS6, Mozilla
isNS4 = (document.layers) ? true : false; // NS4
isIE = (document.all) ? true : false;
isIE4 = isIE && !isIE5; //IE4 Win
isMac = (navigator.appVersion.indexOf("Mac") != -1); // Mac Platform
isIE4M = isIE4 && isMac; //IE4 Mac
isIE5M = isIE5 && isMac; //IE5 Mac
isOpera = (navigator.userAgent.indexOf("Opera") != -1);

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

// Functions to get the real x and y position of an element on the canvas in IE and NS6
function getRealLeft(el) {
    if (arguments.length==0) el = this;
    xPos = el.offsetLeft;
    tempEl = el.offsetParent;
    while (tempEl != null) {
        xPos += tempEl.offsetLeft;
        tempEl = tempEl.offsetParent;
    }
    return xPos;
}

function getRealTop(el) {
    if (arguments.length==0) el = this;
    yPos = el.offsetTop;
    tempEl = el.offsetParent;
    while (tempEl != null) {
        yPos += tempEl.offsetTop;
        tempEl = tempEl.offsetParent;
    }
    return yPos;
}

// Return layer reference
function refLayer(layerID) {
	if (isIE || isNS6) {
		return document.getElementById(layerID);
	} else if (isNS4) {
		return document.layers[layerID];
	}
}
// Show N' hide layers
function showLayer(layerName) {
	layerRef = refLayer(layerName);
	if (isIE || isNS6) {
		layerRef.style.visibility = "visible";
	} else if (isNS4) {
		layerRef.visibility = "visible";
	}
}

function hideLayer(layerName) {
	layerRef = refLayer(layerName);
	if (isIE || isNS6) {
		layerRef.style.visibility = "hidden";
	} else if (isNS4) {
		layerRef.visibility = "hidden";
	}
}