/* vim: set tabstop=2 shiftwidth=2 foldmethod=marker: */
/**
 * 
 * Lazurite管理画面 ツールチップ処理スクリプト
 *
 * @author     Shogo Kawase <shogo@arcstyle.jp>
 * @copyright  Arc Style Inc.
 * @version    CVS: $Id: toolTip.js 8790 2009-01-22 05:05:51Z yuk $
 *
 */
vw.toolTips = {
	active: false,
	
	init: function()
	{
		return this;
	},
	start: function()
	{
		$('.tooltipTarget')
			.bind('mousemove', function(e){ vw.toolTips.update(e); })
			.bind('mouseover', function(e){ vw.toolTips.activate(e); })
			.bind('mouseout',  function(e){ vw.toolTips.deactivate(e); })
		;
	},
	activate: function(event)
	{
		vwt.active = $('#' + event.target.id + '_tip');
		vwt.active.css({zIndex: 4321, display: 'block'});
		vwt.update(event);
	},
	deactivate: function(event)
	{
		if (vwt) {
			vwt.active.hide();
			vwt.active = false;
		}
	},
	update: function(event)
	{
		if (vwt.active) {
			var scr = vw.window.scrollOffset();
			var css = {
				left: (event.clientX + scr.x - 100) + 'px',
				top:  (event.clientY + scr.y - vwt.active.height() - 10) + 'px'
			}
			vwt.active.css(css);
		}
	}
};
var vwt = vw.toolTips.init();
