
function createLayer(id,nestref,left,top,width,height,content,bgColor,visibility,zIndex) {
	if (ns4) {
		if (nestref) {
			var lyr = eval("document."+nestref+".document."+id+" = new Layer(width, document."+nestref+")")
		}
		else {
			var lyr = document.layers[id] = new Layer(width);
			eval("document."+id+" = lyr");
		}
		lyr.left = left;
		lyr.top = top;
		if (height!=null) lyr.clip.height = height;
		if (bgColor!=null && bgColor != '') lyr.bgColor = bgColor;
		lyr.visibility = (visibility=='hidden')? 'hide' : 'show';
		if (zIndex!=null) lyr.zIndex = zIndex
		if (content) {
			lyr.document.open();
			lyr.document.write(content);
			lyr.document.close();
		}
	}
	else if (ie4 || ie5) {
		if (id == "ShowWaitGif")
		{var str = '\n<DIV id='+id+' style="position:absolute; left:'+left+'; top:'+top+'; width:'+width;}
		else
		{var str = '\n<DIV id='+id+' align="right" style="position:absolute; left:'+left+'; top:'+top+'; width:'+width;}
		if (height!=null) {
			str += '; height:' + height;
			str += '; clip:rect(0,'+width+','+height+',0)';
		}
		if (bgColor!=null) str += '; background-color:'+bgColor		
		if (zIndex!=null) str += '; z-index:' + zIndex;
		if (visibility) str += '; visibility:' + visibility;
		str += ';">'+((content)?content:'')+'</DIV>';
		if (nestref) {
			index = nestref.lastIndexOf(".");
			var nestlyr = (index != -1)? nestref.substr(index+1) : nestref;
			document.all[nestlyr].insertAdjacentHTML("BeforeEnd",str);
		}
		else {
			document.body.insertAdjacentHTML("BeforeEnd",str)
		}
	} else if (ns6) {		
		mydiv = document.createElement("DIV");
		mydiv.setAttribute("id", id);

		var styl = 'position:absolute; left:'+left+'px; top:'+top+'px; width:'+width+'px';
		if (height!=null) {
			styl += '; height:'+height + 'px;';
		}
		if (bgColor!=null && bgColor != '') styl += '; background-color:' + bgColor;		
		if (zIndex!=null) styl += '; z-index:' + zIndex;
		if (visibility) styl += '; visibility:' + visibility;
		styl += '; border:0';
		styl += ';'
		mydiv = document.createElement("DIV");
		mydiv.setAttribute("id", id);
		mydiv.setAttribute("style", styl);
		document.body.appendChild(mydiv);
		if (content != null && content.length > 0) {
			mydiv.innerHTML = content;
		}
	}
}

function destroyLayer(id,nestref) {
	if (ns4) {
		if (nestref) {
			var str = "document."+nestref+".document."+id;
			eval(str+".visibility = 'hide'");
			eval("delete "+str);
		}
		else {
			document.layers[id].visibility = "hide";
			delete document.layers[id];
		}
	} else if (ie4) {
		document.all[id].style.visibility = "hidden";
		document.all[id].innerHTML = "";
		document.all[id].outerHTML = "";
	} else if (ns6 || ie5) {
		document.body.removeChild(document.getElementById(id));
	}
}
