var lta = new Array(1); lta['NONE'] = new Array(1); lta['NONE']['NONE'] = 1; var lName = new Array(1); var lId = new Array(1); lName[0]=''; lId[0]='NONE'; function changeListFromObjType(listType, objType, allowNoListType) { var options = objType.options; for(var i=0; i < options.length; ++i) { if(options[i].selected) { var listIx = options[i].value; if(listIx=='') listIx = 'NONE'; changeList(listIx,listType,objType,allowNoListType); return; } } changeList('NONE',listType,objType,allowNoListType); } function changeList(listIx, listType, objType, allowNoListType) { var listTypeAllowed = lta[listIx]; var numAllowed = 0; for(var i=0; i < lId.length; ++i) { if(listTypeAllowed[lId[i]]==1) { if(allowNoListType || lId[i]!='NONE') ++numAllowed; } } var options = listType.options; var curSelected = -1; for(var i=0; i < options.length; ++i) { if(options[i].selected) { curSelected = options[i].value; break; } } listType.options.length = numAllowed; options = listType.options; var curOptionIx = 0; for(var i=0; i < lId.length; ++i) { if(listTypeAllowed[lId[i]]==1 && (allowNoListType || lId[i]!='NONE')) { var label = lName[i]; var newOption = new Option(label,lId[i]); if(curSelected==newOption.value) newOption.selected = true; listType.options[curOptionIx] = newOption; ++curOptionIx; } } }