function getLiveLeader(tid) {
  if (tid!='') {
	tid = tid.substring(0,tid.indexOf('$'));
	//ajax request
	ajax = new sack();
	ajax.requestFile = '/pieces/liveleader.php';
	ajax.method = "POST";
	ajax.element = 'compare_tag';
	document.getElementById(ajax.element).value='...caricamento...';
	ajax.setVar("tid", tid);
	ajax.onCompletion = function(){showobi(document.getElementById('select_game').value,'htmlSourceBig',document.getElementById('compare_tag').value);};
	ajax.runAJAX();
  }
}
function getSegreti(page) {
	if (page!='') {
	//ajax request
	ajax = new sack();
	ajax.requestFile = '/pieces/segreti2.asp';
	ajax.method = "GET";
	ajax.element = 'm_segreti';
	ajax.setVar("page", page);
	ajax.runAJAX();
  }
}
function qs(testo){
	if (testo!='') {
	//ajax request
	ajax = new sack();
	ajax.requestFile = '/pieces/ajax-games.php';
	ajax.method = "GET";
	ajax.element = 'qs_result';
	ajax.setVar("qs", testo);
	ajax.runAJAX();
  } 
}
function toggleUnlocked(user,gid,obi,state){
  if (user>0) {
	//ajax request
	document.getElementById('obi_pic_'+obi).innerHTML = '<img src="/img/loading.gif" />';
	document.getElementById('check_unlock_'+obi).disabled=true;
	ajax = new sack();
	ajax.requestFile = '/pieces/unlock.php';
	ajax.method = "POST";
	ajax.element = 'obi_pic_'+obi;
	ajax.setVar("user", user);
	ajax.setVar("gid", gid);
	ajax.setVar("obi", obi);
	ajax.setVar("state", state);
	ajax.onCompletion=function(){document.getElementById('check_unlock_'+obi).disabled=false};
	ajax.runAJAX();
  } else {
	  alert('Devi effettuare il login per utilizzare il tracking degli achievement sbloccati.');
  }
}
function togglePreferito(user,gid,state){
  if (user>0) {
	//ajax request
	document.getElementById('check_preferito').disabled=true;
	ajax = new sack();
	ajax.requestFile = '/pieces/favorite.php';
	ajax.method = "POST";
	ajax.setVar("user", user);
	ajax.setVar("gid", gid);
	ajax.setVar("state", state);
	ajax.onCompletion=function(){document.getElementById('check_preferito').disabled=false};
	ajax.runAJAX();
  } else {
	  alert('Devi effettuare il login per indicare i tuoi giochi preferiti.');
	  document.getElementById('check_preferito').checked=false;
  }
}
function remTip(tid,autore){
	//alert(tid);
	ajax = new sack();
	ajax.requestFile = '/pieces/tips.php';
	ajax.method = "POST";
	ajax.element = 'obi_testo_'+tid;
	ajax.setVar("tid", tid);
	ajax.setVar("autore", autore);
	ajax.runAJAX();
}
function showTips(oid){
	document.getElementById('obi_tips_'+oid).innerHTML='<center><img src="/img/loading.gif"><br />Caricamento...</center>';
	ajax = new sack();
	ajax.requestFile = '/pieces/showtips.php';
	ajax.method = "GET";
	ajax.element = 'obi_tips_'+oid;
	ajax.setVar("oid", oid);
	ajax.runAJAX();
}
function dovote(tid,voto,aid,oid){
	//ajax request
	document.getElementById('obi_votes_'+tid).innerHTML = '<img src="/img/loading.gif" />';
	ajax = new sack();
	ajax.requestFile = '/pieces/tip_vote.php';
	ajax.method = "POST";
	ajax.element = 'obi_votes_'+tid;
	ajax.setVar("tid", tid);
	ajax.setVar("voto", voto);
	ajax.setVar("aid", aid);
	ajax.setVar("oid", oid);
	ajax.runAJAX();
}
