// jQuery.bbrk.home.toolTip.js

(function ($) {
  
  if (typeof $.bbrk === "undefined") {
    $.bbrk = {};
  }
  
  if (typeof $.bbrk.home === "undefined") {
    $.bbrk.home = {};
  }
  
  $.bbrk.home.toolTip = function () {
  
    var $toolTip;
    var $contents;
    
    $toolTip = $.simpleTip({
      position: {
        x: 20,
        y: 0
      },
      resistance: 4
    });
    
    $toolTip.css({
      zIndex: "100"
    });
    
    $toolTip.addClass("toolTip");

    $contents = $("<div>", {
      "class": "contents"
    });
    
    $contents.css({
      width: 0,
      opacity: 0
    });
    
    $contents.html("<img src=\"assets/img/icon/iteminfo.png\">");
    
    $toolTip.html($contents);
    
    $toolTip.fadeIn = function (duration, easing, top, left) {

      $toolTip.show(top, left);

      $contents.stop();

      $contents.animate({
        width: 77,
        opacity: 1
      },{
        duration: duration,
        easing: easing
      });
    };
    
    $toolTip.fadeOut = function (duration, easing) {

      $contents.stop();

      $contents.animate({
        opacity: 0
      },{
        duration: duration,
        easing: easing,
        complete: function () {
          
          $contents.css({
            width: 0
          });
          
          $toolTip.hide();
        }
      });
    };
    
    return $toolTip;
  };
  
})(jQuery);

