1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
|
<?
if (preg_match("/\/includes\//", $PHP_SELF)) {
die ("You can't access this file directly!");
}
?>
<script type="text/javascript">
<!--
<?php
// The following code is used to support the small popups that
// give the full description of an event when the user move the
// mouse over it.
// Developer's note:
// I (Benoit Maisonny <benoit@synclude.com>) tested this code with Mozilla 0.8.1 (on Linux),
// with IE5.5 SP1 (on WinNT4) and with Netscape Communicator 4.74 (on Linux).
// Netscape 6.0 and 6.01 seem to have a bug related to the visibility attribute.
// I suppose it will be corrected as soon as they release a new version, based on
// a more recent Mozilla source code.
// I'm not able to test this javascript code with IE4. It'd be glad to know if it works.
?>
NS4 = (document.layers) ? 1 : 0;
IE4 = (document.all) ? 1 : 0;
W3C = (document.getElementById) ? 1 : 0;
<?php // W3C stands for the W3C standard, implemented in Mozilla (and Netscape 6) and IE5
// Function show(evt, name)
// evt is a pointer to the Event object passed when the event occurs
// name is the ID attribute of the element to show
?>
function show ( evt, name ) {
if (IE4) {
evt = window.event; //is it necessary?
}
var currentX, //mouse position on X axis
currentY, //mouse position on X axis
x, //layer target position on X axis
y, //layer target position on Y axis
docWidth, //width of current frame
docHeight, //height of current frame
layerWidth, //width of popup layer
layerHeight, //height of popup layer
ele; //points to the popup element
// First let's initialize our variables
if ( W3C ) {
ele = document.getElementById(name);
currentX = evt.clientX,
currentY = evt.clientY;
docWidth = document.width;
docHeight = document.height;
layerWidth = ele.style.width;
layerHeight = ele.style.height;
} else if ( NS4 ) {
ele = document.layers[name];
currentX = evt.pageX,
currentY = evt.pageY;
docWidth = document.width;
docHeight = document.height;
layerWidth = ele.clip.width;
layerHeight = ele.clip.height;
} else { // meant for IE4
ele = document.all[name];
currentX = evt.clientX,
currentY = evt.clientY;
docHeight = document.body.offsetHeight;
docWidth = document.body.offsetWidth;
//var layerWidth = document.all[name].offsetWidth;
// for some reason, this doesn't seem to work... so set it to 200
layerWidth = 200;
layerHeight = ele.offsetHeight;
}
// Then we calculate the popup element's new position
if ( ( currentX + layerWidth ) > docWidth ) {
x = ( currentX - layerWidth );
} else {
x = currentX;
}
if ( ( currentY + layerHeight ) >= docHeight ) {
y = ( currentY - layerHeight - 20 );
} else {
y = currentY + 20;
}
if ( IE4 ) {
x += document.body.scrollLeft;
y += document.body.scrollTop;
} else if (NS4) {
} else {
x += window.pageXOffset;
y += window.pageYOffset;
}
// (for debugging purpose) alert("docWidth " + docWidth + ", docHeight " + docHeight + "\nlayerWidth " + layerWidth + ", layerHeight " + layerHeight + "\ncurrentX " + currentX + ", currentY " + currentY + "\nx " + x + ", y " + y);
// Finally, we set its position and visibility
if ( NS4 ) {
//ele.xpos = parseInt ( x );
ele.left = parseInt ( x );
//ele.ypos = parseInt ( y );
ele.top = parseInt ( y );
ele.visibility = "show";
} else { // IE4 & W3C
ele.style.left = parseInt ( x );
ele.style.top = parseInt ( y );
ele.style.visibility = "visible";
}
}
function hide ( name ) {
if (W3C) {
document.getElementById(name).style.visibility = "hidden";
} else if (NS4) {
document.layers[name].visibility = "hide";
} else {
document.all[name].style.visibility = "hidden";
}
}
function unhide ( name ) {
if (W3C) {
document.getElementById(name).style.visibility = "visible";
} else if (NS4) {
document.layers[name].visibility = "show";
} else {
document.all[name].style.visibility = "visible";
}
}
//-->
</script>
|