// JavaScript Document

var activeId;

function setActiveId(id) {
	activeId = id;
}

function showItem(id, x, y, lnk) {
	if (typeof(x) != "undefined") {
		document.getElementById(id).style.left = x + "px";
	}
	if (typeof(y) != "undefined") {
		document.getElementById(id).style.top = y + "px";
	}
	document.getElementById(id).style.visibility = "visible";
	if (typeof(lnk) != "undefined") {
		document.getElementById(id).title = document.getElementById(lnk).title;
		document.getElementById(id).href = document.getElementById(lnk).href;
	}
}

function hideItem(id) {
	document.getElementById(id).style.visibility = "hidden";
}

function showAnswer(a) {
	document.getElementById("answer").innerHTML = a;
	document.getElementById("answer").style.textDecoration = "none";
}

function changeLabel(s, id, c) {
	document.getElementById(id).innerHTML = s;
	document.getElementById(id).style.color = c;
}

function showPopup(t, d, i) {
  document.getElementById("popupTitle").innerHTML = '';
	document.getElementById("popupTitle").innerHTML = t;
	document.getElementById("popupBody").innerHTML = '';
	document.getElementById("popupBody").innerHTML = document.getElementById(d).innerHTML;
	document.getElementById("popupBody").style.backgroundImage = '';
	document.getElementById("popupBody").style.backgroundImage = "url(image/" + i + ")";
	document.getElementById("popup").style.visibility = "visible";
}

function showAlert(s) {
	alert(s);
}

function showImage(id, i) {
	document.getElementById(id).style.backgroundImage = "url(image/" + i + ")";
	document.getElementById(id).style.cursor = "default";
}

function showThinnedType(t, d, i, s, a) {
	showPopup(t, d, i);
	document.getElementById(s).style.visibility = "visible";
	activeId = a;
}

function makeVisible(i) {
	document.getElementById(i).style.visibility = "visible";
}

function killLink(id) {
	document.getElementById(id).onclick = "";
}
