
var mouseX = 0;
var mouseY = 0;

function getcords(e)
{
	mouseX = Event.pointerX(e);
	mouseY = Event.pointerY(e);
}

Event.observe(document, 'mousemove', getcords);

bd_show_delay = null;

function imagehover(img,x,y,styleclass)
{
    var ytxt;
    var xtxt;
    var styleclasstxt;
    
    if (y != 0)
    {
        ytxt = " height=\"" + y + "\"";
    }
    
    if (x != 0)
    {
        xtxt = " width=\"" + x + "\"";
    }   

    if (typeof styleclass == 'undefined')
    {
        styleclass = 'h1b';
    }
    
    if (styleclass != '')
    {
        styleclasstxt = " class=\"" + styleclass + "\"";
    } 

    var str = "\<img " + styleclasstxt + " src=\"" + img + "\"" + xtxt + ytxt + " /\>";
    
    hover(str);
};

function hover(str)
{   
    if (!$('tooltipdiv')) { return; }
    
    if ($('tooltipdiv').innerHTML != str)
    {
       $('tooltipdiv').innerHTML  = str;
	   $('tooltipdiv').style.left = (mouseX - 15) + "px";
	   $('tooltipdiv').style.top  = (mouseY + 15) + "px";
	   $('tooltipdiv').style.position = 'absolute';

	   $('tooltipdiv').setOpacity(0);
	}

	op = $('tooltipdiv').getOpacity();
	bd_show_delay = setTimeout('new Effect.Appear("tooltipdiv", { from: '+op+', to: 1.0, duration: 0.15 });', 200);
};

function hide_div()
{
    if (!$('tooltipdiv')) { return; }
    
    clearTimeout(bd_show_delay);
    op = $('tooltipdiv').getOpacity();
	new Effect.Fade('tooltipdiv', { from: op, to: 0.0, duration: 0.1 });
}

function settooltipdiv()
{
    var my_div = document.createElement('div');
    my_div.setAttribute('id', 'tooltipdiv');
    document.body.appendChild(my_div);
}

Event.observe(window, 'load', settooltipdiv);

