var isHelp = false; var isOverHelp = false;
addEvent(document,'click',closehelpbig);
addEvent(window,'resize',closehelpbig);
function showHelp(e,el) {
	if (!e) e = window.event; var h = document.getElementById('helpop');
	if (el == undefined) el = document.getElementById('helplink');
	if (!h || !el) return false;
	if (isHelp) {
		closeHelp();
		if (window.blur) el.blur();
		el.style.color=''; 
		el.style.backgroundColor='';
		el.style.cursor='help';
	}
	else {
		var pos = atrPos(el);
		var scrollxy = getScrollXY();
		var newLeft = Math.floor(pos[0]+(el.offsetWidth/2)-(h.offsetWidth/2));
		var newTop = (pos[1]-h.offsetHeight-2);
		if (newLeft < scrollxy[0]) newLeft = scrollxy[0];
		if (newTop < scrollxy[1]) newTop = scrollxy[1];
		h.style.left= newLeft+'px';
		h.style.top= newTop+'px';
		h.style.visibility='visible';
		if (window.blur) el.blur();
		el.style.color="#C0D0D6"; 
		el.style.backgroundColor='#526A72';
		el.style.cursor='pointer';
		isHelp = true;
	}
}
function closehelpbig() {
	if (isHelp && !isOverHelp) showHelp();
}

function atrPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function closeHelp() {
	var h = document.getElementById('helpop');
	if (h) {
		h.style.visibility='hidden';
		//h.onclick='';
	}
	isHelp = false;
}

function helpUp(id,w,h,URL) {
	if (URL==undefined) URL = '/images/help/text/help.php?id=';
	if (w==undefined) w = 420;
	if (h==undefined) h = 390;
	var le = 390; var to = 312;
	if (screen) {
		var sw = screen.width; var sh = screen.height;
		le = sw-w-20; to = sh-h-120;
	}
	if (eduswin) eduswin.close();
	var eduswin = window.open(URL+(id!=undefined?id:''), 'edushelp', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width='+w+',height='+h+',left = '+le+',top = '+to);
	if (window.focus) eduswin.focus();
}
