// setup test for Nav 4.0
var isIE = false;
var isNav = (navigator.appName.indexOf("Netscape")>=0);
var isNav4 = false;
var isIE4 = false;
var is5up = false;
//alert(navigator.appVersion);
if (isNav) {
	
	if (parseFloat(navigator.appVersion)<5) {
		isNav4=true;
		//alert("Netscape 4.x or older");
	} else {
		is5up = true;
	}
} else {
	isIE4=true;
	isIE=true;
	if (navigator.appVersion.indexOf("MSIE 5")>0) {
		isIE4 = false;
		is5up = true;
		//alert("IE5");
	} else if (navigator.appVersion.indexOf("MSIE 6")>0) {
		isIE4 = false;
		is5up = true;
	}
}	
		
// toggle layer to invisible
function hideLayer(name) {		
  	var layer = getLayer(name);
  	if (layer != null) {
  		if (isNav4) {
    		layer.visibility = "hide";
  		//if (document.all)
		} else{
   			layer.visibility = "hidden";
			//layer.display="none";
		}
	}
}

// toggle layer to visible
function showLayer(name) {		
  	var layer = getLayer(name);		
  	if (layer != null) {
  		if (isNav4){
			layer.visibility = "show";
  		//if (document.all)
		} else {
   			layer.visibility = "visible";
			//layer.display="block";
		}
	}
}

// Create a DHTML layer
function createLayer(name, inleft, intop, width, height, visible, content) {
	  var layer;
	  if (isNav4) {
	    document.writeln('<layer name="' + name + '" left=' + inleft + ' top=' + intop + ' width=' + width + ' height=' + height +  ' visibility=' + (visible ? '"show"' : '"hide"') +  '>');
	    document.writeln(content);
	    document.writeln('</layer>');
	  } else {
	    document.writeln('<div id="' + name + '" style="position:absolute; overflow:hidden; left:' + inleft + 'px; top:' + intop + 'px; width:' + width + 'px; height:' + height + 'px;' + '; z-index:1; visibility:' + (visible ? 'visible;' : 'hidden;') +  '">');
	    document.writeln(content);
	    document.writeln('</div>');
	  }
}

// get the layer object called "name"
function getLayer(name) {
	  if (isNav4)
	    return(document.layers[name]);
	  else if (isIE4) {
	    layer = eval('document.all.' + name + '.style');
	    return(layer);
	  } else if (is5up) {
		var theObj = document.getElementById(name);
		if (theObj != null) {
			return theObj.style;
		} else {
			return(null);
		}
	  }
	  else
	    return(null);
}

function createLoadDataLayer(){
	var mWidth = window.innerWidth;
	
	if (mWidth == null) {
		mWidth = document.body.clientWidth;
	}

	var mHeight = window.innerHeight;
	
	if (mHeight == null) {
		mHeight = document.body.clientHeight;
	}

	var loadBannerLeft = parseInt((mWidth - 273)/2);
	var loadBannerTop = parseInt((mHeight - 30)/2);

	content = '<img name="LoadingData" src="/images/loadData.gif" width=273 height=30 HSPACE=0 VSPACE=0 BORDER=0 ALT="Retrieving Map">';
	createLayer("LoadData",loadBannerLeft,loadBannerTop,273,30,false,content);
}
