﻿//two dependent combo (master_slave combos) ___ begin
	function selectOption(value, text, supplier){
		this.value=value;
		this.text=text;
		this.supplier=supplier;
	}

	function ComboBox() {
		this.items = new Array();
		this.addItem=addItem;
		this.makeOptions=makeOptions;
		this.makeClientOptions=makeClientOptions;
		this.makeOptionsHidden=makeOptionsHidden;
		return this;
	}

	function addItem(item) {
		this.items[this.items.length] = item;
	}

	function makeOptions(comboName) {
		comboBox=eval("document.getElementById['" + comboName+"']");
		comboBox.length=1;
		for(var i=0;i<this.items.length;++i)
		{
			comboBox.length++;
			endId=comboBox.length-1;
			comboBox.options[endId].value=this.items[i].value;
			comboBox.options[endId].text=this.items[i].text;
		}
	}

	function makeClientOptions(comboName,supplierComboName) {
		comboBox=eval("document.getElementById['"+ comboName + "']");
		supplierComboBox=eval("document.getElementById['"+ supplierComboName+"']");

		comboBox.length=1;
		supplierValue = supplierComboBox.options[supplierComboBox.selectedIndex].value;

		for(var i=0;i<this.items.length;++i)
			if(this.items[i].supplier==supplierValue)
			{
				comboBox.length++;
				endId=comboBox.length-1;
				comboBox.options[endId].value=this.items[i].value;
				comboBox.options[endId].text =this.items[i].text;
			}
	}
	function makeOptionsHidden(comboName,supplierValue) {
		comboBox=eval("document.getElementById['"+ comboName + "']");

		comboBox.length=1;

		for(var i=0;i<this.items.length;++i)
			if(this.items[i].supplier==supplierValue)
			{
				comboBox.length++;
				endId=comboBox.length-1;
				comboBox.options[endId].value=this.items[i].value;
				comboBox.options[endId].text =this.items[i].text;
			}
	}
//two dependent combo (master_slave combos) ___ end