﻿$(document).ready(function(){
	CreateToolTip();
});

function CreateToolTip()
{
	$(".Friend a").mousemove(ShowTip);
	//$(".Friend a").bind("mouseover", ShowTip);
	$(".Friend a").mouseout(function() { HideTip();});
}

function ShowTip(e)
{
	var IE = document.all?true:false;
    if (IE) {
        pos_x = event.clientX + document.documentElement.scrollLeft;
        pos_y = event.clientY + document.documentElement.scrollTop;
       // debugger;
        //alert(document.body.scrollTop);
    } else {
        pos_x = e.pageX;
        pos_y = e.pageY;
    }
	//var pos_x = findPosX(this)+75;
	//var pos_y = findPosY(this)+50;
	
	//$(event.currentTarget).attr("title");
	
	if ($(".tooltip").length != 0)
	{
		$(".tooltip").css({position:'absolute',zIndex:"3000",left: pos_x+10+'px',top:pos_y+10+'px'});
	}
	else
	{
		var tt = $("<div class=\"tooltip\">"+$(this).attr("tooltip").replace(" - ","<br/>")+"</div>")
			.hide()
			.css({position:'absolute',zIndex:"3000",left: pos_x+10+'px',top:pos_y+10+'px',background: '#000',color: '#fff', border: '1px solid #fff'})
			.appendTo('body')
			.fadeIn("slow");
			//.show();
	}
}	

function HideTip()
{
	$(".tooltip").remove();
}

function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }


