function ItemsSelectable(listname)
{
	this.name=listname;
	this.selectables=new Array();
	this.selectedIndex=0;
	this.itemsHtml="ItemsSelectable: HTML not created...";
	this.numberOfColumns=1;
	this.eventType = "";
	this.listeners=new Array();
	this.itemColumnSpacing=10;
	this.itemPadding=5;
	this.itemFontFamily="Arial, Helvetica, sans-serif";
	this.itemFontSize=8;
	this.itemFontStyle="normal";
	this.itemFontWeight="normal";
	this.itemColor="black";
	this.itemBackgroundColor="transparent";
	this.itemBorder="none";
	this.itemTextDecoration="none";
	this.itemDisabledColor="#aaa";
	this.itemHighlightColor="red";
	this.itemHighlightBackgroundColor="transparent";
	this.itemHighlightBorder="none";
	this.itemHighlightTextDecoration="none";
}
function itemsselectable_actionPerformed(source){
	defaultStatus="actionPerformed("+source+")";
}
function itemsselectable_addActionListener(listener){
	this.listeners[this.listeners.length]="actionListener";
	this.listeners[this.listeners.length]=listener;
}
function itemsselectable_addChangeListener(listener){
	this.listeners[this.listeners.length]="changeListener";
	this.listeners[this.listeners.length]=listener;
}
function itemsselectable_addSelectable(itemToAdd){
	this.selectables[this.selectables.length]=itemToAdd;
}
function itemsselectable_createItemsHtml(){
	var count=0;
	this.itemsHtml="<table cellspacing=0>";
	while(count<this.selectables.length){
		this.itemsHtml+="<tr>";
		for(var i=0;i<this.numberOfColumns;i++){
			if(count<this.selectables.length){
				this.itemsHtml+="<td id='"+this.selectables[count].label+"' ";
			this.itemsHtml+="style='cursor:pointer;"+
			"color:"+this.itemColor+";"+
			"background-color:"+this.itemBackgroundColor+";"+
			"border:"+this.itemBorder+";"+
			"padding-left:"+this.itemPadding+"px;"+
			"padding-right:"+this.itemPadding+"px; "+
			"font-weight:"+this.itemFontWeight+";"+
			"font-size:"+this.itemFontSize+"pt;"+
			"font-family:"+this.itemFontFamily+"; "+
			"text-decoration:" + this.itemTextDecoration+";' "+
			"onmouseover='top."+this.name+".fireStateChanged(\"onmouseover\","+count+")' "+
			"onmouseout='top."+this.name+".fireStateChanged(\"onmouseout\","+count+")' "+
			"onclick='top."+this.name+".fireActionPerformed("+count+")'>"+
			this.selectables[count].label+"</td>";
		}
		if(i<this.numberOfColumns-1)this.itemsHtml+="<td width='"+this.itemsColumnSpacing+"'></td>";
		count++;
	    }
	    this.itemsHtml+="</tr>";
	}
	this.itemsHtml+="</table>";
}
function itemsselectable_fireActionPerformed(index){
	if(!this.selectables[index].enabled)return;
	this.selectedIndex=index;
	for(var i=0;i<this.listeners.length;i+=2)
		if(this.listeners[i]=="actionListener")
			eval(this.listeners[i+1]+".actionPerformed(\""+this.name+"\")");
}
function itemsselectable_fireStateChanged(eType,index){
	if(!this.selectables[index].enabled)return;
	this.eventType=eType;
	for(var i=0;i<this.listeners.length;i+=2)
		if(this.listeners[i]=="changeListener")
			eval(this.listeners[i+1]+".stateChanged(\""+this.name+"\", "+index+")");
}
function itemsselectable_getElementAt(index){if(this.selectables!=null)return this.selectables[index];}
function itemsselectable_getLength(){
	if(this.selectables!=null)return this.selectables.length;
	else return 0;
}
function itemsselectable_getHtml(){return this.itemsHtml;}
function itemsselectable_getIndexedSelectable(){return this.selectables[this.selectedIndex];}
function itemsselectable_highlightItem(index){
	var element=ge(this.selectables[index].label);
	element.style.backgroundColor=this.itemHighlightBackgroundColor;
	element.style.color=this.itemHighlightColor;
	element.style.border=this.itemHighlightBorder;
	element.style.textDecoration=this.itemHighlightTextDecoration;
}
function itemsselectable_select(itemtype){this.selectItems(itemtype);this.update();}
function itemsselectable_selectItems(itemtype){
	if(this.selectables==null)return;
	for(var i=0;i<this.selectables.length;i++)
		for(var j = 0; j < this.selectables[i].types.length; j++)
			if(itemtype==this.selectables[i].types[j]){
				this.selectables[i].enabled = true;break;
			}else this.selectables[i].enabled = false;
}
function itemsselectable_stateChanged(source,index){
	if(this.eventType=="onmouseover")this.highlightItem(index);
	else if(this.eventType=="onmouseout")this.unhighlightItem(index);
}
function itemsselectable_unhighlightItem(index){
	var element=ge(this.selectables[index].label);
	element.style.backgroundColor=this.itemBackgroundColor;
	element.style.color=this.itemColor;
	element.style.border=this.itemBorder;
	element.style.textDecoration=this.itemTextDecoration;
}
function itemsselectable_update(){
	for(var i=0;i<this.selectables.length;i++){
		var element=ge(this.selectables[i].label);
		if(this.selectables[i].enabled){
			element.style.color = this.itemColor;
			element.style.cursor = "pointer";
		}else{
			element.style.color = this.itemDisabledColor;
			element.style.cursor = "default";
		}
	}
}
ItemsSelectable.prototype.actionPerformed=itemsselectable_actionPerformed;
ItemsSelectable.prototype.addActionListener=itemsselectable_addActionListener;
ItemsSelectable.prototype.addChangeListener=itemsselectable_addChangeListener;
ItemsSelectable.prototype.addSelectable=itemsselectable_addSelectable;
ItemsSelectable.prototype.classId="ItemsSelectable";
ItemsSelectable.prototype.createItemsHtml=itemsselectable_createItemsHtml;
ItemsSelectable.prototype.fireActionPerformed=itemsselectable_fireActionPerformed;
ItemsSelectable.prototype.fireStateChanged=itemsselectable_fireStateChanged;
ItemsSelectable.prototype.getElementAt=itemsselectable_getElementAt;
ItemsSelectable.prototype.getLength=itemsselectable_getLength;
ItemsSelectable.prototype.getHtml=itemsselectable_getHtml;
ItemsSelectable.prototype.getIndexedSelectable=itemsselectable_getIndexedSelectable;
ItemsSelectable.prototype.highlightItem=itemsselectable_highlightItem;
ItemsSelectable.prototype.select=itemsselectable_select;
ItemsSelectable.prototype.selectItems=itemsselectable_selectItems;
ItemsSelectable.prototype.stateChanged=itemsselectable_stateChanged;
ItemsSelectable.prototype.unhighlightItem=itemsselectable_unhighlightItem;
ItemsSelectable.prototype.update=itemsselectable_update;
ItemsSelectable.SELECT_ALL=0;