//ceetip
/*
 * CeeTip 1.0 jQuery Plugin
 * Requires jQuery 1.3.2
 * Code hosted on GitHub (http://github.com/catcubed/ceetip) Please visit there for version history information
 * By Colin Fahrion (http://www.catcubed.com)
 * based on vtip by vertigo project http://www.vertigo-project.com/projects/vtip 
  * Modified into a jQuery plugin and modified to work with CeeBox (http://github.com/catcubed/ceetip)
 * Copyright (c) 2009 Colin Fahrion
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/

(function($) {
	$.fn.ceetip = function(opts) {
		$.fn.ceetip.defaultSettings = {xOffset:-12,yOffset:30,border:'1px solid #a6c9e2',arrow:"/images/ceetip_arrow.png"} //default drops in right under the windows 
		var opts = $.extend({}, $.fn.ceetip.defaultSettings, opts);

		return this.each(function() {
			$this = $(this);
			
			$this.unbind("hover").hover(    
				function(e) {
					this.t = this.title;
					this.title = ''; 
					var top = (e.pageY + opts.yOffset), left = (e.pageX + opts.xOffset);
					
					$('body').append( '<p id="ceetip"><img id="ceetipArrow" />' + this.t + '</p>' );
								
					$('p#ceetip #ceetipArrow')
					.attr("src", opts.arrow)
					.css({
						position: 'absolute',
						top: '-10px',
						left: '5px'
					});
					$('p#ceetip')
					.css({
						top:top+'px',
						left:left+'px',
						display: 'none',
						position: 'absolute',
						padding: '10px', 
						fontSize: '0.8em',
						font: '12px Arial, Helvetica, sans-serif',
						backgroundColor: '#fff',
						border: opts.border,
						"-moz-border-radius": '5px',
						"-webkit-border-radius": '5px',
						zIndex: 9999
					})
					.fadeIn("slow");
					
				},
				function() {
					this.title = this.t;
					$("p#ceetip").fadeOut("slow").remove();
				}
			).mousemove(
				function(e) {
					var top = (e.pageY + opts.yOffset),left = (e.pageX + opts.xOffset);
								 
					$("p#ceetip").css({top:top+"px",left:left+"px"});
				}
			);  
		})
	}

	
})(jQuery);