﻿// JScript File


function showMenu(e,obj,num)
{
    obj.parentNode.href=eval("toolTip_url"+num);
    

    var toolTipId;
    var toolTipObj;
     
    for(var i=0;i<=5;i++)
    {
        toolTipId="toolTip"+i;
        toolTipObj=document.getElementById?document.getElementById(toolTipId):document.all[toolTipId];
        
        if(toolTipObj)
        {
            removeToolTip(i);
        }
    }
    
    //Find Position Start
        var x;
        var y;
	    x = y = 0;
	    if (obj.offsetParent) 
	    {
		    x = obj.offsetLeft;
		    y = obj.offsetTop;
    		
		    while (obj = obj.offsetParent) 
		    {
			    x += obj.offsetLeft;
			    y += obj.offsetTop;
		    }
	    }
	    //y=y+12;
    //Find Position End
    
      
    createTooplTip(num,x,y);
    
    //Show Tool Tip
    var ttId="toolTip"+num;
    var ttObj=document.getElementById?document.getElementById(ttId):document.all[ttId];
    
    ttObj.style.visibility="visible";
    
    var timer=0;

    for(var i=0;i<=100;i=i+2)
    {
        setTimeout("showHide(" + i + ","+num+");",(timer*10));
        timer++;
    }
    
}

function showHide(opcty,num)
{
    var ttId="toolTip"+num;
    var ttObj=document.getElementById?document.getElementById(ttId):document.all[ttId];
    
    if(ttObj)
    {
        ttObj.style.opacity=(opcty/100);
        ttObj.style.filter="alpha(opacity=" + opcty + ")";
    }
}

function hideMenu(e,obj,num)
{   
   mouseOut(e,obj,num);
}


function createTooplTip(num,x,y)
{
   
    var div=document.createElement("div");
    div.setAttribute("id","toolTip"+num);
    div.style.cssText="position:absolute;left:"+x+"px;top:"+y+"px;width:116px;height:176px;z-index:1;filter:alpha(opacity=0);opacity: 0.0;visivility:hidden;";
    
    if (div.getAttributeNode("class")) //Using Only To Detect Browser
	{
	//For IE
	    div["onmouseout"]=new Function('mouseOut(event,this,'+num+');'); //Working in IE
	}
	else
	{
	//For Mozilla
	    div.setAttribute("onmouseout","mouseOut(event,this,"+num+");"); // Working in Mozilla
	}

     
    var table=document.createElement("table");
	table.setAttribute("cellspacing","0");
	table.setAttribute("cellpadding","0");
	table.setAttribute("border","0");
	table.setAttribute("width","116px");
	table.style.cssText="cursor:pointer;height:172px;border-collapse:collapse;";
	table["onclick"]=new Function('loadPage('+num+');');
		
		
	var tbody=document.createElement("tbody");
	
	table.appendChild(tbody);
	 
	
	var tr1=document.createElement("tr");	
	var td1=document.createElement("td");
	td1.setAttribute("align","center");
	td1.setAttribute("valign","middle");
	 
	td1.style.cssText="width:116px;height:13px;";
	
	if (td1.getAttributeNode("class")) 
	{
	   td1.attributes['class'].value=eval("toolTip_titleClass"+num);
	}
	else
	{
	    td1.setAttribute("class",eval("toolTip_titleClass"+num));
	}
	
	var txt1=document.createTextNode(eval("toolTip_title"+num));
	
	td1.appendChild(txt1);
	tr1.appendChild(td1);
	tbody.appendChild(tr1);
   
    var tr2=document.createElement("tr");
	var td2=document.createElement("td");
	td2.setAttribute("align","center");
	td2.setAttribute("valign","middle");
	td2.style.cssText="width:116px;height:155px;background-color:#e7e6dc;background-image:url("+eval("toolTip_bgImageUrl"+num)+");background-repeat:no-repeat;";
	
	if (td2.getAttributeNode("class")) 
	{
	   td2.attributes['class'].value=eval("toolTip_textClass"+num);
	}
	else
	{
	    td2.setAttribute("class",eval("toolTip_textClass"+num));
	}	
	
	var txt2=document.createTextNode(eval("toolTip_text"+num));
	
	td2.appendChild(txt2);
	tr2.appendChild(td2);
	tbody.appendChild(tr2);
	
	
    
    var tr3=document.createElement("tr");
	var td3=document.createElement("td");
	td3.style.cssText="width:116px;height:4px;";
	
	if (td3.getAttributeNode("class")) 
	{
	    td3.attributes['class'].value=eval("toolTip_bottomClass"+num);
	}
	else
	{
	    td3.setAttribute("class",eval("toolTip_bottomClass"+num));
	}	
		
	
	tr3.appendChild(td3);
	tbody.appendChild(tr3);
        
    div.appendChild(table);
   
    document.body.appendChild(div);
    //alert(div.innerHTML);
}


function loadPage(num)
{
    document.location.href=eval("toolTip_url"+num);
}


function mouseOut(e,obj,num)
{
    var menuId="menu"+num;
    var toolTipId="toolTip"+num;
    
    if(obj.id==menuId)
    {
        var id="toolTip"+num;
        var toolTipObj=document.getElementById?document.getElementById(id):document.all[id];
        
        var xLeft=toolTipObj.style.left.substring(0,toolTipObj.style.left.indexOf("px"));
        var yTop=toolTipObj.style.top.substring(0,toolTipObj.style.top.indexOf("px"));
        
        var width=toolTipObj.style.width.substring(0,toolTipObj.style.width.indexOf("px"));;
        var height=toolTipObj.style.height.substring(0,toolTipObj.style.height.indexOf("px"));;
        
        var xRight=eval(xLeft)+eval(width);
        var yBottom=eval(yTop)+eval(height);
        
        //alert(mousePositionX(e)+" "+mousePositionY(e));
        var removeFlag=true;
        
        if((eval(xLeft)<=mousePositionX(e)) && (mousePositionX(e)<=eval(xRight)))
        {
            if((eval(yTop)<=mousePositionY(e)) && (mousePositionY(e)<=eval(yBottom)))
            {
                removeFlag=false
            }
        }
        
        if(removeFlag==true)
        {
           removeToolTip(num); 
        }
        
    }
    else
    {
        if(obj.id==toolTipId)
        {
            var id="toolTip"+num;
            var toolTipObj=document.getElementById?document.getElementById(id):document.all[id];
            
            var xLeft=toolTipObj.style.left.substring(0,toolTipObj.style.left.indexOf("px"));
            var yTop=toolTipObj.style.top.substring(0,toolTipObj.style.top.indexOf("px"));
            
            var width=toolTipObj.style.width.substring(0,toolTipObj.style.width.indexOf("px"));;
            var height=toolTipObj.style.height.substring(0,toolTipObj.style.height.indexOf("px"));;
            
            var xRight=eval(xLeft)+eval(width);
            var yBottom=eval(yTop)+eval(height);
            
            
            var removeFlag=true;
            
            if((eval(xLeft)<=(mousePositionX(e)-2)) && ((mousePositionX(e)+2)<=eval(xRight)))
            {
                if((eval(yTop)<=mousePositionY(e)) && ((mousePositionY(e)+2)<=eval(yBottom)))
                {
                    removeFlag=false
                }
            }
            
            if(removeFlag==true)
            {
               removeToolTip(num); 
            }
        }
    }
}



function removeToolTip(num)
{
        var id="toolTip"+num;
        var toolTipObj=document.getElementById?document.getElementById(id):document.all[id];
        document.body.removeChild(toolTipObj);
}

function mousePositionX(e)
{
	var xMouse;
	
	if(e.pageX)
	{
		xMouse=e.pageX;
	}
	else if(e.clientX)
	{
		xMouse=e.clientX+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft);
	}
	
	return xMouse;
}

function mousePositionY(e)
{
    var yMouse;

	if(e.pageY)
	{
		yMouse=e.pageY;
	}
	else if(e.clientY)
	{
		yMouse=e.clientY+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop);
	}
	
	return yMouse;
}
