rem: if (offset == old) return; var top = 0; for (currentCard = stack.firstChild; currentCard; currentCard = currentCard.nextSibling) { if (currentCard.faceDown()) top += this.faceDownOffset; else { if (currentCard.top != top) currentCard.top = top; top += offset; } 
add: if(offset == old) return; var top = (stack.childNodes.length - numFaceUp) * this.faceDownOffset;  card = card ? card.nextSibling : stack.firstChild while(card) { if(card.top != top) card.top = top; top += offset; card = card.nextSibling 
context:   fixStack: function(stack) {    if(stack.className!="card-fan-down") return;    if(!stack.hasChildNodes()) {      stack.offset = 0;      return;    }    var faceUp = 0;    //for(var currentCard = stack.firstChild; currentCard; currentCard = currentCard.nextSibling)    //  if (currentCard.faceUp()) ++faceUp;    var current = stack.lastChild;    while(current && current.faceUp()) {      faceUp++;      current = current.previousSibling;    }    if(faceUp <= 1) {      stack.offset = 0;      return;    }    var space = window.innerHeight - getBottom(stack.firstChild) - stack.childNodes.length * this.faceDownOffset;    var offset = this.faceDownOffset + parseInt(space / faceUp);    if (offset > this.faceUpOffset) offset = this.faceUpOffset;    var old = stack.offset || this.faceUpOffset;    stack.offset = offset;    if (offset == old) return;    var top = 0;    for (currentCard = stack.firstChild; currentCard; currentCard = currentCard.nextSibling) {      if (currentCard.faceDown())        top += this.faceDownOffset;      else {        if (currentCard.top != top)          currentCard.top = top;        top += offset;      }    }  }
meta: 3385	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/3385/ce57a8f8abe7b78ec15f0c6cdeaadaa195601850/cardslib.js/clean/cardslib.js