var curr_section = 0;

function initiate_inner_menu(section)
{
 	curr_section = section;
}


function set_section(new_section)
{
	// Do nothing if current section = new section
	if (curr_section == new_section)
		return;
	
	// Reset the currently selected section
	var old_img = getHtmlElement('img' + curr_section);
	old_img.src = "/gfx/videoplayer/section_" + curr_section + ".gif";
	old_img.old_src = "/gfx/videoplayer/section_" + curr_section + ".gif";
	
	// Set the new section
	var new_img = getHtmlElement('img' + new_section);
	new_img.src = "/gfx/videoplayer/section_" + new_section + "_marked.gif";
	new_img.old_src = "/gfx/videoplayer/section_" + new_section + "_marked.gif";
	
	// Make current section invisible
	vh('section_' + curr_section);
	// Make new section visible
	vh('section_' + new_section);
	
	curr_section = new_section;
}


function submit_comment()
{
	obj = getHtmlElement('c_msg');
	if (obj.value == "")
	{
		alert('Du måste skriva ett meddelande.');
		return;
	}
	
	window.frames['comment_window'].document.comment_form.c_msg.value = obj.value;
	window.frames['comment_window'].document.comment_form.submit();
	
	obj.value = "";
}


function comment_frame_resize(new_comment)
{
	var obj = getHtmlElement('comment_window');

	if (new_comment)
	{
		if (obj.height < 344 && obj.height != 105)
			obj.height = parseInt(obj.height) + 86;
		else if (obj.height == 105)
			obj.height = 85;
	}
	// Else id last comment is removed
	else if (obj.height == 85)
	{
		obj.height = 105;
	}
}


function set_text(text)
{
	obj = getHtmlElement('c_msg');
	obj.value = text;
}

function clip_download()
{
	if (confirm("Du måste vara registrerad användare och inloggad för att kunna ladda ner filmen.\nVill du registrera dig nu?"))
		window.location.href = 'http://gameplayer.se/register.php';
}