function printZSelectBox(selectBox,option,flg,qtype,showid) {
	var tmp, name, value, outString, action;
	var id = selectBox["id"];
	var width = selectBox["width"];
	var height = selectBox["height"];
	var bordercolor = selectBox["bordercolor"];
	var bgcolor = selectBox["bgcolor"];
	var fontcolor = selectBox["fontcolor"];
	var focusbgcolor = selectBox["focusbgcolor"];
	var fontsize = selectBox["fontsize"];
	var padding = selectBox["padding"];
	var letterspacing = selectBox["letterspacing"];
	var bullet = selectBox["bullet"];
	var onChange = selectBox["onChange"];
	var flag = flg;
	var select = option["select"];

	if(bordercolor==null) bordercolor = "#888888";
	if(bgcolor==null) bgcolor= "#ffffff";
	if(fontcolor==null) fontcolor="#333333";
	if(focusbgcolor==null) focusbgcolor= "#ededed";
	if(width==null) width=100;
	if(height!=null) height="height="+height; else height = "";
	if(fontsize==null) fontsize="9";
	if(padding==null) padding="1";
	if(letterspacing==null) letterspacing="0";
	if(bullet==null) bullet="▽";

	outString = "<input type=hidden name='"+id+"' id='"+id+"'>";
	outString += "<table id='cate_table' width="+width+" "+height+" border=0 cellspacing=1 cellpadding=0 bgcolor="+bordercolor+" style='table-layout:fixed;cursor:pointer'";
	outString += "onClick=\"showZSelectBox('layer_"+id+"','" + flag +"','" + qtype +"','" + showid +"')\"";
	outString += ">\n";
	outString += "<tr bgcolor="+bgcolor+">\n";
	outString += "<td>\n";
	outString += "<table border=0 width=100% height=100% cellspacing=0 cellpadding="+padding+" style='table-layout:fixed;'>\n";
	outString += "<col width=></col><col width=15></col>\n";
	outString += "<tr>\n";
	outString += "<td style='line-height:100%;letter-spacing:"+letterspacing+";padding-top:3px;padding-left:3px;' onMouseOver=this.style.backgroundColor='"+focusbgcolor+"' onMouseOut=this.style.backgroundColor=''><div id="+id+"_value style=color:"+fontcolor+";font-size:"+fontsize+"pt;>Select</div></td>\n";
	outString += "<td style='font-size:"+fontsize+"pt;padding:0px;color:"+fontcolor+";' align=center>"+bullet+"</td>\n";
	outString += "</tr>\n";
	outString += "</table>\n";
	outString += "</td>\n";
	outString += "</tr>\n";
	outString += "</table>\n";

	outString += "<div id='layer_"+id+"' style='z-index:100; position:absolute; display:none' onMouseOver=showZSelectBox('layer_"+id+"','" + flag +"','" + qtype +"','" + showid +"') onMouseOut=hideZSelectBox('layer_"+id+"')>\n";
	outString += "<table border=0 cellspacing=1 cellpadding=0 bgcolor="+bordercolor+" width="+width+">\n";
	outString += "<tr bgcolor="+bgcolor+">\n";
	outString += "<td>\n";
	outString += "<table border=0 cellspacing=0 cellpadding=0 width=100% style=table-layout:fixed>\n";
	outString += "<col style=padding-left:3px;font-size:"+fontsize+"pt;color:"+fontcolor+" width=></col>\n";

	for(i=1;i<option.length;i++) {
		tmp = option[i].split("||");
		name = tmp[0];
		value = tmp[1];

		if(value==null) value = "";

		if(onChange !=null && value) {
			//action=  "location.href=\""+value+"\"";
			action= "\"search_ext('"+id+"','"+value+"')\"";
		}
		else {
			action = "\"selectZSelectBox('"+name+"','"+value+"','"+id+"')\"";
		}

		outString += "<tr onMouseOver=this.style.backgroundColor='"+focusbgcolor+"' onMouseOut=this.style.backgroundColor='' style=cursor:pointer><td onClick="+action+" style='padding-top:1px;font-size:"+fontsize+"pt;color:"+fontcolor+"'>"+name+"</td></tr>\n";
	}

	outString += "</table>\n";
	outString += "</td>\n";
	outString += "</tr>\n";
	outString += "</table>\n";
	outString += "</div>\n";

	document.writeln(outString);

	if(select!=null) {
		tmp = option[select].split("||");
		name = tmp[0];
		value = tmp[1];
		if(value==null) value = "";
		document.getElementById(id+"_value").innerHTML = name;
		document.getElementById(id).value = value;
	}
}

function showZSelectBox(id,flag,qtype,showid) {
	if(document.getElementById("category")) {
		document.getElementById("category").style.display = 'none';
	}

	if(document.getElementById("layer_ext"))
		document.getElementById("layer_ext").style.display = 'none';

	if(document.getElementById("layer_date"))
		document.getElementById("layer_date").style.display = 'none';

	if(document.getElementById("layer_price"))
		document.getElementById("layer_price").style.display = 'none';

	if(flag == "1") {
		if(isFlag == false)
			getSubCategory(showid,qtype);
		else
			isFlag = false;
	}
	else {
		isFlag = false;
		if(document.getElementById(id))
			document.getElementById(id).style.display = 'block';
	}
}

function hideZSelectBox(id) {
	document.getElementById(id).style.display = 'none';
}

function selectZSelectBox(name,value,id) {
	if(document.getElementById(id)) {
		document.getElementById(id+"_value").innerHTML = name;
		document.getElementById(id).value=value;
		document.getElementById("layer_"+id).style.display = 'none';
	}
}
