//--------------------------------------------//// Essential Layer version 1.0//// Author : Hoi-Hung Tsang (hoi@tsang.cc)// Lastupd: 4/30/2001//--------------------------------------------//// function sequence:// public:// 	[1] showLayer// 	[2] hideLayer// 	[3] essMakeSearch// 	[4] getLayerHeader// 	[5] getLayerFooter// private:// 	(6) getStyle//--------------------------------------------//// browser Check variables//--------------------------------------------//var isNS4 = document.layers ? 1 : 0;var isIE4 = document.all ? 1 : 0;var ua = navigator.userAgent.toLowerCase();var isMAC = (ua.indexOf("mac") != -1);var isW3C = document.getElementById ? 1 : 0;//--------------------------------------------//// show layer//--------------------------------------------//// input: [id] -- layer id// output: none;//--------------------------------------------//function showLayer(id) {	if (id == null) return;	if (isNS4) {		eval("document." + id + ".visibility = 'show';");	} else if (isIE4) {		document.all[id].style.visibility = "visible";	} else if (isW3C) {		eval("document.getElementById('" + id + "').style.visibility = 'visible'");	}}//--------------------------------------------//// hide layer//--------------------------------------------//// input: [id] -- layer id// output: none;//--------------------------------------------//function hideLayer(id) {	if (id == null) return;	if (isNS4) {		eval("document." + id + ".visibility = 'hide';");	} else if (isIE4) {		document.all[id].style.visibility = "hidden";	} else if (isW3C) {		eval("document.getElementById('" + id + "').style.visibility = 'hidden'");	}}//--------------------------------------------------//// Create a Layer Header Tag//--------------------------------------------------//// input: [id] -- layer id//				[position] - "absolute" / "relative"//			  [left] -- layer left most px [0...x]//				[top] --- layer top most px [0...x]//				[width] -- layer width [0...x]//				[height] -- layer height [0...x]//				[zindex] -- layer stack id//				[visible] -- true / false// 				[properties] -- extra attribute, any kind.// output: none;//--------------------------------------------------//function getLayerHeader(id, position, left, top, width, 												height, zindex, visible, properties){	// setup different platform layer tags	var dom = "";	if (isIE4) dom = "DIV";	else if (isNS4) dom = "LAYER";	else if (isW3C) dom = "DIV";	// create header 	var header = "<" + dom + " ID=\"" + id + "\" ";	header += getStyle(position, left, top, width, height, zindex, visible);	if (properties != null)		header += " " + properties;	header += ">";	return header;}//--------------------------------------------------//// Create a Layer Footer Tag//--------------------------------------------------//// input: none;// output: none;//--------------------------------------------------//function getLayerFooter(){	// setup different platform layer tags	//var dom = isIE4 ? "DIV" : "LAYER";	var dom = "";	if (isIE4) dom = "DIV";	else if (isNS4) dom = "LAYER";	else if (isW3C) dom = "DIV";	return "</" + dom + ">";}//--------------------------------------------------//// Create Layer Style tag//--------------------------------------------------//// input: [position] - "absolute" / "relative"//			  [left] -- layer left most px [0...x]//				[top] --- layer top most px [0...x]//				[width] -- layer width [0...x]//				[height] -- layer height [0...x]//				[zindex] -- layer stack id//				[visible] -- true / false// output: none;//--------------------------------------------------//function getStyle(position, left, top, width, height, zindex, visible){	var str = "";	if (isIE4 || isW3C)	{		str = "STYLE=\"";		if (position != null)			str += "position:" + position + ";";		if (left != null)			str += "left:" + left + ";";		if (top != null)			str += "top:" + top + ";"		if (width != null)			str += "width:" + width + ";";		if (height != null)			str += "height:" + height + ";";		if (zindex != null)			str += "z-index=" + zindex + ";";		if (visible != null)			str += "visibility:" + (visible == true ? "visible" : "hidden");		str += "\"";	}	else	{		if (position != null)			str += "position=" + position + " ";		if (left != null)			str += "left=" + left + " ";		if (top != null)			str += "top=" + top + " ";		if (width != null)			str += "width=" + width + " ";		if (height != null)			str += "height=" + height + " ";		if (zindex != null)			str += "z-index=" + zindex + " ";		if (visible != null)			str += "visibility=" + (visible == true ? "show" : "hide");	}	return str;		}