function contextHelp(evt, img, text, right, top) {
	cancelBubbling(evt);
	var rightFlag = typeof right == 'undefined' || !right ? false : true;
	var topFlag = typeof top == 'undefined' || !top ? false : true;
	top = parseInt(top);
	top = top == 1  ? -50 : top;
	if (screenSize().w - absPosition(img).x < 300) rightFlag = true;

	var targetDiv;
	if (!gebi("helpDiv"))  {
		var div = document.createElement("div");
		div.id = "helpDiv";
		div.className = "help_div";
		div.style.top = "0px";
		div.style.left = "0px";
		div.style.display = "none";
		div.style.position = "absolute";
		div.style.zIndex = "100000000";
		document.body.appendChild(div);
	}
	targetDiv = gebi("helpDiv");
	targetDiv.innerHTML="<a onclick=\"contextHelpHide();return false;\" href=\"\"><img src=\"/res/pic/core/but/helper_close.gif\" height=7 width=7 border=0 align=right alt=\"\"><\/a><img src=\"/res/pic/core/but/helper_icon.gif\" alt=\"\"><br /><div>" + text + "<\/div>";
	var xRemainder = (rightFlag) ? -238 : 0;
	var yRemainder = (topFlag) ? top : 0;
	targetDiv.style.top = (absPosition(img).y + yRemainder) + "px";
	targetDiv.style.left = (absPosition(img).x + xRemainder) + "px";
	targetDiv.onclick = cancelBubbling;
	targetDiv.style.display = "block";
	return false;
}

function contextHelpHide() {
	if (gebi("helpDiv")) gebi("helpDiv").style.display = "none";
}

function gebi(id) {return document.getElementById(id);}

function screenSize() {
	var w, h;
	w = (window.innerWidth ? window.innerWidth : (document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.offsetWidth));
	h = (window.innerHeight ? window.innerHeight : (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.offsetHeight));
	return {w:w, h:h};
}

function absPosition(obj) {
	this.x = 0;
	this.y = 0;
    while(obj) {
		this.x += obj.offsetLeft;
		this.y += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return {x:this.x,y:this.y};
}

function cancelBubbling(evt) {
      evt = evt || window.event;
      evt.cancelBubble = true;
}

