function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		}
		while (obj = obj.offsetParent);
	}
	return [curleft,curtop];
}

var Help = {
	offset: [30, 0],
	helpWindow: null,
	init: function(helpers){
		for(var i = 0; i < helpers.length; ++i){
			this.initOne(helpers[i][0], helpers[i][1])
		}
		this.helpWindow = document.getElementById('helpWindow');
	},
	initOne: function(id, text){
		var link = document.getElementById(id);
		if(!link)return;
		link.onclick		= function(){return false;};
		link.onmouseover	= function(){Help.show(this, text);};
		link.onmouseout		= function(){Help.hide();};
	},
	show: function(el, text){
		var pos = findPos(el);
		var posX = pos[0] + this.offset[0];
		var posY = pos[1] + this.offset[1];
		this.helpWindow.style.left = posX + 'px';
		this.helpWindow.style.top = posY + 'px';
		this.helpWindow.style.display = 'block';
		this.helpWindow.innerHTML = text;
		//console.log(['show: ', text, '(', posX, ', ', posY, ')'].join(''));
	},
	hide: function(){
		this.helpWindow.style.display = 'none';
		//console.log('hide.');
	}
}
