
// Original:  Nannette Thacker (nannette@shiningstar.net) -->
// Web Site:  http://www.shiningstar.net -->

// This script and many more are available free online at -->
// The JavaScript Source!! http://javascript.internet.com -->

var popuptext = null;

function displayPopup(evnt) {
    var height = 30;
    var width = 300;
    var properties = "scrollbars=yes,resizable=yes,status=no,toolbar=no,location=no,height="+ height + ",width="+ width;
    var leftprop, topprop, cursorX, cursorY, screenX, screenY, padAmt;
	var popupHandle;

	if (evnt == null) {
		var evnt = window.event;
	}

    cursorX = evnt.screenX;
    cursorY = evnt.screenY;

    if(navigator.appName == "Microsoft Internet Explorer") {
        screenY = document.body.offsetHeight;
        screenX = window.screen.availWidth;
    }
    else {
        screenY = window.outerHeight
        screenX = window.outerWidth
    }

    padAmtX = 10;
    padAmtY = 10;
    if((cursorY + height + padAmtY) > screenY) {
    // make sizes a negative number to move left/up
        padAmtY = (-30) + (height * -1);
    // if up or to left, make 30 as padding amount
    }

    if((cursorX + width + padAmtX) > screenX)   {
        padAmtX = (-30) + (width * -1);
        // if up or to left, make 30 as padding amount
    }

    if (navigator.appName == "Microsoft Internet Explorer") {
        leftprop = cursorX + padAmtX;
        topprop = cursorY + padAmtY;
    }
    else {
        leftprop = (cursorX - pageXOffset + padAmtX);
        topprop = (cursorY - pageYOffset + padAmtY);
    }

	properties = properties + ",left=" + leftprop;
    properties = properties + ",top=" + topprop;


	if (popupHandle != null) popupHandle.close();
	popupHandle = open('about:blank', null, properties);
	popupHandle.document.write("<html><head><title>Popup</title></head><body bgcolor='#F2F2F2'>");
  popupHandle.document.write("<div style='margin: 6px; padding: 0px; font-family: Verdana; font-size: 9pt;'>");
	popupHandle.document.write(popuptext);
	popupHandle.document.write("</div></body></html>");
	popupHandle.document.close();
	// workaround für mozilla problem-> scrollbars erscheinen nicht...
	popupHandle.resizeBy(0, 50);
}