// JavaScript Document

function divHeights()
{
	var contentHeight = $('#content').height();
	var navbarHeight = $('#navbar').height();
	var shortcutsHeight = $('#shortcuts').height();

	var banner = $('#content').hasClass('t1');

	if (contentHeight < (shortcutsHeight + navbarHeight) && !banner) {
		$('#content').css('height', shortcutsHeight + navbarHeight + 4);
	}
}

function slide()
{
	if (typeof slide.closed == 'undefined' || slide.closed == true)
	{
		slide.closed = false;
		$('#editor').animate({top : 0},{duration: 'fast', easing: 'easeOutBack'});
		$('#shadow2').css('background-image', 'url(/images/shadow3.png)');
	}
	else
	{
		slide.closed = true;
		$('#editor').animate({top : -100},{duration: 'fast', easing: 'easeOutBack'});
		$('#shadow2').css('background-image', 'url(/images/shadow2.png)');
	}
}

function move(direction, type)
{
	var input;
	var radio = document.getElementsByName('radio');
	
	for (i=0; i<radio.length; i++)
	{
		if (radio[i].checked)
		{
			input = radio[i].value;
			break;
		}
	}
	
	var url = 'includes/swap.php';
	
	if (input > 0)
	{
		var params = 'id=' + input + '&direction=' + direction + '&type=' + type;
		$.post(url, params, function(data) { directory(type=='file'?'swap_files':'swap', false, input); if(type=='dir') $('#menu').html(data); }, 'text');
	}
}

function init() {
	
	divHeights();
}

function show(str) {

	if (str == '')
		$('#content li').show();
	else {
		$('#content li').filter('.' + str).show();
		$('#content li').not('.' + str).hide();
	}
}

