function showMenuTop(elem, popup) {	setDisplayPosition(document.getElementById(elem), popup, 0, 0);	document.getElementById(popup).style.display = 'block';} function hideMenuTop(elem) {	document.getElementById(elem).style.display = 'none';} // =======================================================================================// Function to determine Display Position of the Pop Up at the Required Element // =======================================================================================function setDisplayPosition(elem, popup, selectedPosX, selectedPosY) {	var target = elem;    var scroll = 0;        if(!target)    	return;	// Get width and height of element	var targetHeight = target.offsetHeight;    var targetWidth = target.offsetWidth; // not used	// Go through DOM tree and obtain relative positions	// of all elements wrt their parent elements	while(target != null)	{	   	selectedPosX += target.offsetLeft;		selectedPosY += target.offsetTop;		// Get Scroll Offset of Any Elements that are not the Main Window				if ( target.offsetTop > 0 ) {		    scroll += target.scrollTop;		} 		target = target.offsetParent;	}	//scroll = scroll - document.scrollTop;	// Get the annotation span, set its position and display	display = document.getElementById(popup);	display.style.left = selectedPosX + "px";	display.style.top = selectedPosY - scroll + targetHeight - 5 + "px";	display.style.display = "block";}function setDisplayPosition2(elem, popup, posX, posY) {	var target = elem;	var scroll = 0;		if(!target)		return;	// Get width and height of element	var targetHeight = target.offsetHeight;	var targetWidth = target.offsetWidth; // not used	// Go through DOM tree and obtain relative positions	// of all elements wrt their parent elements	while(target != null)	{		posX += target.offsetLeft;		posY += target.offsetTop;		// Get Scroll Offset of Any Elements that are not the Main Window				if ( target.offsetTop > 0 ) {			scroll += target.scrollTop;		} 		target = target.offsetParent;	}	// Calculate Default popup position 	posX = posX;	// Adjust Y position for scroll offset	posY = posY - scroll + targetHeight - 5;	// Save position of target element	targetX = posX;	targetY = posY;		// Determine the Document Scroll Offest Co-ordinates DSOC	var iebody = (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body;	var dsocleft = document.all ? iebody.scrollLeft : pageXOffset;	var dsoctop = document.all ? iebody.scrollTop : pageYOffset;		// Determine Window Size						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;	}				// display popup off screen so can get its current dimensions	display = document.getElementById(popup);	display.style.left = "-1000px";	display.style.top  = "-1000px";	display.style.display = "block";	// Get popup table dimensions	popup_height = document.getElementById(popup + '_table').offsetParent.offsetHeight + 20;	popup_width  = document.getElementById(popup + '_table').offsetParent.offsetWidth + 20;	popup_offset = 0;	display.style.display = "none";	mode = '';	// Dont Let Pop Up Disappear off to the side	if ( posX - dsocleft + popup_width > myWidth ) {		posX = myWidth - popup_width + dsocleft;		mode = mode + "Align Right";	}		if ( posX < dsocleft ) {		posX = dsocleft;		mode = mode + "<br />Add Left ofset";	}	// If popup off screen to the bottom then bring it up	if ( posY - dsoctop + popup_height > myHeight ) {		posY = myHeight - popup_height + dsoctop;		if ( posY < dsoctop ) {			posY = dsoctop;			}		mode = mode + "<br />Align Bottom";	}		// Display the pop up	display.style.left = posX + "px";	display.style.top  = posY + "px";	display.style.display = "block";		} 		
