function getJear(pJear) {
	return document.getElementById("jear."+pJear);
}

function getPlaylist(pJear) {
	return document.getElementById("playlist."+pJear);
}

function selectJear(pJear) {
	var jear = getJear(pJear);
	jear.style.cursor = "pointer";
	jear.style.borderColor = "rgb(150,180,255)";
	showPlaylist(pJear);
}

function deselectJear(pJear) {
	var jear = getJear(pJear);
	jear.style.cursor = "none";
	jear.style.borderColor = "rgb(225,225,255)";
	hidePlaylist(pJear);
}

function showPlaylist(pJear) {
	var play = getPlaylist(pJear);
	play.style.visibility = "visible";
	layoutPlaylist(pJear);
}

function hidePlaylist(pJear) {
	var play = getPlaylist(pJear);
	play.style.visibility = "hidden";
}

function layoutPlaylist(pJear) {
	var jear = getJear(pJear);
	var playlist = getPlaylist(pJear);
	var container = document.getElementById("container");
	if ((jear.offsetLeft + playlist.offsetWidth) < container.offsetWidth) {
		playlist.style.left = jear.offsetLeft+"px";
		playlist.style.textAlign = "left";
	} else if (((jear.offsetLeft + jear.offsetWidth) - playlist.offsetWidth) > 0) {
		playlist.style.left = ((jear.offsetLeft + jear.offsetWidth) - playlist.offsetWidth)+"px";
		playlist.style.textAlign = "right";
	}
	playlist.style.top = (jear.offsetTop + jear.offsetHeight)+"px";
}
