$(document).ready(function() {
  
  //clear existing HTML
  
  $('.toolTip').each(function (i) {
    this.tip = this.innerHTML;
    this.innerHTML = '';
    this.style.visibility = 'visible';
    this.style.overflow = 'visible';
    
    //check if an inline width is set
    if (this.style.width != '') {
        InlineCss = ' style="width:' + this.style.width + '"';
        this.style.width = 'auto'; //reset width and use the width in the toolTipWrapper
    } else {
        InlineCss = '';
    }
    
    $(this).append(
     '<div class="toolTipWrapper"'+InlineCss+'>'
        +'<div class="toolTipContent">'
          +this.tip
        +'</div>'
      +'</div>'
    );
  });
  
  $('.toolTip').hover(
    function() {
        $(this).css({zIndex:999});
        $(this).find('.toolTipWrapper').fadeIn(300);
  },
    function() {
        $(this).css({zIndex:1});
        $(this).find('.toolTipWrapper').fadeOut(100);
      }
  );
});