function showNavigation(page_id) {
	$$('a.menu_parent'+page_id).each(function(elem) {elem.style.display = 'block'});
}

function showAllNews() {
	$('show_all_news').update('Loading...');
	new Ajax.Request('news.php', {method: 'get', onSuccess: function(t) {
		var response = t.responseText.evalJSON();
        $('content_body').update(response.html);
    }});
}

function loadSoundtrack(soundtrack_id) {
	$('soundtrack_info').align = 'center';
	$('soundtrack_info').vAlign = 'middle';
	$('soundtrack_info').update('Loading...');
    $('soundtrack_music').align = 'center';
    $('soundtrack_music').update('Loading...');
    new Ajax.Request('load_soundtrack.php', {method: 'get', parameters: {soundtrack_id: soundtrack_id}, onSuccess: function(t) {
		var response = t.responseText.evalJSON();
        $('soundtrack_info').align = 'left';
        $('soundtrack_info').vAlign = 'top';
        $('soundtrack_info').update(response.info);
        $('soundtrack_music').align = 'left';
        $('soundtrack_music').update(response.music);
    }});
}

function sendMail() {
	$('progress').update('Sending...').show();
    new Ajax.Request(
    	'send_mail.php',
        {
        	method: 'get',
            parameters: {
            	name: $('name').value,
                email: $('email').value,
                subject: $('subject').value,
                message: $('message').value,
                token: $('token').value
            },
            onSuccess: function(t) {
	            var response = t.responseText.evalJSON();
	            if (!response.error) {
	                $('progress').update('<strong>Mail sent!</strong>');
	                $('name').value = '';
	                $('email').value = '';
	                $('subject').value = '';
	                $('message').value = '';
	            } else {
	                $('progress').update(response.error);
	            }
	            window.setTimeout(function() {$('progress').hide();}, 2000);
    		}
        }
    );
}

function sendComment() {
	$('progress').update('Sending...').show();
    new Ajax.Request(
    	'send_comment.php',
        {
        	method: 'post',
            parameters: {
            	name: $('name').value,
                email: $('email').value,
                comment: $('comment').value,
                token: $('token').value
            },
            onSuccess: function(t) {
	            var response = t.responseText.evalJSON();
	            if (!response.error) {
	                $('progress').update('<strong>Comment added!</strong>');
	                $('name').value = '';
	                $('email').value = '';
	                $('comment').value = '';
                    $('comments').innerHTML = response['html'];
                } else {
	                $('progress').update(response.error);
	            }
	            window.setTimeout(function() {$('progress').hide();}, 2000);
    		}
        }
    );
}