var xmlHttp
var xmlHttp2
var xmlHttp3
var xmlHttp4
var xmlHttp5
var xmlHttp6

/*
function atac_user(tiparma){ 
    xmlHttp5=GetXmlHttpObject();
    if (xmlHttp5==null){
	alert ("Your browser does not support AJAX!");
        return;
    } 
    var url="/quiz/atac_user.php";
    url=url+"?sid="+Math.random();
	url=url+"&tiparma="+tiparma;
    xmlHttp5.onreadystatechange=stateChanged5;
    xmlHttp5.open("GET",url,true);
    xmlHttp5.send(null);
}
function undo_atac(tiparma){ 
    xmlHttp5=GetXmlHttpObject();
    if (xmlHttp5==null){
	alert ("Your browser does not support AJAX!");
        return;
    } 
    var url="/quiz/undo_atac.php";
    url=url+"?sid="+Math.random();
	url=url+"&tiparma="+tiparma;
    xmlHttp5.onreadystatechange=stateChanged5;
    xmlHttp5.open("GET",url,true);
    xmlHttp5.send(null);
}
function stateChanged5(){ 
    if (xmlHttp5.readyState==4){ 
		if(xmlHttp5.status==200){
			document.getElementById("lista2_arme").innerHTML=xmlHttp5.responseText;
		}else{
			document.getElementById("lista2_arme").innerHTML="There was a problem with the request!"+xmlHttp5.status;
		};
    }
}
*/


function vinde_arma(tiparma){ 
    xmlHttp4=GetXmlHttpObject();
    if (xmlHttp4==null){
	alert ("Your browser does not support AJAX!");
        return;
    } 
    var url="/quizuser/vinde_arma.php";
    url=url+"?sid="+Math.random();
	url=url+"&tiparma="+tiparma;
    xmlHttp4.onreadystatechange=stateChanged4;
    xmlHttp4.open("GET",url,true);
    xmlHttp4.send(null);
}
function cumpara_arma(tiparma){ 
    xmlHttp4=GetXmlHttpObject();
    if (xmlHttp4==null){
	alert ("Your browser does not support AJAX!");
        return;
    } 
    var url="/quizuser/cumpara_arma.php";
    url=url+"?sid="+Math.random();
	url=url+"&tiparma="+tiparma;
    xmlHttp4.onreadystatechange=stateChanged4;
    xmlHttp4.open("GET",url,true);
    xmlHttp4.send(null);
}
function stateChanged4(){ 
    if (xmlHttp4.readyState==4){ 
		if(xmlHttp4.status==200){
			document.getElementById("lista_arme").innerHTML=xmlHttp4.responseText;
		}else{
			document.getElementById("lista_arme").innerHTML="There was a problem with the request!"+xmlHttp4.status;
		};
    }
	get_credite_top();
	get_banuti_top();
}


function showquiz_online(){ 
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null){
	alert ("Your browser does not support AJAX!");
        return;
    } 
    var url="/quizuser/getonline.php";
    url=url+"?sid="+Math.random();
    xmlHttp.onreadystatechange=stateChanged;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}
function stateChanged(){ 
    if (xmlHttp.readyState==4){ 
		if(xmlHttp.status==200){
			document.getElementById("onlinequiz").innerHTML=xmlHttp.responseText;
		}else{
			document.getElementById("onlinequiz").innerHTML="There was a problem with the request!"+xmlHttp.status;
		};
    }
}


function get_credite_top(){ 
    xmlHttp5=GetXmlHttpObject();
    if (xmlHttp5==null){
	alert ("Your browser does not support AJAX!");
        return;
    } 
    var url="/quizuser/get_credite.php";
    url=url+"?sid="+Math.random();
    xmlHttp5.onreadystatechange=stateChangedcredite;
    xmlHttp5.open("GET",url,true);
    xmlHttp5.send(null);
}
function stateChangedcredite(){ 
    if (xmlHttp5.readyState==4){ 
		if(xmlHttp5.status==200){
			document.getElementById("credite_top").innerHTML=xmlHttp5.responseText;
		}else{
			document.getElementById("credite_top").innerHTML="There was a problem with the request!"+xmlHttp5.status;
		};
    }
}
function get_banuti_top(){ 
    xmlHttp6=GetXmlHttpObject();
    if (xmlHttp6==null){
	alert ("Your browser does not support AJAX!");
        return;
    } 
    var url="/quizuser/get_banuti.php";
    url=url+"?sid="+Math.random();
    xmlHttp6.onreadystatechange=stateChangedbanuti;
    xmlHttp6.open("GET",url,true);
    xmlHttp6.send(null);
}
function stateChangedbanuti(){ 
    if (xmlHttp6.readyState==4){ 
		if(xmlHttp6.status==200){
			document.getElementById("banuti_top").innerHTML=xmlHttp6.responseText;
		}else{
			document.getElementById("banuti_top").innerHTML="There was a problem with the request!"+xmlHttp6.status;
		};
    }
}

/*
function gojoc(){ 
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null){
	alert ("Your browser does not support AJAX!");
        return;
    } 
    var url="/quizuser/gojoc.php";
    url=url+"?sid="+Math.random();
    xmlHttp.onreadystatechange=stateChanged;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}
function stateChanged(){ 
    if (xmlHttp.readyState==4){ 
		if(xmlHttp.status==200){
			document.getElementById("gojoc").innerHTML=xmlHttp.responseText;
		}else{
			document.getElementById("gojoc").innerHTML="There was a problem with the request!"+xmlHttp.status;
		};
    }
}
*/

/*
function show_participanti(){ 
    xmlHttp2=GetXmlHttpObject();
    if (xmlHttp2==null){
		alert ("Your browser does not support AJAX!");
        return;
    } 
    var url="/quizuser/getparticipanti.php";
    url=url+"?sid="+Math.random();
    xmlHttp2.onreadystatechange=stateChanged2;
    xmlHttp2.open("GET",url,true);
    xmlHttp2.send(null);
	showquiz_online();
}
function show_participantiinscrisi(){ 
    xmlHttp2=GetXmlHttpObject();
    if (xmlHttp2==null){
		alert ("Your browser does not support AJAX!");
        return;
    } 
    var url="/quizuser/getparticipantiinscrisi.php";
    url=url+"?sid="+Math.random();
    xmlHttp2.onreadystatechange=stateChanged2;
    xmlHttp2.open("GET",url,true);
    xmlHttp2.send(null);
}
function stateChanged2(){ 
    if (xmlHttp2.readyState==4){ 
		if(xmlHttp2.status==200){
			document.getElementById("participantiinscrisi").innerHTML=xmlHttp2.responseText;
		}else{
			document.getElementById("participantiinscrisi").innerHTML="There was a problem with the request!"+xmlHttp2.status;
		};
    }
}
*/

/*
function statususerjoc(stat){
    xmlHttp3=GetXmlHttpObject();
    if (xmlHttp3==null){
        alert ("Your browser does not support AJAX!");
        return;
    }
    var url="/quizuser/statususerjoc.php";
    url=url+"?sid="+Math.random();
	url=url+"&status="+stat;
    xmlHttp3.onreadystatechange=stateChanged3;
    xmlHttp3.open("GET",url,true);
    xmlHttp3.send(null);
}
function stateChanged3(){ 
    if (xmlHttp3.readyState==4){ 
		if(xmlHttp3.status==200){
			document.getElementById("statusjoc").innerHTML=xmlHttp3.responseText;
		}else{
			document.getElementById("statusjoc").innerHTML="There was a problem with the request!"+xmlHttp3.status;
		};
    }
}
*/

function GetXmlHttpObject(){
    var xmlHttp=null;
    try{
        xmlHttp=new XMLHttpRequest();
    }
    catch(e){
        try{
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch(e){
	    try{
    		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(e){
                  alert("Your browser does not support AJAX!");
                  return false;
            }
        }
    }
    return xmlHttp;
}


function lista_preturi(){ 
	window.open('/quizuser/preturi.php','windowpreturi', 'width=220, height=110,top=200,left=200,location=no,resizable=no,toolbar=no,directories=no,menubar=no,statusbar=no'); 
	return false;
}
