var comboboxGecko=(navigator.userAgent.indexOf ("Gecko")!=-1);
var comboboxOpera=(navigator.userAgent.indexOf ("Opera")!=-1);
var comboboxIE=(navigator.userAgent.indexOf ("MSIE")!=-1 && !comboboxGecko && !comboboxOpera);

function comboboxLabelUp (event, id)
{
	var item=(event.srcElement ? event.srcElement : event.target);
	if (item && item.id!=id+"_label" && item.id!=id+"_labeltd") return;
	comboboxToggleList (id);
}

function comboboxPopupDown (event, id)
{
	if (document.getElementById (id+"_table").disabled)
		return;

	if (event.preventDefault)
		event.preventDefault ();
	document.getElementById (id+"_popup").style.visibility="hidden";
}

function comboboxPopupUp (id)
{
	document.getElementById (id+"_popup").style.visibility="visible";
	comboboxToggleList (id);
}

function comboboxPopupOut (event, id)
{
	var item=(event.srcElement ? event.srcElement : event.target);
	if (item && item.id==id+"_popup") return;
	document.getElementById (id+"_popup").style.visibility="visible";
}

function comboboxPopupKeyDown (event, id)
{
	if (document.getElementById (id+"_list").style.display=="block")
		return;
	event.cancelBubble=true;
	if (event.preventDefault)
		event.preventDefault ();
	if (event.keyCode==13)
		comboboxToggleList (id);
}

var comboboxOldmouseup=null;
var comboboxOldkeydown=null;
var comboboxOldkeypress=null;
var comboboxCurrentID=null;

function comboboxDocumentMouseUp (event)
{
	if (!comboboxCurrentID) return;
	if (window.event)
		event=window.event;
	if (!event) return;

	var item=(event.srcElement ? event.srcElement : event.target);
	if (!item) return;
	if (item==comboboxTooltip)
	{
		comboboxSetValue (comboboxCurrentID, item.value, item.innerHTML);
		comboboxHideList (comboboxCurrentID);
	}
	else
	{
		while (item)
		{
			if (item.id==comboboxCurrentID+"_table") return;
			item=item.parentNode;
		}
		comboboxHideList (comboboxCurrentID);
	}
}

function comboboxDocumentKeyDown (event)
{
	if (!comboboxCurrentID) return;
	if (window.event)
		event=window.event;
	if (!event) return;

	event.returnValue=false;
	event.cancelBubble=true;
	if (event.preventDefault)
		event.preventDefault ();
	if (event.keyCode==27)
		comboboxHideList (comboboxCurrentID);
	else if (event.keyCode==38 || event.keyCode==40)
	{
		var newItem=null;
		if (comboboxHighlightedItem)
		{
			var item=comboboxHighlightedItem.parentNode;
			do
				item=(event.keyCode==38 ? item.previousSibling : item.nextSibling);
			while (item && item.cells[0].value==null);
			if (item)
				newItem=item.cells[0];
		}
		else
		{
			var listtable=document.getElementById (comboboxCurrentID+"_listtable");
			for (var i=0;i<listtable.rows.length && newItem==null;i++)
				if (listtable.rows[i].cells[0].value!=null)
					newItem=listtable.rows[i].cells[0];
		}
		if (newItem)
		{
			comboboxHideTooltip ();
			if (comboboxHighlightedItem)
				comboboxSetItemStyle (comboboxCurrentID, comboboxHighlightedItem.style, false);
			comboboxHighlightedItem=newItem;
			comboboxSetItemStyle (comboboxCurrentID, comboboxHighlightedItem.style, true);
			comboboxVerifyScroll (comboboxCurrentID);
		}
	}
	else if (event.keyCode==13)
	{
		if (comboboxHighlightedItem)
			comboboxSetValue (comboboxCurrentID, comboboxHighlightedItem.value, comboboxHighlightedItem.innerHTML);
		comboboxHideList (comboboxCurrentID);
	}
}

function comboboxPreventDefault (event)
{
	if (event && event.preventDefault)
		event.preventDefault ();
}

function comboboxToggleList (id)
{
	if (document.getElementById (id+"_list").style.display=="block")
		comboboxHideList (id);
	else
		comboboxShowList (id);
}

function comboboxShowList (id)
{
	if (document.getElementById (id+"_table").disabled)
		return;

	if (comboboxCurrentID!=null && comboboxCurrentID!=id)
		comboboxHideList (comboboxCurrentID);

	var list=document.getElementById (id+"_list");
	list.style.display="block";

	comboboxOldmouseup=document.onmouseup;
	document.onmouseup=comboboxDocumentMouseUp;
	comboboxOldkeydown=document.onkeydown;
	document.onkeydown=comboboxDocumentKeyDown;
	comboboxOldkeypress=document.onkeypress;
	document.onkeypress=comboboxPreventDefault;
	comboboxCurrentID=id;

	if (comboboxHighlightedItem)
		comboboxSetItemStyle (id, comboboxHighlightedItem.style, false);
	comboboxHighlightedItem=comboboxFindSelectedItem (id);
	if (comboboxHighlightedItem)
	{
		comboboxSetItemStyle (id, comboboxHighlightedItem.style, true);
		comboboxVerifyScroll (id);
	}

	comboboxCorrectDiv (list);
	comboboxHideElements (0, id, list);
}

function comboboxHideList (id)
{
	if (comboboxCurrentID!=id)
		return;

	var list=document.getElementById (id+"_list");
	list.style.display="none";

	document.onmouseup=comboboxOldmouseup;
	comboboxOldmouseup=null;
	document.onkeydown=comboboxOldkeydown;
	comboboxOldkeydown=null;
	document.onkeypress=comboboxOldkeypress;
	comboboxOldkeypress=null;
	comboboxCurrentID=null;

	if (comboboxHighlightedItem)
		comboboxSetItemStyle (id, comboboxHighlightedItem.style, false);
	comboboxHighlightedItem=null;

	comboboxShowElements (0);
	comboboxHideTooltip ();
}

function comboboxVerifyScroll (id)
{
	if (!comboboxHighlightedItem) return;
	var list=document.getElementById (id+"_list");
	var scroll=comboboxGetOffsetTop (comboboxHighlightedItem)-comboboxGetOffsetTop (list);
	var scrollmin=0;
	var scrollmax=list.clientHeight-comboboxHighlightedItem.offsetHeight;
	if (scroll<scrollmin)
		list.scrollTop+=(scroll-scrollmin);
	else if (scroll>scrollmax)
		list.scrollTop+=(scroll-scrollmax);
}

function comboboxChangeValue (event, id)
{
	var item=(event.srcElement ? event.srcElement : event.target);
	if (!item || item.tagName.toUpperCase ()!="TD" || item.value==null) return;
	comboboxSetValue (id, item.value, item.innerHTML);
	comboboxHideList (id);
}

var comboboxOnchangeEvent=new Object ();
function comboboxSetValue (id, value, label, noOnchange)
{
	var input=document.getElementById (id);
	input.value=(value ? value : "");
	document.getElementById (id+"_label").innerHTML=(label ? label : "");
	if (!noOnchange && input._onchange)
	{
		comboboxOnchangeEvent.srcElement=input;
		comboboxOnchangeEvent.target=input;
		input._onchange (input.value, comboboxOnchangeEvent);
	}
}

var comboboxTooltip=null;
var comboboxHighlightedItem=null;

function comboboxHighlightItem (event, id)
{
	var item=(event.srcElement ? event.srcElement : event.target);
	if (!item || item.tagName.toUpperCase ()!="TD") return;

	if (comboboxHighlightedItem==item) return;

	if (comboboxHighlightedItem)
	{
		comboboxSetItemStyle (id, comboboxHighlightedItem.style, false);
		comboboxHighlightedItem=null;
	}

	if (item.value==null)
	{
		comboboxHideTooltip ();
		return;
	}

	comboboxHighlightedItem=item;
	comboboxSetItemStyle (id, comboboxHighlightedItem.style, true);

	if (!comboboxTooltip)
	{
		comboboxTooltip=document.createElement ("div");
		comboboxTooltip.onmousedown=comboboxPreventDefault;
		comboboxTooltip.style.position="absolute";
		comboboxTooltip.style.display="none";
		comboboxTooltip.style.zIndex="32767";
		comboboxTooltip.style.cursor="default";
		comboboxTooltip.style.paddingLeft=1;
		comboboxTooltip.style.paddingRight=1;
		comboboxTooltip.style.paddingTop=0;
		comboboxTooltip.style.paddingBottom=0;
		comboboxTooltip.style.borderWidth=1;
		comboboxTooltip.style.borderStyle="outset";
		comboboxTooltip.style.overflow="hidden";

		var labeltd=document.getElementById (id+"_labeltd");
		labeltd.appendChild (comboboxTooltip);
	}
	var table=document.getElementById (id+"_table");
	comboboxTooltip.style.fontFamily=table.style.fontFamily;
	comboboxTooltip.style.fontSize=table.style.fontSize;
	comboboxTooltip.style.background=document.getElementById (id).selColor;
	comboboxTooltip.style.color=document.getElementById (id).backColor;
	comboboxTooltip.style.borderColor=document.getElementById (id).selColor;
	comboboxTooltip.style.left=comboboxGetOffsetLeft (item)+1;
	comboboxTooltip.style.top=comboboxGetOffsetTop (item)+1;
	comboboxTooltip.style.height=item.offsetHeight;
	comboboxTooltip.style.paddingLeft=parseInt (item.style.paddingLeft)-1;
	comboboxTooltip.value=item.value;
	comboboxTooltip.innerHTML=item.innerHTML;
	var list=document.getElementById (id+"_list");
	comboboxTooltip.style.visibility="hidden";
	comboboxTooltip.style.display="block";
	var show=(list.scrollLeft==0 && comboboxTooltip.offsetWidth>list.clientWidth);
	if (show)
		comboboxHideElements (1, id, comboboxTooltip);
	else
		comboboxShowElements (1);
	comboboxTooltip.style.display=show ? "block" : "none";
	comboboxTooltip.style.visibility="visible";
}

function comboboxHideTooltip ()
{
	if (!comboboxTooltip)
		return;
	comboboxTooltip.style.display="none";
	comboboxShowElements (1);
}

function comboboxSetItemStyle (id, style, highlighted)
{
	if (highlighted)
	{
		style.background=document.getElementById (id).selColor;
		style.color=document.getElementById (id).backColor;
	}
	else
	{
		style.background="";
		style.color=document.getElementById (id).foreColor;
	}
}

function comboboxFindSelectedItem (id)
{
	var value=document.getElementById (id).value;
	return comboboxFindItemByValue (id, value);
}

function comboboxFindItemByValue (id, value)
{
	var listtable=document.getElementById (id+"_listtable");
	for (var i=0;i<listtable.rows.length;i++)
	{
		var row=listtable.rows[i];
		for (var j=0;j<row.cells.length;j++)
		{
			var cell=row.cells[j];
			if (cell.value==value)
				return cell;
		}
	}
	return null;
}

var comboboxIFrames=new Array (2);

function comboboxHideElements (index, id, div)
{
	if (!comboboxIE) return;
	var comboboxIFrame=comboboxIFrames[index];
	if (!comboboxIFrame)
	{
		comboboxIFrame=document.createElement ("iframe");
		comboboxIFrame.style.position="absolute";
		comboboxIFrame.style.display="none";
		comboboxIFrame.style.zIndex="32765";
		comboboxIFrame.scrolling="no";
		comboboxIFrame.frameBorder="0";
		if (window.httpsBlankPage)
			comboboxIFrame.src=window.httpsBlankPage;
		var labeltd=document.getElementById (id+"_labeltd");
		labeltd.appendChild (comboboxIFrame);
		comboboxIFrames[index]=comboboxIFrame;
	}
	comboboxIFrame.style.width=div.offsetWidth;
	comboboxIFrame.style.height=div.offsetHeight;
	comboboxIFrame.style.left=div.offsetLeft;
	comboboxIFrame.style.top=div.offsetTop;
	comboboxIFrame.style.display="block";
}

function comboboxShowElements (index)
{
	if (!comboboxIE) return;
	if (comboboxIFrames[index])
		comboboxIFrames[index].style.display="none";
}

function comboboxCorrectDiv (div, top)
{
	div.style.top=(top ? top : null);
	var maxtop=document.body.scrollTop+document.body.clientHeight-div.offsetHeight;
	if (comboboxGetOffsetTop (div)>maxtop)
	{
		maxtop-=(comboboxGetOffsetTop (div)-div.offsetTop);
		if (maxtop<0)
			maxtop=0;
		div.style.top=maxtop;
	}
}

function comboboxGetOffsetLeft (tag)
{
	var tagLeft=tag.offsetLeft;
	var tagParent=tag.offsetParent;
	while (tagParent.tagName.toUpperCase ()!="BODY")
	{
		tagLeft+=tagParent.offsetLeft;
		if (tagParent.scrollLeft)
			tagLeft-=tagParent.scrollLeft;
		tagParent=tagParent.offsetParent;
	}
	return tagLeft;
}

function comboboxGetOffsetTop (tag)
{
	var tagTop=tag.offsetTop;
	var tagParent=tag.offsetParent;
	while (tagParent.tagName.toUpperCase ()!="BODY")
	{
		tagTop+=tagParent.offsetTop;
		if (tagParent.scrollTop)
			tagTop-=tagParent.scrollTop;
		tagParent=tagParent.offsetParent;
	}
	return tagTop;
}

function combobox (id, parent, disabled, imagesPath, noHidden, fontFamily, fontSize, width, listWidth, listHeight, selColor, foreColor, backColor)
{
	if (!id || (!noHidden && document.getElementById (id))) return;
	if (!parent) parent=document.body;
	if (!disabled) disabled=false;
	if (!imagesPath) imagesPath="images/combobox/";
	if (!noHidden) noHidden=false;
	if (!fontFamily) fontFamily="courier";
	if (!fontSize) fontSize="12";
	if (!width) width="30";
	if (!listWidth) listWidth="300";
	if (!listHeight) listHeight="200";
	if (!selColor) selColor="#316ac5";
	if (!foreColor) foreColor="#000000";
	if (!backColor) backColor="#ffffff";

	this.id=id;
	this.setDisabled=comboboxSetDisabled;
	this.appendItem=comboboxAppendItem;
	this.appendItems=comboboxAppendItems;
	this.appendTableItems=comboboxAppendTableItems;
	this.insertItem=comboboxInsertItem;
	this.insertItems=comboboxInsertItems;
	this.insertTableItems=comboboxInsertTableItems;
	this.removeItem=comboboxRemoveItem;
	this.removeItems=comboboxRemoveItems;
	this.removeAll=comboboxRemoveAll;
	this.getSelectedValue=comboboxGetSelectedValue;
	this.getSelectedLabel=comboboxGetSelectedLabel;
	this.setSelectedItem=comboboxSetSelectedItem;
	this.getValue=comboboxGetValue;
	this.getLabel=comboboxGetLabel;
	this.getLabelFromValue=comboboxGetLabelFromValue;
	this.getSize=comboboxGetSize;
	this.setFontFamily=comboboxSetFontFamily;
	this.setFontSize=comboboxSetFontSize;
	this.setWidth=comboboxSetWidth;
	this.setListWidth=comboboxSetListWidth;
	this.setListHeight=comboboxSetListHeight;
	this.setSelColor=comboboxSetSelColor;
	this.setForeColor=comboboxSetForeColor;
	this.setBackColor=comboboxSetBackColor;
	this.setFirstItem=comboboxSetFirstItem;
	this.setOnchange=comboboxSetOnchange;
	this.selectFirstItem=comboboxSelectFirstItem;
	this.setStyleClass=comboboxSetStyleClass;
	this.hasFirstItem=false;

	var div=document.createElement ("div");
	var innerHTML=(noHidden ? "" : "<input type='hidden' name='"+id+"' id='"+id+"'>");
	innerHTML+="\
	<table border='0' cellpadding='0' cellspacing='0' id='"+id+"_table'"+(disabled ? " disabled='true'" : "")+" style='cursor: default; font-family: "+fontFamily+"; font-size: "+fontSize+";'>\
		<tr><td>\
			<div style='border-width: 2; border:1px solid #7f9db9;'><table border='0' cellpadding='0' cellspacing='0'><tr>\
				<td id='"+id+"_labeltd' onmouseup='comboboxLabelUp (event, \""+id+"\");' style='padding-left: 2; padding-right: 2; background-color: "+backColor+";' nowrap='true'><div id='"+id+"_label' style='width: "+width+"; overflow: hidden; font-size: "+fontSize+";'></div></td>\
				<td onmousedown='comboboxPopupDown (event, \""+id+"\");' onmouseup='comboboxPopupUp (\""+id+"\");' onmouseout='comboboxPopupOut (event, \""+id+"\");'>\
					<a href='#' onclick='return false;' onkeydown='comboboxPopupKeyDown (event, \""+id+"\");'>\
						<div style='position: relative;'>\
							<div style='position: absolute; z-index: 1;'><img id='"+id+"_popuppressed' width='16' height='17' src='"+imagesPath+"popuppressed.gif' unselectable='on' border='0'></div>\
							<div style='position: relative; z-index: 2;'><img id='"+id+"_popup' width='16' height='17' src='"+imagesPath+"popup.gif' unselectable='on' border='0'></div>\
						</div>\
					</a>\
				</td>\
			</tr></table></div>\
		</td></tr>\
		<tr><td>\
			<div id='"+id+"_list' style='position: absolute; display: none; z-index: 32766; border-width: 1; border-style: solid; border-color: #000000; background-color: "+backColor+"; width: "+listWidth+"; height: "+listHeight+"; overflow: auto; overflow-x: hidden; overflow-y: auto;' onscroll='comboboxHideTooltip ();'>\
				<table border='0' cellpadding='0' cellspacing='0' id='"+id+"_listtable' onmousedown='if (event.preventDefault) event.preventDefault ();' onmousemove='comboboxHighlightItem (event, \""+id+"\");' onmouseup='comboboxChangeValue (event, \""+id+"\");' width='100%' style='font-size: "+fontSize+";'>\
				</table>\
			</div>\
		</td></tr>\
	</table>\
	";
	div.innerHTML=innerHTML;
	parent.appendChild (div);

	this.setDisabled (disabled);

	document.getElementById (id).selColor=selColor;
	document.getElementById (id).foreColor=foreColor;
	document.getElementById (id).backColor=backColor;
}

function comboboxSetDisabled (disabled)
{
	document.getElementById (this.id+"_table").disabled=disabled;
}

function comboboxLabel (label)
{
	return label=="&nbsp;" ? "" : label;
}

function comboboxAppendItem (value, label, depth, styleClass)
{
	this.insertItem (value, label, -1, depth, styleClass);
}

function comboboxAppendItems (values, labels, depths, styleClasses)
{
	for (var i=0;i<values.length;i++)
		this.appendItem (values[i], labels[i], depths ? depths[i] : null, styleClasses ? styleClasses[i] : null);
}

function comboboxAppendTableItems (table)
{
	this.insertTableItems (table, -1);
}

function comboboxInsertItem (value, label, index, depth, styleClass)
{
	var listtable=document.getElementById (this.id+"_listtable");
	var item=listtable.insertRow (index!=-1 && this.hasFirstItem ? index+1 : index).insertCell (-1);
	item.value=value;
	item.innerHTML=(label=="" ? "&nbsp;" : label);
	item.style.paddingLeft=2+(depth ? depth : 0);
	item.style.paddingRight=2;
	item.style.paddingTop=1;
	item.style.paddingBottom=1;
	item.style.color=document.getElementById (this.id).foreColor;
	item.noWrap=true;
	item.unselectable="on";
	if (styleClass)
		comboboxSetElementStyleClass (item, styleClass);
}

function comboboxInsertItems (values, labels, index, depths, styleClasses)
{
	for (var i=values.length-1;i>=0;i--)
		this.insertItem (values[i], labels[i], index, depths ? depths[i] : null, styleClasses ? styleClasses[i] : null);
}

function comboboxInsertTableItems (table, index)
{
	var listtable=document.getElementById (this.id+"_listtable");
	var listtbody=(comboboxIE ? listtable.childNodes[0] : listtable);
	var tbody=(comboboxIE ? table.childNodes[0] : table);
	var insertBefore=(index!=-1 ? listtbody.childNodes[index] : null);
	while (tbody.childNodes.length)
	{
		var tr=tbody.childNodes[0];
		if (insertBefore)
			listtbody.insertBefore (tr, insertBefore);
		else
			listtbody.appendChild (tr);
	}
}

function comboboxRemoveItem (value)
{
	var item=comboboxFindItemByValue (this.id, value);
	if (!item) return;
	item.parentNode.parentNode.removeChild (item.parentNode);
	if (value==-1)
		this.hasFirstItem=false;
	if (value==this.getSelectedValue ())
		this.setSelectedItem (null);
}

function comboboxRemoveItems (values)
{
	for (var i=0;i<values.length;i++)
		this.removeItem (values[i]);
}

function comboboxRemoveAll ()
{
	var listtable=document.getElementById (this.id+"_listtable");
	while (listtable.rows.length>(this.hasFirstItem ? 1 : 0))
	{
		var row=listtable.rows[this.hasFirstItem ? 1 : 0];
		row.parentNode.removeChild (row);
	}
	this.setSelectedItem (null);
}

function comboboxGetSelectedValue ()
{
	return document.getElementById (this.id).value;
}

function comboboxGetSelectedLabel ()
{
	return comboboxLabel (document.getElementById (this.id+"_label").innerHTML);
}

function comboboxSetSelectedItem (value)
{
	if (value==null)
	{
		comboboxSetValue (this.id, null, null, true);
		return;
	}
	var item=comboboxFindItemByValue (this.id, value);
	if (item)
		comboboxSetValue (this.id, value, item.innerHTML, true);
}

function comboboxGetValue (index)
{
	var listtable=document.getElementById (this.id+"_listtable");
	if (this.hasFirstItem) index++;
	if (index>=listtable.rows.length) return null;
	return listtable.rows[index].cells[0].value;
}

function comboboxGetLabel (index)
{
	var listtable=document.getElementById (this.id+"_listtable");
	if (this.hasFirstItem) index++;
	if (index>=listtable.rows.length) return null;
	return comboboxLabel (listtable.rows[index].cells[0].innerHTML);
}

function comboboxGetLabelFromValue (value)
{
	var item=comboboxFindItemByValue (this.id, value);
	if (item)
		return comboboxLabel (item.innerHTML);
	return null;
}

function comboboxGetSize ()
{
	var listtable=document.getElementById (this.id+"_listtable");
	return (this.hasFirstItem ? listtable.rows.length-1 : listtable.rows.length);
}

function comboboxSetFontFamily (fontFamily)
{
	document.getElementById (this.id+"_table").style.fontFamily=fontFamily;
}

function comboboxSetFontSize (fontSize)
{
	document.getElementById (this.id+"_table").style.fontSize=fontSize;
	document.getElementById (this.id+"_label").style.fontSize=fontSize;
	document.getElementById (this.id+"_listtable").style.fontSize=fontSize;
}

function comboboxSetWidth (width)
{
	document.getElementById (this.id+"_label").style.width=width;
}

function comboboxSetListWidth (listWidth)
{
	document.getElementById (this.id+"_list").style.width=listWidth;
}

function comboboxSetListHeight (listHeight)
{
	document.getElementById (this.id+"_list").style.height=listHeight;
}

function comboboxSetSelColor (selColor)
{
	document.getElementById (this.id).selColor=selColor;
}

function comboboxSetForeColor (foreColor)
{
	document.getElementById (this.id).foreColor=foreColor;
	document.getElementById (this.id+"_labeltd").style.color=foreColor;
	var listtable=document.getElementById (this.id+"_listtable");
	for (var i=0;i<listtable.rows.length;i++)
		listtable.rows[i].cells[0].style.color=foreColor;
}

function comboboxSetBackColor (backColor)
{
	document.getElementById (this.id).backColor=backColor;
	document.getElementById (this.id+"_labeltd").style.backgroundColor=backColor;
	document.getElementById (this.id+"_list").style.backgroundColor=backColor;
}

function comboboxSetFirstItem (label)
{
	this.removeItem (-1);
	if (label)
	{
		this.insertItem (-1, label, 0);
		this.hasFirstItem=true;
		this.setSelectedItem (-1);
	}
}

function comboboxSetOnchange (onchange)
{
	document.getElementById (this.id)._onchange=onchange;
}

function comboboxSelectFirstItem ()
{
	if (this.hasFirstItem)
		this.setSelectedItem (-1);
	else if (this.getSize ()>0)
		this.setSelectedItem (this.getValue (0));
}

var comboboxHiddenDiv=null;
var comboboxStyleClassDiv=null;
function comboboxSetStyleClass (styleClass)
{
	if (!comboboxHiddenDiv)
	{
		comboboxHiddenDiv=document.createElement ("div");
		comboboxHiddenDiv.style.width=0;
		comboboxHiddenDiv.style.height=0;
		comboboxHiddenDiv.style.overflow="hidden";
		comboboxStyleClassDiv=document.createElement ("div");
		comboboxHiddenDiv.appendChild (comboboxStyleClassDiv);
	}

	var list=document.getElementById (this.id+"_list");
	var listDisplay=list.style.display;
	list.style.visibility="hidden";
	list.style.display="block";
	list.appendChild (comboboxHiddenDiv);

	comboboxSetElementStyleClass (comboboxStyleClassDiv, styleClass);
	var offsetWidth=comboboxStyleClassDiv.offsetWidth;

	this.setFontFamily (comboboxGetStyle (comboboxStyleClassDiv, "font-family", "fontFamily"));
	this.setFontSize (comboboxGetStyle (comboboxStyleClassDiv, "font-size", "fontSize"));
	this.setListWidth (comboboxGetStyle (comboboxStyleClassDiv, "width", "width"));
	this.setListHeight (comboboxGetStyle (comboboxStyleClassDiv, "height", "height"));
	this.setForeColor (comboboxGetStyle (comboboxStyleClassDiv, "color", "color"));
	this.setBackColor (comboboxGetStyle (comboboxStyleClassDiv, "background-color", "backgroundColor"));
	var popup=document.getElementById (this.id+"_popup");
	var width=parseInt (comboboxGetStyle (comboboxStyleClassDiv, "width", "width"))-parseInt (comboboxGetStyle (popup, "width", "width"))-8;
	if (width>0)
		this.setWidth (width);

	list.removeChild (comboboxHiddenDiv);
	list.style.display=listDisplay;
	list.style.visibility="visible";
}

function comboboxGetStyle (element, propertyName, propertyNameIE)
{
	if (element.currentStyle)
		return element.currentStyle[propertyNameIE];
	if (window.getComputedStyle)
		return document.defaultView.getComputedStyle (element, null).getPropertyValue (propertyName);
	return "";
}

function comboboxSetElementStyle (element, style)
{
	if (comboboxGecko || comboboxOpera)
		element.setAttribute ("style", style);
	else
		element.style.cssText=style;
}

function comboboxSetElementStyleClass (element, styleClass)
{
	if (comboboxGecko || comboboxOpera)
		element.setAttribute ("class", styleClass);
	else
		element.className=styleClass;
}
