/* ### REPORT ###########################################################################################################
### 2008.11.05 - last update
### v2.0 - UL/LI esetében nem villog ie 6 alatt a css formázás!
###      - Válzotatások:
###					1. Az 50. sorba bekerült a "document.onmousemove = null;" sor
###					2. A 89. sorból a 63. sorba került át a "function WrpFormV1Help(text, cssid, width, opacity) {" sor
### v1.0 - UL/LI lista esetében villog ie 6 alatt a css formázás!
#########################################################################################################################
*/
function WrpFormV1HelpObj() {
	this.width = 266;
	this.cssid = '';
	//this.opacity = 100;
	this.cursorDistance = 10;
	this.text = '';this.obj = 0;this.sobj = 0;this.active = false;
	this.create = function() {
		if(!this.sobj) this.init();
			var t = '<span style=\"width:' + 
			this.width + 'px;display:block;\" class=\"help_box' + this.cssid + '\"><span class=\"help_text' + this.cssid + '\">' + this.text + '</span></span>';
		//this.setOpacity();
		if(document.getElementById) document.getElementById('WrpFormV1HelpEmelent').innerHTML = t;
		else document.all.WrpFormV1HelpEmelent.innerHTML = t;
		this.show();
	}
	this.init = function() {
		if(document.getElementById) {
			this.obj = document.getElementById('WrpFormV1HelpEmelent');
			this.sobj = this.obj.style;
		} else if(document.all) {
			this.obj = document.all.WrpFormV1HelpEmelent;
			this.sobj = this.obj.style;
		}
	}
	this.show = function() {	
		var ext = 'px';
		var left = mouseX - this.width / 2;
		if(left + this.width + this.cursorDistance > winX) left -= this.width / 2 + this.cursorDistance;
		else if(left - this.cursorDistance < 0) left += this.width / 2 + this.cursorDistance;
		else left += this.cursorDistance;
		this.sobj.left = left + ext;
		this.sobj.top = 10 + mouseY + this.cursorDistance + ext;
		if(!this.active) {
			this.sobj.visibility = 'visible';
			this.active = true;
		}
	}
	this.hide = function() {
		if(this.sobj) this.sobj.visibility = 'hidden';
		this.active = false;
		document.onmousemove = null;	/* V2 - Új elem (kinullázza az onmousemove eseményt) */
	}
	this.setOpacity = function() {
		this.sobj.filter = 'alpha(opacity=' + this.opacity + ')';
		this.sobj.mozOpacity = '.1';
		if(this.obj.filters) this.obj.filters.alpha.opacity = this.opacity;
		if(!document.all && this.sobj.setProperty) {
			this.sobj.setProperty('-moz-opacity', this.opacity / 100, '');
		}
	}
}
var FormV1Help = mouseX = mouseY = winX = 0;
document.write('<div id=\"WrpFormV1HelpEmelent\" style=\"position:absolute; z-index:99\"></div>');
function WrpFormV1Help(text, cssid, width, opacity) {
	document.onmousemove = getMouseXY;
	function getMouseXY(e) {
		if(document.all) {	//ie
			// szolúció: http://www.evolt.org/article/Mission_Impossible_mouse_position/17/23335/index.html
			mouseX = event.clientX + document.body.scrollLeft;
			mouseY = event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
			//régi: mouseY = event.clientY + document.body.scrollTop;
		} else {	//ffx
			mouseX = e.pageX;
			mouseY = e.pageY;
		}

		if(mouseX < 0) mouseX = 0;
		if(mouseY < 0) mouseY = 0;
		if(document.body && document.body.offsetWidth) {
			winX = document.body.offsetWidth - 25;
		} else if(window.innerWidth) {
			winX = window.innerWidth - 25;
		} else {
			winX = screen.width - 25;
		}
		if(FormV1Help && FormV1Help.active) {
			FormV1Help.show();
		}
	}
	/* V2 - Áthelyezve feljebb: "function WrpFormV1Help(text, cssid, width, opacity) {" */
	if(text) {
		FormV1Help = new WrpFormV1HelpObj();
		FormV1Help.text = text;
		FormV1Help.cssid = cssid;
		if(width) FormV1Help.width = width;
		if(opacity) FormV1Help.opacity = opacity;
		FormV1Help.create();
	} else if(FormV1Help) {
		FormV1Help.hide();
	}
}