// Encoding: UTF-8 (without BOM) (auto-detect: °°°°°)

/*
Now included in dynamic-lib

function openPopup(url, name, width, height)
{
	var win = window.open(url, name, "width=" + width + ", height=" + height + ", resizable=yes, dependent=yes, scrollbars=yes");
	if (!win)
	{
		alert("Bitte deaktivieren Sie Ihren Popup-Blocker, um das Fenster anzuzeigen.");
	}
	else
	{
		win.focus();
		DOMKeyEvents.add(win, "Escape", win.close);
	}
}

function openPopupLink(link, name, width, height)
{
	openPopup(link.href, name, width, height);
	return false;
}
*/

setConfigValue("popupblockernote", "Bitte deaktivieren Sie Ihren Popup-Blocker, um das Fenster anzuzeigen.");

function selectPhotoLink(link)
{
	var img = $("img", link);
	$("#photo-view").src = img.src.replace(/\.small/, "");
	var title = img.title;
	if (title.indexOf(";") >= 0)
		title = title.replace(/;.*$/, "").trim() + "<br /><small>" + title.replace(/^.*;/, "").trim() + "</small>";
	$("#photo-title").innerHTML = title;
	DOM.removeClass("#photo-list img.selected", "selected");
	DOM.addClass(img, "selected");
	link.blur();
	return false;
}

function selectPhotoImg(img)
{
	$("#photo-view").src = img.src.replace(/\.small/, "");
	var title = img.title;
	if (title.indexOf(";") >= 0)
		title = title.replace(/;.*$/, "").trim() + "<br /><small>" + title.replace(/^.*;/, "").trim() + "</small>";
	$("#photo-title").innerHTML = title;
	DOM.removeClass("#photo-list img.selected", "selected");
	DOM.addClass(img, "selected");
}

function goPrevPhoto()
{
	var imgs = $$("#photo-list img");
	var curr = $("#photo-list img.selected");
	var idx = imgs.indexOf(curr);
	if (idx == -1) return true;   // Nothing found, use HTML fallback
	//if (idx > 0) idx--;
	idx--;
	if (idx < 0) idx += imgs.length;
	selectPhotoImg(imgs[idx]);
	return false;
}

function goNextPhoto()
{
	var imgs = $$("#photo-list img");
	var curr = $("#photo-list img.selected");
	var idx = imgs.indexOf(curr);
	if (idx == -1) return true;   // Nothing found, use HTML fallback
	//if (idx < imgs.length - 1) idx++;
	idx++;
	if (idx >= imgs.length) idx -= imgs.length;
	selectPhotoImg(imgs[idx]);
	return false;
}

function NumericUp(id, max)
{
	var n = +$("#" + id).value;
	n++;
	if (n > max) n = max;
	$("#" + id).value = n;
}

function NumericDown(id, min)
{
	var n = +$("#" + id).value;
	n--;
	if (n < min) n = min;
	$("#" + id).value = n;
}


