//var layerDIV = null;

//browser vars moved to ognc_browsers.js
   uID = 0;
loadTimer = '';

function startLayer(c,l,t,w,h) {
	//c = content
	//l,t,w,h = left,top,width,height
	uID+=1;
	var n = null;

	if (isNS4) {
		n = window["dynLayer"+uID];
		n = window["dynLayer"+uID] = new Layer(h,window);
		//n.bgColor = "#ffffff";
		n.document.write(c);
		n.visibility = "hide";
		n.moveTo(l,t);
		n.clip.right = w;
		n.document.close();
	} else if (isIE4) {
	    eval("dynLayerObj"+uID+" = new Object()");
		n = eval("dynLayerObj"+uID);
		document.body.insertAdjacentHTML("BeforeEnd","<DIV ID='dynLayer"+uID+"' STYLE='position:absolute;visibility:hidden;width:166;' >"+c+"</DIV>");
		layerLyr = document.all("dynLayer"+uID);
		n = layerLyr;
		with(n.style) {
			//backgroundColor = "#ffffff";
			color = "#000000";
			font = "normal 10pt Arial";
			pixelWidth = w;
			pixelLeft = l;
			pixelTop = t;
		}
	} else if (isDOM) {
		n = document.createElement("DIV");
		n.id = "dynLayer"+uID;
		n.style.position = "absolute";
		n.style.visibility = "hidden";
		n.innerHTML = c;
		with(n.style) {
			//backgroundColor = "#ffffff";
			color = "#000000";
			font = "normal 10pt Arial";
			width = w+"px";
			left = l+"px";
			top = t+"px";
		}
		document.body.appendChild(n);
		n.on = false;
	}
	//otherOnLoad();
	return n;
}

function showLayer(on,n,e) {
	if (isNS4) n.visibility = on ? "show" : "hide";
	else if (isDOM || isIE4) n.style.visibility = on ? "visible" : "hidden";
	self.status = "";
}

function layerOver(n) {
	if(n) {
		n.on = true;
		showLayer(true,n);
	}
}

function layerOut(n) {
	if(n) {
		n.on = false;
		showLayer(false,n);
	}
}

function layerClick(n) {
	if(n) {
		if(n.on) {
			n.on = false;
			showLayer(false,n);
		} else {
			n.on = true;
			showLayer(true,n);
		}
	}
}

function addToLoadTimer(v) {
	loadTimer += v;
}

function executeLayerTimer() {
	if(loadTimer.length>0) {
		//otherOnLoad = (window.onload) ? window.onload :  new Function;
		//window.onload = function(){setTimeout(loadTimer)};
		//alert(loadTimer);
		setTimeout(loadTimer,500);
		//eval(loadTimer);
	}
}

function getAbsolutePosition(image) {
	var rd = {x:0, y:0};
	if(isNS4) {
		rd.x = image.x;
		rd.y = image.y;
	} else {
		// start with the image's coordinates and walk through it's ancestory of
		// elements (tables, div's, spans, etc...) until we're at the top. Along
		// the way we add in each element's coordinates to get the final answer
		do {
			rd.x += image.offsetLeft;
			rd.y += image.offsetTop;
			image = image.offsetParent;
		} while(image);
	}
	return(rd)
}

