﻿// Tooltips!
//
// Init tooltips on document ready by calling either:
//	
//  setTips(jQuery(selector)); - for normal '?' icons on 'a' tags with tooltips
//	setTips(jQuery(selector),"inline-content"); - for images etc.

//jQuery.noConflict();  jacksons is prototype

function setTips(helperEl,type){       
  
   jQuery(helperEl).each(function(index) {            
           // create tooltip div and insert contents from helperEl (or if .tooltip-content if 'inline-content' type)               
           if(type == "inline-content"){
                
                var tipContents = '<div class="toolTip"><div class="ttInner">' + jQuery(this).find('.tooltip-content').html() + '</div></div>';  
           }
           else{  
                var tipContents = '<div class="toolTip"><div class="ttInner">' + jQuery(this).html() + '</div></div>'; 
           }                   
           jQuery(this).after(function() {
               return tipContents;
           });
           // when mouse is over helperEl find the tooltip div and turn it on
           var tip = jQuery(this).next();
           jQuery(this).bind({
              mousemove: function(e) {
                tip.css({top: (e.pageY + 13) + "px",left: (e.pageX + 13) + "px"})
                tip.show()
              },
              mouseleave: function() {
                tip.hide()
              }
           });       
   });         
   
}