function openExtUrl(url)
{
	var win = window.open(url);
	win.focus();
}

function openMp3Player()
{
	var opt = 'dependent=yes,menubar=no,toolbar=no,width=800,height=280';
	var win = window.open('/player', 'MP3Player', opt);
	win.focus();
}

function openImage(url, w, h)
{
	var width = Math.round(w * 1.03);
	var height = Math.round(h * 1.03);
	var param = "dependent=yes,menubar=no,toolbar=no,width=" + width + ",height=" + height;
	var win = window.open(url, 'Bilder', param);
	win.resizeTo(width, height);
	win.focus();
}

function showImage(src, alt)
{
	var m = document.getElementById('member');
	var i = document.createElement('img');

	if (m.firstChild) {
		setOpacity(m, 0);
		m.removeChild(m.firstChild);
	}

	i.src = src;
	i.setAttribute('alt', alt);
	i.setAttribute('title', alt);
	m.appendChild(i);
	fadeIn(m, 1);
}

function fadeIn(id, max)
{
	var elem = typeof id == 'string' ? document.getElementById(id) : id;
	var endVal = max ? max : 1;
	setOpacity(elem, 0);
	fader(elem.id, 0, endVal);
}

function fadeOut(id, min)
{
	var elem = typeof id == 'string' ? document.getElementById(id) : id;
	var endVal = min ? min : 0;
	setOpacity(elem, 1);
	fader(elem.id, 1, endVal);
}

function fader(id, startVal, endVal)
{
	var speed = 15;
	var interval = 0.01;
	var timer = 0;
	setOpacity(id, startVal);
	
	if (startVal < endVal) {
		while (startVal <= endVal) {
			window.setTimeout('setOpacity("' + id + '", ' + startVal + ')', (timer * speed));
			timer++;
			startVal += interval;
		}
	} else if (startVal > endVal) {
		while (startVal >= endVal) {
			window.setTimeout('setOpacity("' + id + '", ' + startVal + ')', (timer * speed));
			timer++;
			startVal -= interval;
		}
		window.setTimeout('setOpacity("' + id + '", ' + endVal + ', 1)', (timer * speed));
	}
}

function setOpacity(id, val, hide)
{
	var elem = typeof id == 'string' ? document.getElementById(id) : id;
	var ieval = val * 100;

	try {
		elem.style.opacity = val;
		elem.style.MozOPacity = val;
		elem.style.KhtmlOpacity = val;
		elem.style.filter = 'alpha(opacity=' + ieval + ')';
	} catch (e) {
	}
}
