 var TabGroup = new Class({ "Implements": [Options,Events], "options": { "tabs": [], "tabIndex": 0, "wrap": true }, "initialize": function (a)
  {
    this.setOptions(a);
    this.addTabs(this.options.tabs);
    if (this.tabs.length)
      {
        this.showTab(this.options.tabIndex);
      }
  }, "tabs": [], "addTabs": function (a)
  {
    $$(a).each(function (b)
    {
      this.tabs.include($(b));
      b.setStyle("display", "none");
    }, this);
  }, "addTab": function (a)
  {
    this.addTabs($splat($(a)));
  }, "showTab": function (d)
  {
	var b = this.now;
	var e = this.tabs[b];
	var c = this.tabs[d];
	if(c == e)// the tab is already showing, do nothing
	{return;}
	if(c)
	{
		if ($chk(b) && b != d)// only proceed if the tab to show is not already showing
		  {					
		  	$('tabarea').getFirst().get('tween', {property: 'margin-top', duration: '500', onComplete:function(){
					$('tabarea').getFirst().setStyle("display","none");
					var copy = c.clone().setStyle('display','block');		
					c.setStyles({display:'block','margin-top':-280});
					c.inject('tabarea','top');
					c.get('tween', {property: 'margin-top', duration: '500', onComplete:function(){
						if(c.getFirst().get('id') != 'flashcontent'){
							c.setStyle("display","none");
							copy.inject('tabarea','top');
						}
					}
					}).start(0);
			  }
			  }).start(-280);
		  }
		else// show the inital tab on page load
		  {
				c.setStyles({display:'block'});
		  }
		this.now = d;
	  }
  }
});
