var start = -1;
var selected = -1;
	
function display_optgroup(strValue)
{
	var strArray = new Array();
	
	strArray = strValue.split("|");
	
	if (parseInt(strArray[0]) == 2)
	{
		selected = strArray[1];
	}
	else if (parseInt(strArray[0]) == 0)
	{
		if (start == 0)
			document.write("</optgroup>");
			
		document.write("<optgroup label=\"" + strArray[1] + "\">");				
	}
	else
	{
		if (selected == strArray[2] || selected == "-1")
		{
			document.write("<option value='" + strArray[2] + "' selected>" + strArray[1] + "</option>");
			selected=strArray[2];
		}
		else
		{
			document.write("<option value='" + strArray[2] + "'>" + strArray[1] + "</option>");
		}
	}
}

function open_optgroup(selectName, properties)
{
	start = -1;
	selected = -1;
	
	document.write("<select name='" + selectName + "' ");
	if (properties != "")
		document.write(" " + properties);
	document.write(">");
}

function close_optgroup()
{
	if (start != -1)
		document.write("</optgroup>");
	document.write("</select>");
}