function itemOnMouseOver(obj){ with (obj) { with (style) { backgroundColor = "highlight" color = "highlighttext" } } } function itemOnMouseOut(obj){ with (obj) { with (style) { backgroundColor = "" color = "" } } } function fGetXY(aTag){ var oTmp = aTag; //var oTmp = document.getElementsByName(aTag)[0]; var pt = new Point(0,0); do { pt.x += oTmp.offsetLeft; pt.y += oTmp.offsetTop; oTmp = oTmp.offsetParent; } while(oTmp.tagName!="BODY"); return pt; } function Point(iX, iY){ this.x = iX; this.y = iY; } function popup(selectCtrl,popCtrl) { if (selectCtrl.style.visibility=="hidden") { // var point = fGetXY(popCtrl); with (selectCtrl.style) { // left = point.x; // top = point.y + popCtrl.offsetHeight; left = window.event.clientX; top = window.event.clientY; width = selectCtrl.offsetWidth; height = selectCtrl.offsetHeight; } selectCtrl.style.visibility="visible"; } else { selectCtrl.style.visibility="hidden"; } } function option(label,value) { this.label = label; this.value = value; } var _popupObjs = new Array(); function popupObj(id) { this.id = id; this.options = new Array(); this.binds = new Array(); _popupObjs[_popupObjs.length] = this; } popupObj.prototype.getVisibility = function() { return document.getElementById(this.id).style.visibility; } popupObj.prototype.setVisibility = function(visibility) { document.getElementById(this.id).style.visibility = visibility; } popupObj.prototype.add = function(option) { var len = this.options.length; this.options[len] = option; } popupObj.prototype.bind = function(obj) { this.binds[this.binds.length] = obj; } popupObj.prototype.write = function() { with (document) { write(""); } } popupObj.prototype.create = function() { var objWindow = window.document.createElement("DIV") ; var txtHTML = ""; txtHTML += "
"; for (var i=0; i"; txtHTML += ""; txtHTML += ""; } txtHTML += "
 " + this.options[i].label + " 
"; txtHTML += ""; with (objWindow) { id = this.id ; innerHTML = txtHTML ; with (style) { overflow = "hidden"; position = "absolute"; visibility = "hidden"; zIndex = 1000; cursor = "hand"; } } window.document.body.insertAdjacentElement("afterBegin", objWindow) ; } document.onclick = hitTest; function hitTest(){ for (var i=0; i<_popupObjs.length; i++) { if(_popupObjs[i].getVisibility() == "visible") { var flag = true; for (var j=0; j<_popupObjs[i].binds.length; j++) { if (event.srcElement == _popupObjs[i].binds[j]) { flag = false; break; } } if (flag) { _popupObjs[i].setVisibility("hidden"); } } } };