var minPos=false;
var minFalt=false;
function toggleSong(part,id,file)
{
	var infoRow		= document.getElementById('info'+id+'row');
	var infoBox		= document.getElementById('info'+id);
	var lyricsRow	= document.getElementById('lyrics'+id+'row');
	var lyricsBox	= document.getElementById('lyrics'+id);
	var videoRow	= document.getElementById('video'+id+'row');
	var videoBox	= document.getElementById('video'+id);
	var commentsRow	= document.getElementById('comments'+id+'row');
	var commentsBox	= document.getElementById('comments'+id)
	
	switch (part) {
		case 'info':
			lyricsRow.style.display 	= 'none';
			lyricsBox.style.display		= 'none';
			videoRow.style.display		= 'none';
			videoBox.style.display		= 'none';
			videoBox.innerHTML			= '';
			commentsRow.style.display	= 'none';
			commentsBox.style.display	= 'none';
			if (infoBox.style.display == 'block') {
				infoRow.style.display	= 'none';
				infoBox.style.display	= 'none';
			} else {
				infoRow.style.display	= 'block';
				infoBox.style.display	= 'block';
			}
			break;
		case 'lyrics':
			infoRow.style.display	= 'none';
			infoBox.style.display	= 'none';
			videoRow.style.display	= 'none';
			videoBox.style.display	= 'none';
			videoBox.innerHTML		= '';
			commentsRow.style.display	= 'none';
			commentsBox.style.display	= 'none';
			if (lyricsBox.style.display == 'block') {
				lyricsRow.style.display	= 'none';
				lyricsBox.style.display	= 'none';
			} else {
				lyricsRow.style.display	= 'block';
				lyricsBox.style.display	= 'block';
			}
			break;
		case 'video':
			infoRow.style.display	= 'none';
			infoBox.style.display	= 'none';
			lyricsRow.style.display	= 'none';
			lyricsBox.style.display	= 'none';
			commentsRow.style.display	= 'none';
			commentsBox.style.display	= 'none';
			if (videoBox.style.display == 'block') {
				videoRow.style.display	= 'none';
				videoBox.style.display	= 'none';
				videoBox.innerHTML		= '';
			} else {
				videoRow.style.display	= 'block';
				videoBox.style.display	= 'block';
				videoBox.innerHTML		= '<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/'+file+'&hl=en&fs=1&color1=0x3a3a3a&color2=0x999999"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/'+file+'&hl=en&fs=1&color1=0x3a3a3a&color2=0x999999" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object>';
			}
			break;
		case 'comments':
			infoRow.style.display	= 'none';
			infoBox.style.display	= 'none';
			lyricsRow.style.display	= 'none';
			lyricsBox.style.display	= 'none';
			videoRow.style.display	= 'none';
			videoBox.style.display	= 'none';
			videoBox.innerHTML		= '';
			if (commentsBox.style.display == 'block') {
				commentsRow.style.display	= 'none';
				commentsBox.style.display	= 'none';
			} else {
				commentsRow.style.display	= 'block';
				commentsBox.style.display	= 'block';
			}
			break;
	}
}
function toggleUpdateForm(form)
{
	form = document.getElementById(form);
	if (form.style.display != 'block') {
		form.style.display = 'block';
	} else {
		form.style.display = 'none';
	}
}
function showSubmenu(menu)
{
	menu = document.getElementById(menu);
	menu.style.display = 'block';
}
function hideSubmenu(menu)
{
	menu = document.getElementById(menu);
	menu.style.display = 'none';
}
function markorPosition(falt)
{
	minPos = document.selection.createRange();
	minFalt = falt;
}
function infogaGKod(val)
{
	if(minPos) {
		if (val == 'url') {
			if (minPos.text < 1) {
				minPos.text = '[url=adress]länktitel[/url]';
			} else {
				minPos.text = '[url=adress]' + minPos.text + '[/url]';
			}
		} else if (val == 'fet') {
			if (minPos.text < 1) {
				minPos.text = '[fet]text[/fet]';
			} else {
				minPos.text = '[fet]' + minPos.text + '[/fet]';
			}
		} else if(val == 'kursiv') {
			if (minPos.text < 1) {
				minPos.text = '[kursiv]text[/kursiv]';
			} else {
				minPos.text = '[kursiv]' + minPos.text + '[/kursiv]';
			}
		} else if (val == 'understruken') {
			if (minPos.text < 1) {
				minPos.text = '[understruken]text[/understruken]';
			} else {
				minPos.text = '[understruken]' + minPos.text + '[/understruken]';
			}
		}
		minFalt.focus();
	}
}