/*############################################################################## # HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################## */ var tooltipDiv = null; var tooltipPopup = null; var tooltipX = 0; var tooltipY = 0; var tooltipSrcObj = null; var tooltipCaptionColor = "#6699FF"; //"#808080"; var tooltipBodyColor = "#FFFF99"; //"#C0C0C0"; var tooltipBodyTextColor = "black"; var tooltipMaxWidth = screen.width; function EnterContent(tooltipDivId, TTitle, TContent, nowrap, align) { var div = document.all[tooltipDivId]; if (!div) return; var s = []; s.push(''); if (TTitle) s.push(''); if (!align) align = 'left'; s.push( '
'+ TTitle+'
'+ TContent.replace(new RegExp('\n', 'g'), '
')+ '
' ); tooltipDiv = div; div.style.width = 0;//reset width div.innerHTML = s.join(''); //if the tooltip is too wide then limit it to width defined by tooltipMaxWidth // if (tooltipDiv.offsetWidth > tooltipMaxWidth && nowrap) EnterContent(tooltipDivId, TTitle, TContent, false); } function tooltipContextMenu() { var srcObj = tooltipSrcObj; deActivate(); return srcObj ? srcObj.oncontextmenu() : true; } function tooltipClick() { var srcObj = tooltipSrcObj; deActivate(); return srcObj ? srcObj.onclick() : true; } function Activate(object, x, y) { if (tooltipDiv) { tooltipPopup=window.createPopup(); var tooltipBody=tooltipPopup.document.body; //tooltipBody.style.backgroundColor = "yellow"; tooltipBody.style.border = "outset black 1px"; tooltipBody.innerHTML=tooltipDiv.innerHTML; if (object) { tooltipBody.oncontextmenu = tooltipContextMenu; tooltipBody.onclick = tooltipClick; } overhere(object, x, y); } } function overhere(object, x, y) { if (tooltipPopup && tooltipDiv) { if (object == null) { var e = window.event; if (e == null) return; x = e.screenX; y = e.screenY; object = tooltipSrcObj; } if (x != tooltipX || y != tooltipY || object != tooltipSrcObj) { tooltipX = x; tooltipY = y; tooltipSrcObj = object; tooltipPopup.show(tooltipX+5, tooltipY+5, tooltipDiv.offsetWidth+2, tooltipDiv.offsetHeight, object); } } } function deActivate() { if (tooltipPopup) { tooltipPopup.hide(); tooltipPopup=null; tooltipX = tooltipY = 0; tooltipSrcObj = null; tooltipDiv = null; } }