/* 
combo.js -
check to see what state the target currently has 
(is it on or off?) and then use the necessary effect.
From - http://24ways.org/advent/introduction-to-scriptaculous-effects
*/

divIsOpen = "";

Effect.OpenUp = function(element) {
  element = $(element);
  if(divIsOpen){ new Effect.Combo(divIsOpen); }
  new Effect.BlindDown(element, arguments[1] || {});
  divIsOpen = element.id;
}

Effect.CloseDown = function(element) {
  element = $(element);
  new Effect.BlindUp(element, arguments[1] || {});
  if(divIsOpen == element.id){ divIsOpen = ""; }
}

Effect.Combo = function(element) {
  element = $(element);
  if(element.style.display == 'none') { 
    new Effect.OpenUp(element, arguments[1] || {}); 
  } else {
    new Effect.CloseDown(element, arguments[1] || {}); 
  }
}