﻿var oPopup = window.createPopup();

function showMenu(menu, width, height,moveright,movedown,txt)
{
   
var lefter = event.clientX;
var leftoff = event.offsetX
var topper = event.clientY;
var topoff = event.offsetY;
	
var oPopBody = oPopup.document.body;
moveMe = 0;
lefter= lefter + moveright;
topper= topper + movedown;

if (menu!=null)
	var HTMLContent = menu.innerHTML;
else
	var HTMLContent = txt;
oPopBody.innerHTML = HTMLContent;
oPopup.show(lefter -width- leftoff - 2 - moveMe, topper - topoff + 22, width, height, document.body);
return false;

}
function showMenu2(menu, width, height,moveright,movedown,txt)
{
   
var lefter = event.clientX;
var leftoff = event.offsetX
var topper = event.clientY;
var topoff = event.offsetY;
	
var oPopBody = oPopup.document.body;
moveMe = 0;
lefter= lefter + moveright;
topper= topper + movedown;

if (menu!=null)
	var HTMLContent = menu.innerHTML;
else
	var HTMLContent = txt;
oPopBody.innerHTML = HTMLContent;
oPopup.show(lefter -width- leftoff - 2 - moveMe, topper - topoff + 22, width, height, document.body);
return false;

}




	function contextHilite(menu){
	    menu.runtimeStyle.backgroundColor = "Highlight";
	    if (menu.state){
	        menu.runtimeStyle.color = "GrayText";
	    } else {
	        menu.runtimeStyle.color = "HighlightText";
	    }
	}

	function contextDelite(menu){
	    menu.runtimeStyle.backgroundColor = "";
	    menu.runtimeStyle.color = "";
	}
	function showToolTip()
	{

		var Msg=new String;
		var l;
		var F;
		F="<?xml version='1.0' ?>";
		F+="<OBJECT id=mathplayer classid=clsid:32F66A20-7614-11D4-BD11-00104BD3F987>";
		F+="	<!--comment required to prevent this becoming an empty tag--></OBJECT>";
		F+='<?IMPORT NAMESPACE="m" IMPLEMENTATION="#mathplayer" ?>' ;
		
		var el = event.srcElement;
		var W,H;
		if (el.L==2)
		{
			W=500;
			H=250;	
		}
		else if (el.L==12)
		{
			W=500;
			H=200;	
		}
		else
		{
			W=500;
			H=100;
		}
		var beginConst='<span  style=" FONT-SIZE: 10pt; FONT-FAMILY: tahoma; border-right: #a1bbe4 1px solid;	border-top: #a1bbe4 1px solid;		border-left: #a1bbe4 1px solid;	border-bottom: #a1bbe4 1px solid;OVERFLOW: auto;width:'+ W +'px;height:'+ H +' px; CLIP: rect(3px 2px 3px 2px); DIRECTION: rtl; BACKGROUND-COLOR: white; TEXT-ALIGN: right" >';
		if (el.L!=12)
		    beginConst+=F;
		var EndConst="</span>";
		Msg=el.TIP;
		
		Msg=beginConst+Msg+EndConst;
		
		
		showMenu2(null, W,H,410,2,Msg)
		
		
	}
	function HideToolTip()
	{
		oPopup.hide();
	}
