var lastGenre;
var lastSubGenre;
function showGenre(id, obj) {

	if(lastGenre) lastGenre.className = lastGenre.getAttribute('class-hold');
	if(lastSubGenre) lastSubGenre.className = lastSubGenre.getAttribute('class-hold');
	obj.setAttribute('class-hold', obj.className);
	obj.className = 'hover';
	lastGenre = obj;

	var subgenres = $('subgenres').getElementsByTagName('div');
	for(i = 0; i < subgenres.length; i++)
		subgenres[i].style.display = 'none';

	setTimeout(function() { document.getElementById('genrelist_'+id).style.display = 'block'; $('genre_'+id).onclick(); }, 0);
	// stupid ie fix


	return false;
}

function chooseSubGenre(id, obj) {
	if(lastSubGenre) lastSubGenre.className = lastSubGenre.getAttribute('class-hold');
	obj.setAttribute('class-hold', obj.className);
	obj.className = 'hover';
	lastSubGenre = obj;

	ajaxArtists(id, 0, 50, 'name');

	return false;
}

function ajaxArtists(id, start, count, order) {
	var ajax = new Ajax.Updater(
		'artists',
		'ajax.php?action=browse-genre&genre=' + id + '&start=' + start + '&count=' + count + '&order=' + order + '&sid=' + Math.random(),
		{ method: 'get' }
	);
	return false;
}