/************************************************************************************************************
************************************************************************************************************/	


function showToolTip(e,text){

// get screen/window width/height for  quad calc
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
//  window.alert( 'Width = ' + myWidth + '  Height = ' + myHeight );


//get math for box
	if(document.all)e = event;
	
	var obj = document.getElementById('bubble_tooltip');
	var obj2 = document.getElementById('bubble_tooltip_content');
	obj2.innerHTML = text;
	obj.style.display = 'block';
  var boxheight=document.getElementById('bubble_tooltip_content').offsetHeight

        var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
	if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0; 

//old code	obj.style.left = leftPos + 'px';
//       topPos=topPos - obj.offsetHeight -1 + st;	
//alert('lp '+leftPos+'  tp '+topPos+'  clienty '+e.clientY+'  offsety '+obj.offsetHeight + ' st '+st   ); 

var leftPos = e.clientX+1;  //cursor pos x  (+1 so it's not 0)
var topPos= e.clientY+1;   //cursor pos y  (+1 so it's not 0)
// myWidth myHeight       //Current window size




//calc users location on a percentage grid  50%,50%= center of page
myWidth=myWidth+1;
myHeight=myHeight+1;
var locationx=(leftPos*100) / myWidth;
var locationy= (topPos*100) / myHeight;

var myquad=0 //  we number the box we are in  1,2   3,4   top L&R, bot L&R
if (locationx < 50) { //we are on the left side
if (locationy < 50) {//we are in the top left
myquad=1;
} else { //we are in the bot left
myquad=3;
}} else {//we are on the right side of the screen
if (locationy < 50) {//we are in the top right
myquad=2;
} else { //we are in the bot right
myquad=4;
}

}//end if   side of screen

//alert('bx'+boxheight);

topPos=topPos - 150;

boxheight=boxheight+275;

//alert('bx'+boxheight+'  quad'+myquad+'  x'+leftPos+' y'+topPos);


if (myquad==1) {leftPos=leftPos+10; topPos=topPos+10;}
if (myquad==2) {leftPos=leftPos-450; topPos=topPos+10;}

if (myquad==3) {leftPos=leftPos+10; topPos=topPos - boxheight;}
if (myquad==4) {leftPos=leftPos-450; topPos=topPos - boxheight;}


// ISSUE WITH POWERHB, add to offset

//#st=0;
//#leftPos=400;
//#topPos=0;


if(topPos<0) {topPos = 0;}
if(leftPos<0) {leftPos = 0;}
//obj.style.left = leftPos;
//obj.style.top = topPos + st;
//alert('x'+leftPos+' y'+topPos+' quad'+myquad+'  lx'+locationx+' ly'+locationy+ ' w'+myWidth+' h'+myHeight);


}//end function show tooltip	


function hideToolTip()
{
	document.getElementById('bubble_tooltip').style.display = 'none';
	
}

