/*
 * course.js - for www.jec.ac.jp
 * @requires jQuery v1.2.3
 * @requires general.js
 *
 * Copyright (c) 2008 cyclops.co.,ltd.
 * $Date: 2008.4.10
 *
 */

/**
 *	tooltip
 * @requires jquery.dimensions.js
 */
$.cyc.tooltips = {
	init:function(){
		var self = this;
		$('#qa-summary li a[title]').each(function(){
			var str = this.title.split('-');
			this.helper = $('<div id="tooltip"><h5>' + str[0] + '</h5><p>' + str[1] +'</p></div>');
			$(this).removeAttr("title");
		}).hover(
			function(){
				this.helper.stop().hide().appendTo(document.body);
				var h = this.helper.outerHeight({padding:true});
				var pos = $(this).parent().offset();
				this.helper.css({ 
						top: ( pos.top - h + 2 ) + "px", 
						left: ( pos.left + 5) + "px" 
				}).fadeTo(1, 1).show();
			},
			function(){
				this.helper.fadeOut(300,function(){$(this).remove();});
			}
		);
	}
};