// Возвращаем элемент по ID
function getElement(id)
{
	var itm = null;
	if (document.getElementById) {
		itm = document.getElementById(id);
	} else if (document.all){
		itm = document.all[id];
	} else if (document.layers){
		itm = document.layers[id];
	}
    return itm;
}

// Отображение/скрытие объекта
function popup(id, state)
{
	var itm = getElement(id);
	if (!itm) {	// do nothing 
	} else if (!state) {
		if (itm.style) {
			if (itm.style.display == "none") { itm.style.display = ""; }
			else { itm.style.display = "none"; }
		}
		else { itm.visibility = "show"; }
	} else {
		if (itm.style) {
			if (state == 'on') { itm.style.display = ""; }
			else { itm.style.display = "none"; }
		} else { itm.visibility = "show"; }
	}
}

// Отображение / скрытие всех описаний титров или фильмографии
function popup_all () 
{
	var ids = getElement("list").getAttribute("list").split(", ");
	var link = getElement("link");
	if (link.firstChild.nodeValue == "развернуть описание ролей") {
		link.firstChild.nodeValue = "свернуть описание ролей";
		state = "on";
	} else {
		link.firstChild.nodeValue = "развернуть описание ролей";
		state = "off";
	}
	for (var i = 0; i < ids.length; i++) {
		popup ('r' + ids[i], state);
	}
}
