/** 
 * @fileoverview 
 * overview
 *
 * @author $Author: kuehnel $
 * @version $Rev: 6678 $ 
 * @date $Date: 2011-09-01 16:23:07 +0200 (Thu, 01 Sep 2011) $
 *
 */
 
 // jQuery wrapper 
(function ($) {

	// DOM ready
	$(function () {
		
		// Initialize toolTips on DOM ready
		toolTips.initToolTips();
		
	});
	
	
	
}(jQuery));


var toolTips = {
	/**
	 * @name options
	 * @fieldOf messageBox
	 * @type object
	 * @default { maxWidth: '222px', position: 'top center', edgeOffset: 0 }
	 *
	 * @description
	 * Configuration of the jQuery plugin TipTip
	 * See http://code.drewwilson.com/entry/tiptip-jquery-plugin for details
	 */
	options: {
		maxWidth	: '222px',
		position	: 'top center',
		edgeOffset	: 0
	},
	/**
	 * @name initToolTips
	 * @methodOf toolTips
	 *
	 * @description
	 * Rendering the icons into headlines and move the tooltip markup to the icon.
	 * Call method firePlugin()
	 */
	initToolTips: function() {
		var $header = jQuery('.header.toolTip.icon').each(function (index) {
			var $this = jQuery(this),
				title = $this.attr('title'),
				$icon = jQuery('<span />', {
					className: 'toolTipIcon toolTip',
					title: title
				});
			$this.append($icon).removeClass('toolTip').removeAttr('title');
		});
		toolTips.firePlugin();
	},
	/**
	 * @name firePlugin
	 * @methodOf toolTips
	 *
	 * @description
	 * Fire plugin tipTip.
	 * Remove class 'toolTip' to prevent issues when Re-Initializing the plugin in AJAX callback functions.   
	 */
	firePlugin: function() {
		jQuery('.toolTip').tipTip({
			maxWidth	: toolTips.options.maxWidth,
			position	: toolTips.options.position,
			edgeOffset	: toolTips.options.edgeOffset
		}).removeClass('toolTip');
	}
};
