function exp(el,sf) {
  if(document.getElementById(el).style.display=='none') {
    document.getElementById(el).style.display='block';
    sf.src="ex02.gif";
  } else {
    document.getElementById(el).style.display='none';
    sf.src="ex01.gif";
  }
}

function chk_down(indx,va) {
  for(var i=1; i<=cha_e[indx]; i++) {
    document.rs.c[indx+i].checked=va;
    checks[indx+i]=va;
    if(cha_e[indx+i]!=0)
      chk_down(indx+i,va);
  }
}

function chk_up0(indx) {
  if(indx!=-1) {
    document.rs.c[indx].checked=0;
    checks[indx]=0;
    chk_up0(par_e[indx]);
  }
}

function chk_up1(indx) {
  if(indx!=-1) {
    var all_one=true;
    for(var i=1; i<=cha_e[indx]; i++)
      if(checks[indx+i]==0) all_one=false;
    if(all_one) {
      document.rs.c[indx].checked=1;
      checks[indx]=1;
      chk_up1(par_e[indx]);
    }
  }
}

function upped(indx) {
 checks[indx]=document.rs.c[indx].checked;
 chk_down(indx,checks[indx]);
 if(checks[indx]==0) chk_up0(par_e[indx]);
 else chk_up1(par_e[indx]);
}