
function get_elementX(ref) {
	var loop = ref;
	var out = 0;
	
	while (loop != null) {
		out += loop.offsetLeft;
		loop = loop.offsetParent;
	}
	
	return out;
}

function get_elementY(ref) {
	var loop = ref;
	var out = 0;
	
	while (loop != null) {
		out += loop.offsetTop;
		loop = loop.offsetParent;
	}
	
	return out;
}

function num_word(input) {	
	switch (input) {
		case 1 : return "první";
		case 2 : return "druhý";
		case 3 : return "třetí";
		case 4 : return "čtvrtý";
		case 5 : return "pátý";
		case 6 : return "šestý";
		case 7 : return "sedmý";
		case 8 : return "osmý";
		case 9 : return "devátý";
		case 10 : return "desátý";
		default : return input;
	}
}

function info_display(parent, text) {
	var info_ref = document.getElementById("info")
	if (info_ref != null) {
		info_ref.childNodes[0].innerHTML = text;
		info_move(parent);
		info_ref.style.display = "block";
	}
}

function info_hide() {
	var info_ref = document.getElementById("info")
	if (info_ref != null) {
		info_ref.style.display = "none";
	}
}

function info_move(parent) {
	var info_ref = document.getElementById("info")
	if (info_ref != null) {
		info_ref.style.left = get_elementX(parent) + "px";
		info_ref.style.top = (get_elementY(parent) - 35) + "px";
	}
}

function info_map(parent, text) {
	parent.onmouseover = function() {
		info_display(this, text);
	}
	parent.onmouseout = function() {
		info_hide();
	}
}
