function DropDown(){
	this.Lists=new Array();
	this.Add=AddDropDownList;
	this.updateList=UpdateDropDownList;
	
}

function UpdateDropDownList(ID){
	var List=this.Lists[ID];
	var RelList=document.forms[List.FormName].elements[List.List2];
	var MainList=document.forms[List.FormName].elements[List.List1];
	var List1Value=MainList.options[MainList.selectedIndex].value;
	var PrevLength=RelList.length;
	if (List1Value.length>0){
		for(var i = RelList.options.length - 1; i > 0; i--) 
                      RelList.options[i] = null; // null out in reverse order (bug workarnd)
		for (var i=0;i<List.Items.length;i++){
			if(List.Items[i].Value==List1Value){
				for (var x=0;x<List.Items[i].Items.length;x++){
					var NewListOption = new Option(List.Items[i].Items[x].Name, List.Items[i].Items[x].Value, false, false);
	    			RelList.options[x] = NewListOption;
				}
				RelList.options[0].selected = true;
			}
		}
	}
}
var DropDownLists=new DropDown();

function DropDownList(_ID,_List1,_List2,_FormName){
	this.ID=_ID;
	this.List1=_List1;
	this.List2=_List2;
	this.FormName=_FormName;
	this.Items=new Array();
	this.Add=AddListItem;
}
function ListItem (_Name,_Value){
	this.Name=_Name;
	this.Value=_Value;
	this.Items=new Array();
	this.Add=AddListItem;
}
function AddListItem(Obj){
	this.Items[this.Items.length]=Obj;
}
function AddDropDownList(Obj){
	this.Lists[this.Lists.length]=Obj;
}

function updateList(obj) {
	var cid2 = obj.options[obj.selectedIndex].value;
	if (cid2 != '') {
		url = 'c-product-select-header.cfm?';
		url = url + 'cid=' + cid;
		url = url + '&cid2=' + cid2;	
		window.location.href = url;
	}
}

function showProducts(obj) {
	var cid = obj.options[obj.selectedIndex].value;
	if (cid != '') {
		window.top.frames['bottom'].loading_on();
		document.forms['productselect'].submit()
	}
}