function ajaxGetPlayerStat(pid,compid) {
	Ext.Ajax.request({
		waitMsg: 'Töltés...',
		url: "_ajax/mainPlayerStats.php",
		params: {
			pid: pid,
			compid: compid,
			action: "getStat"
		},
		callback: function (options,success,response) {
			var ajaxResponse = Ext.decode(response.responseText);
			
			if(success == true) {
				Ext.getDom("playerStatGreyBox").innerHTML = ajaxResponse.rows;
			}
		},
		failure: function(response,options) {
			
		}
	});	
}

function getCompetitionsAjax(pid,seid) {
	Ext.Ajax.request({
		waitMsg: 'Töltés...',
		url: "_ajax/mainPlayerStats.php",
		params: {
			pid: pid,
			seid: seid,
			action: "getCompetitions"
		},
		callback: function (options,success,response) {
			var ajaxResponse = Ext.decode(response.responseText);
			
			if(success == true) {
				var competitionsSelect = Ext.getDom("compidSelect");
				
				while(competitionsSelect.options.length> 0) {
				    competitionsSelect.options[0] = null;
				} 
				
				for(i = 0; i < ajaxResponse.length; i++) {
					competitionsSelect.options[competitionsSelect.options.length] = new Option(ajaxResponse[i].comp_name,ajaxResponse[i].compid);
				}	
				
				ajaxGetPlayerStat(pid,competitionsSelect.options[competitionsSelect.selectedIndex].value);
			}
		},
		failure: function(response,options) {
			
		}
	});	
}
