var comboPrefix = '';
function ComboItem (_Kod, _Ad, _Tip, _Owner) {
	this.Kod = _Kod?_Kod:0;
	this.Ad  = _Ad?_Ad:'';
	this.Tip = _Tip?_Tip:'';
	this.Owner = _Owner?_Owner:'0';
}
function ComboList(){
	this.Items=new Array();
	this.Add = function (_Kod, _Ad, _Tip, _Owner){
		this.Items[this.Items.length] = new ComboItem (_Kod, _Ad, _Tip, _Owner);
	}
	this.Fill = function (_Combo, _Tip, _Owner) {
	 var Combo = document.getElementById( comboPrefix + _Combo );
	 Combo.options.length = 0;
	 var own = typeof(_Owner)=="string"?_Owner:_Owner.options[_Owner.selectedIndex].value;
	 for (_i in this.Items){
	  if (this.Items[_i].Tip == _Tip) {
		if ( this.Items[_i].Kod == 0 || this.Items[_i].Owner == own ) { 
		 Combo.options[Combo.options.length] = new Option( this.Items[_i].Ad, this.Items[_i].Kod );
		 Combo.options[Combo.options.length-1].selected = (this.Items[_i].Kod==0);
		}
	  }
	 }
	}
}
var CL = new ComboList();
function setId (_id,_obj){
	if(document.getElementById(_id ))
	document.getElementById(_id ).value = _obj.options[_obj.selectedIndex].value;
}