﻿// JScript File

//===========================Get Windows ScrollBar Position==================
function js_scrollTop() {
	return js_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}

function js_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
//===========================Get Windows ScrollBar Position End==================

function js_ShowTooltip(e,Message)
{    
    var x;var y;
    //var e = event;
   //alert(e)
     if(e)
    {
        e = e;
    }
    else
    {
        e = window.event;
    }
    
    if(e.pageX)
    {
        x = e.pageX;
    }
    else
    {
        x = e.clientX;
    }
    
    if(e.pageY)
    {
        y = e.pageY;
    }
    else
    {
        y = e.clientY;
    }
        
    var max_x = window.screen.width;
    
    var max_y = window.screen.height-100;
    
    //======================get Popup height/width================================================  
    var divwidth = 200;//document.getElementById(getId("divEventList","div","notype")).style.width + 10;//250;
    var divHeight = 200;//document.getElementById(getId("divEventContent","div","notype")).style.height + 25;//200;
    var xPadding = -40;
    var yPadding = 0;
    var ttimage = "bubble.gif";
    //alert(divwidth)
    //alert(divHeight)
    
    if(x+divwidth+xPadding >= max_x-10)
    {
        x=x-divwidth-xPadding;
        ttimage = "right-bubble.gif";
        //document.getElementById("divTtTop").style.background= "url(../images/" + ttimage +") no-repeat top"; 
        //alert("right-bubble.gif");
    }
    else
    {
        x = x + xPadding;
        ttimage = "bubble.gif";
    }
    
    var scrolheight = js_scrollTop();//document.documentElement.scrollTop;
    
    if(y+divHeight >= max_y-30)
    {
        y=y-divHeight+yPadding + scrolheight;        
    }
    else
    {
        y = y - yPadding + scrolheight;
    }
   
    var xtemp = x + "px";
    var ytemp = y + "px";
    
    //alert(xtemp)
    document.getElementById("divTooltip").style.display='block';
    document.getElementById("divTooltip").style.left=xtemp;
    document.getElementById("divTooltip").style.top=ytemp;  
    
    document.getElementById("divTtContent").innerHTML=Message;
    
    var path = location.pathname;
    //alert(path)
    var arrPath = path.split('/');
    var vpath = "";
    //alert(arrPath.length);
    for(i=1;i<arrPath.length-2;i++)
    {
        vpath+="../";
    }   
         
    //alert(vpath);
    
    document.getElementById("divTtTop").style.background= "url(" + vpath + "images/" + ttimage +") no-repeat top";  
    document.getElementById("divTtBottom").style.background= "url(" + vpath + "images/" + ttimage +") no-repeat bottom";
       
    //alert(document.getElementById("divTooltip").className);
   
}

function js_HideTooltip()
{
    document.getElementById("divTooltip").style.display='none';    
}

document.write(''
+ '<div class="tooltip" id="divTooltip" style=" display:none;">'
+ '       <div class="tt-top" id="divTtTop"></div>'
+ '       <div class="tt-middle" id="divTtContent"></div>'
+ '       <div class="tt-bottom" id="divTtBottom"></div>'
+ '</div>');
