// JavaScript Document
function change(currentbox,prefix) {
	numb = currentbox.id.split("_");
	currentbox = numb[1];
	if(prefix == null){
		prefix = "combo";
	}
    i=parseInt(currentbox)+1;

    while ((eval("typeof(document.getElementById(\""+prefix+"_"+i+"\"))!='undefined'")) &&
           (document.getElementById("combo_"+i)!=null)) {
         son = document.getElementById(prefix+"_"+i);
	     // I empty all options except the first one (it isn't allowed)
	     for (m=son.options.length-1;m>0;m--) son.options[m]=null;
	     // I reset the first option
	     son.options[0]=new Option(displaywhenempty,valuewhenempty);
	     i=i+1;
    }

    stringa='data';
    i=0;
    while ((eval("typeof(document.getElementById(\""+prefix+"_"+i+"\"))!='undefined'")) &&
           (document.getElementById(prefix+"_"+i)!=null)) {
           eval("stringa=stringa+'_'+document.getElementById(\""+prefix+"_"+i+"\").selectedIndex")
           if (i==currentbox) break;
           i=i+1;
    }


// filling the "son" combo (if exists)

    following=parseInt(currentbox)+1

    if ((eval("typeof(document.getElementById(\""+prefix+"_"+following+"\"))!='undefined'")) &&
       (document.getElementById(prefix+"_"+following)!=null)) {
       son = document.getElementById(prefix+"_"+following);
       stringa=stringa+"_";
       i=0;
	   
	   for (m=son.options.length-1;m>0;m--) son.options[m]=null;
	   
       while ((eval("typeof("+stringa+i+")!='undefined'")) || (i==0)) {

       // if there are no options, I empty the first option of the "son" combo
	   // otherwise I put "-select-" in it

	   	  if ((i==0) && eval("typeof("+stringa+"0)=='undefined'"))
	   	      if (eval("typeof("+stringa+"1)=='undefined'"))
	   	         eval("son.options[0]=new Option(displaywhenempty,valuewhenempty)")
	   	      else
	             eval("son.options[0]=new Option(displaywhennotempty,valuewhennotempty)")
	      else
              eval("son.options["+i+"]=new Option("+stringa+i+".text,"+stringa+i+".value)")
	      i=i+1
		  
		 // alert(i);
		  
	   }
       i=1;
       combostatus='';
       cstatus=stringa.split("_");
       while (cstatus[i]!=null) {
          combostatus=combostatus+cstatus[i];
          i=i+1;
          }
       return combostatus;
    }
}