// JavaScript help tooltip

function helpView() {

	this.isie=navigator.appVersion.indexOf('MSIE')>0;
	this._hlp=new Array();
	this.io;
	this.divo;
	this.className='help-';


	function createIframe() {
		this.io=document.createElement('IFRAME');
		this.io.src='empty.htm';
		this.io.border=0;
		this.io.frameBorder=0;
		this.io.hspace=1;
		this.io.vspace=1;
		this.io.style.width='220px';
		this.io.scrolling='no';
		this.io.className='help-iframe';
		document.body.insertBefore(this.io, document.body.lastChild);
	}

	this.createIframe=createIframe;

	function createDiv() {
		this.divo=document.createElement('DIV');
		this.divo.className='help-div';
		document.body.insertBefore(this.divo, document.body.lastChild);
	}

	this.createDiv=createDiv;

	function showHelp(name,event) {
		if(!event) event=window.event;
//		alert(event);
		if(this.isie) {
			if(this.io==null)
				this.createIframe();
			this.io.contentWindow.document.open();
//			this.io.contentWindow.document.write();
			this.io.contentWindow.document.write('<html><head><style>body { background-color: yellow; padding: 5px; margin: 0px; font-family: Verdana, sans-serif; font-size: 12px; color: black; text-align: center; }</style><body>'+this._hlp[name]+'</body></html>');
//			this.io.contentWindow.document.write();
			this.io.contentWindow.document.close();
			this.io.style.height=(this._hlp[name].length+0)+'px';
			this.io.style.display='block';
			cur_y=event.clientY+document.documentElement.scrollTop;
			cur_x=event.clientX+document.documentElement.scrollLeft;
			this.io.style.top=cur_y+'px';
			this.io.style.left=cur_x+'px';
		} else {
			if(this.divo==null)
				this.createDiv();
			this.divo.className=this.className+'div';
			this.divo.innerHTML=this._hlp[name];
			this.divo.style.display='block';
//			alert(window.pageYOffset);
			cur_y=event.clientY+window.pageYOffset;
			this.divo.style.top=cur_y+'px';
			cur_x=event.clientX+window.pageXOffset;
			this.divo.style.left=cur_x+'px';
		}
	}

	this.showHelp=showHelp;

	function hideHelp(event) {
		if(!event) event=window.event;
		if(this.isie) {
//			this.io.contentWindow.show('');
			this.io.style.display='none';
		} else {
			this.divo.innerHTML='';
			this.divo.style.display='none';
			this.divo.className='';
		}
	}

	this.hideHelp=hideHelp;

	function addHelp(name,text) {
		this._hlp[name]=text;
	}

	this.addHelp=addHelp;

	function show(str) {
		alert(this.io);
	}
	this.show=show;

}
