function loadToolTips(tooltips, opts) {
	var opts = opts || {
		// custom positioning
		position: 'center right',
		events: {
			def: "mouseover,mouseout",
			input: "focus,blur",
			widget: "focus mouseover,blur mouseout",
			tooltip: "mouseover,mouseout"
		},
		onShow: function(event, offset) {
			var offSetTop = this.getTrigger().offset().top - 7;
			this.getTip().css('top', offSetTop + 'px');
		},
		offset: [0, 5],
		effect: 'toggle',
		// there is no delay when the mouse is moved away from the trigger
		delay: 0
	};

	// create tooltip container 
	var htmlEl = document.createElement('div');

	// create unique id
	htmlEl.id = 'tooltip_' + (function() { var r = Math.floor(Math.random() * 9999999999); while (String(r).length < 10) { r = '0' + r; } return r; } ());
	htmlEl.style.display = 'none';
	htmlEl.className = 'TooltipRight';
	document.body.appendChild(htmlEl);


	// config container id as tooltip option
	opts.tip = '#' + htmlEl.id;

	for (var i in tooltips) {
		var hover = (function(tip) {
			return function() {
				htmlEl.innerHTML = tip.text;
			};
		} (tooltips[i]));

		$("#" + tooltips[i].id).mouseenter(hover).tooltip(opts).dynamic({ bottom: { direction: 'down', bounce: true} });
	}
}
/**
* @license 
* jQuery Tools 1.2.4 Tooltip - UI essentials
* 
* NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
* 
* http://flowplayer.org/tools/tooltip/
*
* Since: November 2008
* Date:    Sun Aug 15 08:16:31 2010 +0000 
*/
(function ($) {
	// static constructs
	$.tools = $.tools || { version: '1.2.4' };

	$.tools.tooltip = {

		conf: {

			// default effect variables
			effect: 'toggle',
			fadeOutSpeed: "fast",
			predelay: 0,
			delay: 30,
			opacity: 1,
			tip: 0,

			// 'top', 'bottom', 'right', 'left', 'center'
			position: ['top', 'center'],
			offset: [0, 0],
			relative: false,
			cancelDefault: true,

			// type to event mapping 
			events: {
				def: "mouseenter,mouseleave",
				input: "focus,blur",
				widget: "focus mouseenter,blur mouseleave",
				tooltip: "mouseenter,mouseleave"
			},

			// 1.2
			layout: '<div/>',
			titleTarget: '',
			tipClass: 'tooltip'
		},

		addEffect: function (name, loadFn, hideFn) {
			effects[name] = [loadFn, hideFn];
		}
	};


	var effects = {
		toggle: [
			function (done) {
				var conf = this.getConf(), tip = this.getTip(), o = conf.opacity;
				if (o < 1) { tip.css({ opacity: o }); }
				tip.show();
				done.call();
			},

			function (done) {
				this.getTip().hide();
				done.call();
			}
		],

		fade: [
			function (done) {
				var conf = this.getConf();
				this.getTip().fadeTo(conf.fadeInSpeed, conf.opacity, done);
			},
			function (done) {
				this.getTip().fadeOut(this.getConf().fadeOutSpeed, done);
			}
		]
	};


	/* calculate tip position relative to the trigger */
	function getPosition(trigger, tip, conf) {


		// get origin top/left position 
		var top = conf.relative ? trigger.position().top : trigger.offset().top,
			 left = conf.relative ? trigger.position().left : trigger.offset().left,
			 pos = conf.position[0];

		top -= tip.outerHeight() - conf.offset[0];
		left += trigger.outerWidth() + conf.offset[1];

		// adjust Y		
		var height = tip.outerHeight() + trigger.outerHeight();
		if (pos == 'center') { top += height / 2; }
		if (pos == 'bottom') { top += height; }


		// adjust X
		pos = conf.position[1];
		var width = tip.outerWidth() + trigger.outerWidth();
		if (pos == 'center') { left -= width / 2; }
		if (pos == 'left') { left -= width; }

		return { top: top, left: left };
	}



	function Tooltip(trigger, conf) {

		var self = this,
			 fire = trigger.add(self),
			 tip,
			 timer = 0,
			 pretimer = 0,
			 title = trigger.attr("title"),
			 tipAttr = trigger.attr("data-tooltip"),
			 effect = effects[conf.effect],
			 shown,

		// get show/hide configuration
			 isInput = trigger.is(":input"),
			 isWidget = isInput && trigger.is(":checkbox, :radio, select, :button, :submit"),
			 type = trigger.attr("type"),
			 evt = conf.events[type] || conf.events[isInput ? (isWidget ? 'widget' : 'input') : 'def'];


		// check that configuration is sane
		if (!effect) { throw "Nonexistent effect \"" + conf.effect + "\""; }

		evt = evt.split(/,\s*/);
		if (evt.length != 2) { throw "Tooltip: bad events configuration for " + type; }


		// trigger --> show  
		trigger.bind(evt[0], function (e) {

			clearTimeout(timer);
			if (conf.predelay) {
				pretimer = setTimeout(function () { self.show(e); }, conf.predelay);

			} else {
				self.show(e);
			}

			// trigger --> hide
		}).bind(evt[1], function (e) {
			clearTimeout(pretimer);
			if (conf.delay) {
				timer = setTimeout(function () { self.hide(e); }, conf.delay);

			} else {
				self.hide(e);
			}

		});


		// remove default title
		if (title && conf.cancelDefault) {
			trigger.removeAttr("title");
			trigger.data("title", title);
		}

		$.extend(self, {

			show: function (e) {
				// tip not initialized yet
				if (!tip) {

					// data-tooltip 
					if (tipAttr) {
						tip = $(tipAttr);

						// autogenerated tooltip
					} else if (title) {
						tip = $(conf.layout).addClass(conf.tipClass).appendTo(document.body)
							.hide();
						if(conf.titleTarget != ''){
							tip.find(conf.titleTarget).append(title);
						}
						else {
							tip.append(title);
						}
						// single tip element for all
					} else if (conf.tip) {
						tip = $(conf.tip).eq(0);

						// manual tooltip
					} else {
						tip = trigger.next();
						if (!tip.length) { tip = trigger.parent().next(); }
					}

					if (!tip.length) { throw "Cannot find tooltip for " + trigger; }
				}

				if (self.isShown()) { return self; }

				// stop previous animation
				tip.stop(true, true);

				// get position
				var pos = getPosition(trigger, tip, conf);


				// onBeforeShow
				e = e || $.Event();
				e.type = "onBeforeShow";
				fire.trigger(e, [pos]);
				if (e.isDefaultPrevented()) { return self; }


				// onBeforeShow may have altered the configuration
				pos = getPosition(trigger, tip, conf);

				// set position
				tip.css({ position: 'absolute', top: pos.top, left: pos.left });

				shown = true;

				// invoke effect 
				effect[0].call(self, function () {
					e.type = "onShow";
					shown = 'full';
					fire.trigger(e);
				});


				// tooltip events       
				var event = conf.events.tooltip.split(/,\s*/);

				tip.bind(event[0], function () {
					clearTimeout(timer);
					clearTimeout(pretimer);
				});

				if (event[1] && !trigger.is("input:not(:checkbox, :radio), textarea")) {
					tip.bind(event[1], function (e) {

						// being moved to the trigger element
						if (e.relatedTarget != trigger[0]) {
							trigger.trigger(evt[1].split(" ")[0]);
						}
					});
				}

				return self;
			},

			hide: function (e) {

				if (!tip || !self.isShown()) { return self; }

				// onBeforeHide
				e = e || $.Event();
				e.type = "onBeforeHide";
				fire.trigger(e);
				if (e.isDefaultPrevented()) { return; }

				shown = false;

				effects[conf.effect][1].call(self, function () {
					e.type = "onHide";
					fire.trigger(e);
				});

				return self;
			},

			isShown: function (fully) {
				return fully ? shown == 'full' : shown;
			},

			getConf: function () {
				return conf;
			},

			getTip: function () {
				return tip;
			},

			getTrigger: function () {
				return trigger;
			}

		});

		// callbacks	
		$.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","), function (i, name) {

			// configuration
			if ($.isFunction(conf[name])) {
				$(self).bind(name, conf[name]);
			}

			// API
			self[name] = function (fn) {
				$(self).bind(name, fn);
				return self;
			};
		});

	}


	// jQuery plugin implementation
	$.fn.tooltip = function (conf) {

		// return existing instance
		var api = this.data("tooltip");
		if (api) { return api; }

		conf = $.extend(true, {}, $.tools.tooltip.conf, conf);

		// position can also be given as string
		if (typeof conf.position == 'string') {
			conf.position = conf.position.split(/,?\s/);
		}

		// install tooltip for each entry in jQuery object
		this.each(function () {
			api = new Tooltip($(this), conf);
			$(this).data("tooltip", api);
		});

		return conf.api ? api : this;
	};

})(jQuery);

(function(d){var i=d.tools.tooltip;d.extend(i.conf,{direction:"up",bounce:false,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!d.browser.msie});var e={up:["-","top"],down:["+","top"],left:["-","left"],right:["+","left"]};i.addEffect("slide",function(g){var a=this.getConf(),f=this.getTip(),b=a.slideFade?{opacity:a.opacity}:{},c=e[a.direction]||e.up;b[c[1]]=c[0]+"="+a.slideOffset;a.slideFade&&f.css({opacity:0});f.show().animate(b,a.slideInSpeed,g)},function(g){var a=this.getConf(),f=a.slideOffset,
b=a.slideFade?{opacity:0}:{},c=e[a.direction]||e.up,h=""+c[0];if(a.bounce)h=h=="+"?"-":"+";b[c[1]]=h+"="+f;this.getTip().animate(b,a.slideOutSpeed,function(){d(this).hide();g.call()})})})(jQuery);

(function(g){function j(a){var c=g(window),d=c.width()+c.scrollLeft(),h=c.height()+c.scrollTop();return[a.offset().top<=c.scrollTop(),d<=a.offset().left+a.width(),h<=a.offset().top+a.height(),c.scrollLeft()>=a.offset().left]}function k(a){for(var c=a.length;c--;)if(a[c])return false;return true}var i=g.tools.tooltip;i.dynamic={conf:{classNames:"top right bottom left"}};g.fn.dynamic=function(a){if(typeof a=="number")a={speed:a};a=g.extend({},i.dynamic.conf,a);var c=a.classNames.split(/\s/),d;this.each(function(){var h=
g(this).tooltip().onBeforeShow(function(e,f){e=this.getTip();var b=this.getConf();d||(d=[b.position[0],b.position[1],b.offset[0],b.offset[1],g.extend({},b)]);g.extend(b,d[4]);b.position=[d[0],d[1]];b.offset=[d[2],d[3]];e.css({visibility:"hidden",position:"absolute",top:f.top,left:f.left}).show();f=j(e);if(!k(f)){if(f[2]){g.extend(b,a.top);b.position[0]="top";e.addClass(c[0])}if(f[3]){g.extend(b,a.right);b.position[1]="right";e.addClass(c[1])}if(f[0]){g.extend(b,a.bottom);b.position[0]="bottom";e.addClass(c[2])}if(f[1]){g.extend(b,
a.left);b.position[1]="left";e.addClass(c[3])}if(f[0]||f[2])b.offset[0]*=-1;if(f[1]||f[3])b.offset[1]*=-1}e.css({visibility:"visible"}).hide()});h.onBeforeShow(function(){var e=this.getConf();this.getTip();setTimeout(function(){e.position=[d[0],d[1]];e.offset=[d[2],d[3]]},0)});h.onHide(function(){var e=this.getTip();e.removeClass(a.classNames)});ret=h});return a.api?ret:this}})(jQuery);
