	//Encapsulation to make the listbox not browserspecific

	//Code may be browser specific here. Add support for more than IE later
	function lstbox_remove(index)  	{ if(index>=0) this.listctrl().remove(index); }
	function lstbox_options(index) 	{ if(index>=0) return this.listctrl().options[index]; }
	function lstbox_add(name,data) 	{ this.listctrl().options[this.listctrl().options.length] = new Option(name,data); }
	function lstbox_index() 	{ return this.listctrl().selectedIndex; }
	function lstbox_getvalue(index)	{ if(index>=0) return this.options(index).value; }
	function lstbox_gettext(index)	{ if(index>=0) return this.options(index).text; }
	function lstbox_select(index)	{ if(index>=0) this.listctrl().selectedIndex=index; }
	function lstbox_count()		{ return this.listctrl().options.length; }
	function lstbox_listctrl()
	{
		if(this.internlistctrl) return this.internlistctrl;
		this.internlistctrl=document.forms[0].elements[this.name];
		return this.internlistctrl;
	}
	function lstbox_setoption(index,text,value)
	{
		if(index<0) return;
		this.listctrl().options[index].value=value;
		this.listctrl().options[index].text=text;
	}
	function lstbox_setonchange(func)
	{
		this.listctrl().onchange=func;
	}
	function lstbox_settag(data)
	{
		this.listctrl().tag=data;
	}
	function lstbox_gettag()
	{
		return this.listctrl().tag;
	}

	//No browser specific code below this comment
	function lstbox_clear()			{ while(this.count()>0) this.remove(0);}
	function lstbox_activevalue()		{ return this.getvalue(this.index()); }
	function lstbox_activetext()		{ return this.gettext(this.index()); }
	function lstbox_currentremove()		{ this.remove(this.index()); }
	function lstbox_currentup()		{ this.up(this.index()); }
	function lstbox_currentdown()		{ this.down(this.index()); }
	function lstbox_up(index)		{ this.swap(index-1,index); }
	function lstbox_down(index)		{ this.swap(index+1,index); }
	function lstbox_serializevalues()
	{ 
		var i;
		var l=this.count();
		var s='';
		for(i=0;i<l;i++)
		{
			s=s+this.getvalue(i)+';';
		}
		return s;
	}
	function lstbox_serializetextandvalues()
	{ 
		var i;
		var l=this.count();
		var s='';
		for(i=0;i<l;i++)
		{
			s=s+this.getvalue(i)+';'+this.gettext(i)+';';
		}
		return s;
	}
	function lstbox_swap(index1,index2)
	{		
		if(index1<0 || index2<0 || index1>this.count()-1 || index2>this.count()-1) return;
		var index1text=this.gettext(index1);
		var index1value=this.getvalue(index1);
		this.setoption(index1,this.gettext(index2),this.getvalue(index2));
		this.setoption(index2,index1text,index1value);
		this.select(index1);
	}
	function lstbox(name)
	{
		this.serializevalues=lstbox_serializevalues;
		this.serializetextandvalues=lstbox_serializetextandvalues;
		this.name=name;
		this.swap=lstbox_swap;
		this.add=lstbox_add;
		this.remove=lstbox_remove;
		this.up=lstbox_up;
		this.down=lstbox_down;
		this.currentup=lstbox_currentup;
		this.currentdown=lstbox_currentdown;
		this.currentremove=lstbox_currentremove;
		this.options=lstbox_options;
		this.clear=lstbox_clear;
		this.setoption=lstbox_setoption;
		this.listctrl=lstbox_listctrl;
		this.index=lstbox_index;
		this.getvalue=lstbox_getvalue;
		this.gettext=lstbox_gettext;
		this.select=lstbox_select;
		this.count=lstbox_count;
		this.activevalue=lstbox_activevalue;
		this.activetext=lstbox_activetext;
		this.setonchange=lstbox_setonchange;
		this.settag=lstbox_settag;
		this.gettag=lstbox_gettag;
	}

