/* ** : : : : : : How to use the Show Help : : : : : : ** For each interesting page element you can put the ** attribute help. The help attribute can be any string ** text (scaped to not distroy the html) or some html id. ** The help for each element will be showed automaticaly ** when the mouse is over that. Yeah... we can turn on ** this help system calling the function showMouseHelpOn() ** and turn off calling the function showMouseHelpOff(). ** ** Examples: ** ** my link ** **
** ** ** You need to put the style="display:none" on the long ** help container to it's text do not noise the web page. ** ** If the mouse pointed element do not have a help, ** each one of this parents will be visited to find ** the help. If no one has a help the help box turn ** to non visible. */ /* ** This script can be loaded by the page and it's iFrames, ** as in the Noofero - community network system. Some of ** this code will enable the iFrame => parent information. */ /* ** pageHelp has informations for this page/frame ** to not conflict with other frames. */ var pageHelp = {}; if ( navigator.userAgent.indexOf('MSIE') != -1 ) { pageHelp.isIE = ( navigator.userAgent.indexOf('Opera') == -1 ) } // If i'm in a iFrame, get the iFrame reference: if ( window.parent == window ) { pageHelp.myFrame = false; } else { var randTit = "iframe"+ Math.random(); window.frameHelpId = randTit; var frames = window.parent.document.getElementsByTagName("iframe"); var f; for ( var i=0; f=frames[i]; i++ ) { if ( f.contentWindow && ( f.contentWindow.frameHelpId == randTit ) ) { pageHelp.myFrame = f; } } } /* ** pageHelp.info is a reference for a cetral help information. ** All frames will update the information here. */ if ( !window.parent.pageHelpInfo ) window.parent.pageHelpInfo = {}; pageHelp.info = window.parent.pageHelpInfo; pageHelp.info.incPos = { x:20, y:20 }; pageHelp.info.myDoc = window.parent.document; mouseBli = 0; function getHelp( ev ) { var helpInfo = pageHelp.info; if ( helpInfo.updateBox ) { if ( window.event ) { ev = window.event; var el = ev.srcElement; } else { var el = ev.target; } var mX = 0; var mY = 0; if ( ev.pageX || ev.pageY) { mX = ev.pageX; mY = ev.pageY; } else if (ev.clientX || ev.clientY) { mX = ev.clientX; mY = ev.clientY; if ( pageHelp.isIE ) { mX += helpInfo.myDoc.body.scrollLeft; mY += helpInfo.myDoc.body.scrollTop; } } if ( pageHelp.myFrame ) { var fPos = pageHelp.getPos( pageHelp.myFrame ); mX += fPos.x; mY += fPos.y; } var box = helpInfo.helpBox; helpInfo.mX = mX; helpInfo.mY = mY; if ( mX > ( helpInfo.myDoc.body.clientWidth / 1.8 ) ) { movePageHelpToTheLeftMouseSide() } else { movePageHelpToTheRightMouseSide() } if ( ( mY + box.clientHeight + 40 ) > ( helpInfo.myDoc.body.clientHeight + helpInfo.myDoc.body.scrollTop ) ) { mY = helpInfo.myDoc.body.clientHeight + helpInfo.myDoc.body.scrollTop - box.clientHeight - 40; } if ( box ) { debug = mouseBli++ +" "+ el.nodeName; while ( el.parentNode.getAttribute && ! el.getAttribute("help") ) { el = el.parentNode } debug += " :: "+ el.nodeName +" "+ el.getAttribute("help"); debug += "