function InitHeadToHead() {
	
	var p1 = new CAPXOUS.AutoComplete("txtPlayer1", function() {
		return "player-search.aspx?name=" + this.text.value + "&callback=SelectPlayer1"
	});
	
	var p2 = new CAPXOUS.AutoComplete("txtPlayer2", function() {
		return "player-search.aspx?name=" + this.text.value + "&callback=SelectPlayer2"
	});
}

function SelectPlayer1(playerId){
	document.getElementById("hidPlayer1").value = playerId;
	TryEnableButton();
}

function SelectPlayer2(playerId){
	document.getElementById("hidPlayer2").value = playerId;
	TryEnableButton();
}

function TryEnableButton(){
	if(document.getElementById("hidPlayer2").value.length > 0 && document.getElementById("hidPlayer1").value.length > 0){
		var btn = document.getElementById("btnHeadToHeadGo");
		btn.disabled = false;
		btn.title = "Click to see head to head";
		//btn.cssClass="ButtonOk";
	}
	
}

function GoToHeadToHead(){
	var headToHeadPage = "head-to-head.aspx?p1=" + document.getElementById('hidPlayer1').value + "&p2=" + document.getElementById('hidPlayer2').value;
	document.location = headToHeadPage;
}