function ShadowObjectList(FORM,RANKING,DEPENDENCE){this.Ranking=RANKING;this.Dependence=DEPENDENCE;this.Objects=new Array();this.Unclean=new Array();this.newDepend=_ShadowObjectList_newDepend;this.check=_ShadowObjectList_check;var property;var p;for(var i=0;i<this.Ranking.length;i++){if(FORM.elements[this.Ranking[i]]!=null&&FORM.elements[this.Ranking[i]].type=="select-one"){this.Objects[this.Ranking[i]]=new ShadowObject(FORM.elements[this.Ranking[i]]);this.Unclean[this.Unclean.length]=this.Objects[this.Ranking[i]].getSelectedValue()}}for(var i=0;i<this.Dependence.length;i++){this.newDepend(i,this.Dependence[i])}this.check()}function _ShadowObjectList_newDepend(DependId,DEPEND){var d=DEPEND.split(":");for(var n=1;n<d.length;n++){var a=d[n].split("-");if(this.Objects[a[0]]!=null){this.Objects[a[0]].newDepend(DependId,a[1])}else{}}}function _ShadowObjectList_check(OBJ){if(typeof first!="undefined"){if(first==true){first=false}}if(OBJ!=undefined&&OBJ.selectedIndex>-1){var proptest=OBJ.options[OBJ.selectedIndex].value;var ptest;this.Unclean[this.Unclean.length]=OBJ.options[OBJ.selectedIndex].value}var next;var next1;while(this.Unclean.length>0){for(var j=0;j<this.Unclean.length;j++){text+=this.Unclean[j]}var val=this.Unclean.splice(0,1);var d=val[0].split("-");var NAME=d[0];var text="";var ID=d[1];if(this.Objects[NAME]!=null){var UndoRef=this.Objects[NAME].UndoList;while(UndoRef.length>0){var val=UndoRef.splice(0,1);var a=val[0].split("-");this.Objects[a[0]].unlockOption(a[2],a[1]);this.Objects[a[0]].refresh(a[0])}var RefObj=this.Objects[NAME].getOption(ID);var Depend=RefObj.DependList;for(var i=0;i<Depend.length;i++){var UndoList=new Array();var UndoIndex=new Array();var DependId=Depend[i];var d=this.Dependence[DependId].split(":");var l=1;for(var n=1;n<d.length-1;n++){var a=d[n].split("-");var prop;if(this.Objects[a[0]]){prop=this.Objects[a[0]].getSelectedValue()}else{}if(d[n]==prop){l++;if(UndoList[a[0]]==null){UndoIndex[UndoIndex.length]=a[0]}UndoList[a[0]]=this.Objects[a[0]].UndoList}}if(l==d.length-1){var a=d[d.length-1].split("-");next=this.Objects[a[0]].lockOption(DependId,a[1]);for(var j=0;j<UndoIndex.length;j++){UndoList[UndoIndex[j]][UndoList[UndoIndex[j]].length]=d[d.length-1]+"-"+DependId}if(next!=null){this.Unclean[this.Unclean.length]=next;for(var j=0;j<this.Unclean.length;j++){text+=this.Unclean[j]}}this.Objects[a[0]].refresh(a[0])}UndoList=null;UndoIndex=null}}}}function _ShadowObjectList_showState(){var x=Math.random(10);var y=Math.random(10);win=window.open("","dependstate"+x+y,"resizable=1, menubar=0,toolbar=1,status=0,scrollbars=yes,width=800,height=800");win.document.open();win.document.write("<html><body>");for(i=0;i<this.Ranking.length;i++){win.document.write("<dl><dt>"+this.Ranking[i]+"</dt>");for(j=0;j<this.Objects[this.Ranking[i]].OptionList.length;j++){win.document.write("<dd>");if(this.Objects[this.Ranking[i]].OptionList[j].islocked()==true){win.document.write("<u>"+this.Objects[this.Ranking[i]].OptionList[j].text+"</u>&nbsp;/&nbsp;"+this.Objects[this.Ranking[i]].OptionList[j].value)}else{if((this.Objects[this.Ranking[i]].RealObject.selectedIndex>-1)&&(this.Objects[this.Ranking[i]].OptionList[j].value==this.Objects[this.Ranking[i]].RealObject.options[this.Objects[this.Ranking[i]].RealObject.selectedIndex].value)){win.document.write("<b>"+this.Objects[this.Ranking[i]].OptionList[j].text+"</b>&nbsp;/&nbsp;"+this.Objects[this.Ranking[i]].OptionList[j].value);win.document.write(" Undo:");for(m=0;m<this.Objects[this.Ranking[i]].UndoList.length;m++){win.document.write(this.Objects[this.Ranking[i]].UndoList[m]+" | ")}}else{win.document.write(""+this.Objects[this.Ranking[i]].OptionList[j].text+"&nbsp;/&nbsp;"+this.Objects[this.Ranking[i]].OptionList[j].value)}}for(k=0;k<this.Objects[this.Ranking[i]].OptionList[j].LockList.length;k++){win.document.write("<dl>");win.document.write("<dd><b>"+this.Objects[this.Ranking[i]].OptionList[j].LockList[k]+"</b> <i>"+this.Dependence[this.Objects[this.Ranking[i]].OptionList[j].LockList[k]]+"</i></dd>");win.document.write("</dl>")}win.document.write("</dd>\n")}win.document.write("</dl>")}win.document.write("</body></html>");win.document.close();win.focus()}function ShadowObject(OBJ){this.RealObject=OBJ;this.mustRefresh=false;this.OptionList=new Array();this.OptionIndex=new Array();this.UndoList=new Array();this.lockOption=_ShadowObject_lockOption;this.unlockOption=_ShadowObject_unlockOption;this.newDepend=_ShadowObject_newDepend;this.getOption=_ShadowObject_getOption;this.refresh=_ShadowObject_Refresh;this.getSelectedValue=_ShadowObject_getSelectedValue;for(var i=0;i<OBJ.options.length;i++){var a=OBJ.options[i].value.split("-");this.OptionIndex[a[1]]=this.OptionList.length;this.OptionList[this.OptionList.length]=new ShadowOption(OBJ.options[i])}}function _ShadowObject_lockOption(DependId,ID){var i=0;var changeSelect=false;while(i<this.RealObject.options.length){var a=this.RealObject.options[i].value.split("-");if(a[1]==ID){if(i==this.RealObject.selectedIndex){changeSelect=true}this.RealObject.options[i]=null;this.mustRefresh=true}i++}if(this.OptionList[this.OptionIndex[ID]]!=null){this.OptionList[this.OptionIndex[ID]].lock(DependId)}if(changeSelect==true&&this.RealObject.options.length>0){this.RealObject.selectedIndex=0;var value=this.RealObject.options[this.RealObject.selectedIndex].value;return value}else{return null}}function _ShadowObject_unlockOption(DependId,ID){if(this.OptionList[this.OptionIndex[ID]]!=null){this.OptionList[this.OptionIndex[ID]].unlock(DependId);this.mustRefresh=true}}function _ShadowObject_Refresh(NAME){if(this.mustRefresh==false){return true}var SelectedValue="";SelectedValue=this.getSelectedValue();this.RealObject.options.length=0;this.RealObject.selectedIndex=-1;for(var i=0;i<this.OptionList.length;i++){if(this.OptionList[i].islocked()==false){var txt=this.OptionList[i].text;var val1=this.OptionList[i].value;var val2=this.OptionList[i].value;this.RealObject.options[this.RealObject.options.length]=new Option(txt,val1);if(val2==SelectedValue){this.RealObject.selectedIndex=this.RealObject.options.length-1}}}this.mustRefresh=false}function _ShadowObject_newDepend(DependId,ID){if(this.OptionList[this.OptionIndex[ID]]!=null){this.OptionList[this.OptionIndex[ID]].newDepend(DependId)}}function _ShadowObject_getOption(ID){return this.OptionList[this.OptionIndex[ID]]}function _ShadowObject_getSelectedValue(){if(this.RealObject.selectedIndex>-1){return this.RealObject.options[this.RealObject.selectedIndex].value}else{return""}}function ShadowOption(OBJ){this.value=OBJ.value;this.text=OBJ.text;this.LockList=new Array();this.DependList=new Array();this.lock=_ShadowOption_lock;this.unlock=_ShadowOption_unlock;this.islocked=_ShadowOption_islocked;this.newDepend=_ShadowOption_newDepend}function _ShadowOption_lock(DependId){this.LockList[this.LockList.length]=DependId}function _ShadowOption_unlock(DependId){var i=0;while(i<this.LockList.length){if(this.LockList[i]==DependId){var x=this.LockList.splice(i,1)}else{i++}}}function _ShadowOption_islocked(){if(this.LockList.length>0){return true}else{return false}}function _ShadowOption_newDepend(DependId){this.DependList[this.DependList.length]=DependId};