//
// Minitabs 0.1
// Requires jquery
//
//
// Usage :
//
// $("#container").minitabs([speed],[slide|fade]);
//
var tempObj;

jQuery.fn.minitabs = function(speed,effect,tab) {

  (!tab) ? tab = 0 : tab -= 1;
  var re = /([_\-\w]+$)/i;
  id = "#" + this.attr('id')
  $(id + ">LI>A").each( 
    function (index){
      if (tab!=index) {
        $('#' + re.exec(this.href)[1]).hide();
      } else {
        $(this).addClass("current")
        $('#' + re.exec(this.href)[1]).addClass("current");
      } 
    }
  );

  $(id + ">LI>A").click(
   
    function(){
      $(id + ">LI>A").removeClass("current");
      $(this).addClass("current").blur();
      //$(this).blur();
      var re = /([_\-\w]+$)/i;
      var target = $('#' + re.exec(this.href)[1]);
      var old = $("DIV.current");
      
      old.removeClass("current");
      target.addClass("current");
      tempObj = target
      switch (effect) {
        case 'fade':
          old.fadeOut(speed, function (){
            
            tempObj.fadeIn(speed)

          });  
          break;
        case 'slide':
          old.slideUp(speed, function (){
            
            tempObj.fadeIn("slow")
            tempObj.slideDown("slow")
          });  
          //target.fadeOut(speed).fadeIn(speed);
          break;
        default : 
          old.hide(speed);
          target.show(speed)
      }
      
    }
 );
}

