function showInfoBox(text, boxX, boxY) {
	var box = document.getElementById('infoBox');
	var doc = document.frames.infoBox.document;

	doc.open();
        doc.write('<html><head></head><body style="border: none; margin: 0; border: solid 1px blue; padding: 5px; background: white; overflow: visible"><table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%"><tr><td valign=top>' + text + '</td></tr></table></body></html>');
	doc.close();

	box.style.width  = boxX;
	box.style.height = boxY;

        boxPosX = event.x+document.body.scrollLeft + 15;
        boxPosY = event.y+document.body.scrollTop + 16;

        if (window.innerWidth)
          { theWidth = window.innerWidth}
        else if (document.documentElement && document.documentElement.clientWidth)
          { theWidth = document.documentElement.clientWidth}
        else if (document.body)
          { theWidth = document.body.clientWidth }

        if (window.innerHeight)
          { theHeight = window.innerHeight}
        else if (document.documentElement && document.documentElement.clientHeight)
          { theHeight = document.documentElement.clientHeight}
        else if (document.body)
          { theHeight = document.body.clientHeight }

	if ((boxPosY+boxY) > theHeight ) { boxPosY = theHeight - (boxY+40); }
	//if ((boxPosX+boxX) > theWidth ) { boxPosX = theWidth - (boxX+40); }

	box.style.left = boxPosX;
	box.style.top = boxPosY;

	box.style.visibility = 'visible';
	box.style.display = 'block';

}

function hideInfoBox() {
	var box = document.getElementById('infoBox');
	
	box.style.visibility = 'hidden';
	box.style.display = 'none';
}	

//call this function to insert an info icon in a code. 
//this icon is images/infoicon1,gif image that will show a popup with style defined in showInfoBox funtion and text coming as fuction argument.
function infoIcon(text, boxX, boxY) {
	if(text != undefined && text != '') {
		document.write("<img src=\"images/infoicon1.gif\" width=\"14\" height=\"14\" border=\"0\" onMouseOver=\"showInfoBox('" + text + "'," + boxX + "," + boxY + ")\" onMouseOut=\"hideInfoBox()\">");
	}
}

function infoIFrame() {
	document.write("<iframe id=\"infoBox\" src=\"images/spacer.gif\" style=\"DISPLAY: none; Z-INDEX: 1000; VISIBILITY: hidden; OVERFLOW: visible; POSITION: absolute;\"></iframe>");
}
<!-- 
 --------------------- 
 -->  