/*
DESCRIPTION: These functions find the position of an tag in a document,
so other elements can be positioned relative to it.
COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small
positioning errors - usually with Window positioning - occur on the
Macintosh platform.
FUNCTIONS:
getAnchorPosition(anchorname)
Returns an Object() having .x and .y properties of the pixel coordinates
of the upper-left corner of the anchor. Position is relative to the PAGE.
getAnchorWindowPosition(anchorname)
Returns an Object() having .x and .y properties of the pixel coordinates
of the upper-left corner of the anchor, relative to the WHOLE SCREEN.
NOTES:
1) For popping up separate browser windows, use getAnchorWindowPosition.
Otherwise, use getAnchorPosition
2) Your anchor tag MUST contain both NAME and ID attributes which are the
same. For example:
3) There must be at least a space between for IE5.5 to see the
anchor tag correctly. Do not do with no space.
*/
// getAnchorPosition(anchorname)
// This function returns an object having .x and .y properties which are the coordinates
// of the named anchor, relative to the page.
function getAnchorPosition(anchorname) {
// This function will return an Object with x and y properties
var coordinates = new Object();
var x=0;
var y=0;
// Browser capability sniffing
var use_gebi = false;
var use_css = false;
var use_layers = false;
if (document.getElementById) { use_gebi = true; }
else if (document.all) { use_css = true; }
else if (document.layers) { use_layers = true; }
// Logic to find position
if (use_gebi && document.all) {
x = AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
y = AnchorPosition_getPageOffsetTop(document.all[anchorname]);
}
else if (use_gebi) {
var o = document.getElementById(anchorname);
x = o.offsetLeft;
y = o.offsetTop;
}
else if (use_css) {
x = AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
y = AnchorPosition_getPageOffsetTop(document.all[anchorname]);
}
else if (use_layers) {
var found=0;
for (var i=0; i