var currenthl = 0;
var pathArray = new Array;
function switchHighLight(id, path)
{
	if ($('#highlight_content').html() == $('#highlight_content_'+id).html())
		return false;
	pathArray[id] = path;
	$('#highlight_'+currenthl).css({backgroundImage: 'url(\''+path+'highlight_off.png\')'});
	$('#highlight_'+currenthl+' a').css({color:'#373737'});
	currenthl = id;
	$('#highlight_'+id).css({backgroundImage: 'url(\''+path+'highlight_main_on.png\')'});
	$('#highlight_'+id+' a').css({color:'#EDEDED'});
	$('#highlight_content').fadeOut('fast', function() {
		$('#highlight_content').html($('#highlight_content_'+id).html()).fadeIn('slow', function () {
			if (currenthl != id)
				switchHighLight(currenthl, pathArray[currenthl]);
		});
	});
	$('#highlight_selector').css({top: (((parseInt(id)-1)*51)-203)+'px'});
}

var featuredTypes = new Array('top8', 'random', 'new', 'themes');
function changeFeatured(base_dir, type)
{
	for (var i = 0; type == '+' && i < 4; ++i)
		if (featuredTypes[i] == featured_selected)
			type = featuredTypes[i<3?i+1:0];
	for (var i = 0; type == '-' && i < 4; ++i)
		if (featuredTypes[i] == featured_selected)
			type = featuredTypes[i>0?i-1:3];

	$('#featured_'+featured_selected).removeClass('featured_selected');
	$('#featured_'+featured_selected).addClass('featured_selector');
	featured_selected = type;
	$('#featured_'+type).removeClass('featured_selector');
	$('#featured_'+type).addClass('featured_selected');
	$.post(base_dir+"ajax-homefeatured.php", {type:type}, function(tpl) {
		$("#homefeatured").fadeOut('fast', function(){$("#homefeatured").html(tpl).fadeIn('fast');});
	});
}
