// JavaScript Document

var gOn = 'all';
var gnOn = 'Tous les Genres';
function liveSoft(b,h,hs,g,gn){

	xhrCheck();
	var data = null;
	var b = document.getElementById(b); // bloc logiciel
	var r = document.getElementById('resultat');

	if (g == 'lettre') { 
		data ="live=softs&h="+h+"&hs="+hs+"&l="+gn;
		if (gn == '0-9') { lString = '0 à 9'; }
		else { lString = gn; }
		result = "Les jeux commençant par "+lString;
	}
	else if (g == 'MC') { 
		data ="live=softs&h="+h+"&hs="+hs+"&mc="+gn;
		if(gn == 'nouveau') result = 'Les Nouveautés';
		else if(gn == 'sorties') result = 'Les Prochaines Sorties';
		else if(gn == 'test') result = 'Les Tests';
		else if(gn == 'preview') result = 'Les Previews';
		else if(gn == 'dossier') result = 'Les Dossiers';
		else if(gn == 'ware') {
			if (h == 1) var ware = 'WiiWare';
			else if (h == 2) var ware = 'DSiWare';
			result = 'Les Jeux '+ware;
		}
		else if(gn == 'online') result = 'Les Jeux Online';
	}
	else { 
		data ="live=softs&h="+h+"&hs="+hs+"&g="+g;
		result = "Catégorie "+gn;
	}

	xhr_object.open('POST', 'xhr.php', true);

	xhr_object.onreadystatechange = function() { 
		if(xhr_object.readyState == 4 && xhr_object.status == 200) {
			/*
			if(gOn != 0) {
			var gOff = document.getElementById(gnOn);
			gOff.innerHTML = "<a href=\"javascript:(void)\" onClick=\"liveSoft('"+b+"','"+h+"','"+gOn+"','"+gnOn+"')\">"+gnOn+"</a>";
			}
			gOn = g;
			gnOn = gn;
			var gDiv = document.getElementById(gn);
			gDiv.innerHTML = gn;
			*/
			b.scrollTop = 0;
			contenu = xhr_object.responseText;
			b.innerHTML = contenu;
			r.innerHTML = result.toUpperCase();
		}
	}
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
	xhr_object.send(data);
}
	
