/*
  Dragonfly Depot menu effect manager. v1.0
  This is where Hans learns the Prototype libraries
*/
PopupLink = Class.create({
  initialize: function(element) {
	element.observe('click', this.togglePopup.bindAsEventListener(element));
    $(element.id + '-div').hide();
  },
  togglePopup: function(click) {
	  // Get the state of the current div
  	var visible = $(this.id + '-div').visible()
	
  	// Hide 'em all
  	$$('.popup').invoke('hide');
	
  	// Toggle visibility
  	if (visible) {
      $(this.id + '-div').hide();
  	} else {
      $(this.id + '-div').show();
	  
	    // We might want to try to set a modal window by putting an overlay on the whole keilbasa
  	  // Let's come up with the code for this.
	
	
  	  // $(this.id + '-div').setStyle({
  	  //   'z-index': '9999',
  	  //   opacity: 1
  	  // });
	  }
  }
});