function zindexreorder(first) {
  var z1, z2, z3, z4;
  z1=100; z2=90; z3=80; z4=70;
  if      (first==1) { z1=110; }
  else if (first==2) { z2=110; }
  else if (first==3) { z3=110; }
  else if (first==4) { z4=110; }
  else               { z1=110; }
  document.getElementById('deco_child1').style.zIndex = z1;
  document.getElementById('deco_child2').style.zIndex = z2;
  document.getElementById('deco_child3').style.zIndex = z3;
  document.getElementById('deco_child4').style.zIndex = z4;
}

function bg_switch(num) {
  if (document.getElementById('deco_parent')) {
    var parent = document.getElementById('deco_parent');
    if      (num==1) { parent.style.backgroundPosition = '0 -310px'; zindexreorder(1); }
    else if (num==2) { parent.style.backgroundPosition = '0 -620px'; zindexreorder(2); }
    else if (num==3) { parent.style.backgroundPosition = '0 -930px'; zindexreorder(3);}
    else if (num==4) { parent.style.backgroundPosition = '0 -1240px'; zindexreorder(4);}
    else             { parent.style.backgroundPosition = '0 0'; zindexreorder(1);}
  }
}

