// JavaScript Document
function createPlayerSearch(){
	var position = document.getElementById("selsearchposition").value;
	var level = document.getElementById("selsearchlevel").value;
	///var age = document.getElementById("selsearchage").value;
	var location = document.getElementById("selsearchlocation").value;
	var country = document.getElementById("selsearchcountry").value;
	var gender = document.getElementById("selsearchgender").value;
	var freetxt = document.getElementById("txtsearchplayer").value;
	if(freetxt == "Any Name"){
		freetxt = "";	
	}
	
	/////document.getElementById("hidpalyersearch").value = position + "|" + level + "|" + age + "|" + location;
	document.getElementById("hidpalyersearch").value = position + "|" + level + "|" + location + "|" + country + "|" + gender + "|" + freetxt;
	ajaxPlayerSearch();
}

function createClubSearch(){
	var position = document.getElementById("selsearchpositionclub").value;
	var level = document.getElementById("selsearchlevelclub").value;
	var location = document.getElementById("selsearchlocationclub").value;
	var country = document.getElementById("selsearchcountryclub").value;
	var freetxt = document.getElementById("txtsearchclub").value;
	if(freetxt == "Any Name"){
		freetxt = "";	
	}
	
	document.getElementById("hidclubsearch").value = position + "|" + level + "|" + location + "|" + country + "|" + freetxt;
	ajaxClubSearch();
}

function ajaxPlayerSearch(){
	var xmlHttp;
	try{  // Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}catch (e){  // Internet Explorer
		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;
			}
		}  
	}
  	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4){
			document.getElementById("numplayers").innerHTML=xmlHttp.responseText;
		}
    }
	var strScriptToCall = "numplayers.asp?var=" + document.getElementById("hidpalyersearch").value;
	//alert(strScriptToCall);
	xmlHttp.open("GET",strScriptToCall,true);
	xmlHttp.send(null); 
}

function ajaxClubSearch(){
	var xmlHttp;
	try{  // Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}catch (e){  // Internet Explorer
		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;
			}
		}  
	}
  	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4){
			document.getElementById("numclubs").innerHTML=xmlHttp.responseText;
		}
    }
	var strScriptToCall = "numClubs.asp?var=" + document.getElementById("hidclubsearch").value;
	//alert(strScriptToCall);
	xmlHttp.open("GET",strScriptToCall,true);
	xmlHttp.send(null); 
}

function playersearch(n){
	if (n == '0'){
		alert("You need to login to perform the search.!!\n\nIf you haven't yet got a LOGIN, Please get yourself REGISTERED.");	
	}else if (n =='1'){
		alert("Only Clubs/Associations are allowed to view Players.\n\nPlease accept our Appologies.");	
	}
}

function clubsearch(n){
	if (n == '0'){
		alert("You need to login to perform the search.!!\n\nIf you haven't yet got a LOGIN, Please get yourself REGISTERED.");	
	}else if (n =='1'){
		alert("Only Players are allowed to view Clubs.\n\nPlease accept our Appologies.");	
	}
}