var ajaxDrop = new sackDrop();
function getCompetitionList(sel)
 {
	var competitiontype  = document.frmwidget.selCompetitiontype.value;	
	document.getElementById('selCompetition').options.length = 0;	// Empty competition select box
	
	if(competitiontype.length>0){
		ajaxDrop.requestFile  = 'ajax_include/ajax_getTableCompetitionList.php?competitiontype='+competitiontype;	// Specifying which file to get
		ajaxDrop.onCompletion = createCMP;	// Specify function that will be executed after file has been found
		ajaxDrop.runAJAX();		// Execute AJAX function
	}
 }
function getSeasonList(sel)
 {
	var cmpid  = document.frmwidget.selCompetition.value;	
	document.getElementById('selSeason').options.length = 0;	// Empty competition select box
	if(cmpid.length>0){
		ajaxDrop.requestFile  = 'ajax_include/ajax_getSeasonList.php?cmpid='+cmpid;	// Specifying which file to get
		ajaxDrop.onCompletion = createSeason;	// Specify function that will be executed after file has been found
		ajaxDrop.runAJAX();		// Execute AJAX function
	}
 } 
function createCMP()
 {
	var obj = document.getElementById('selCompetition');
	eval(ajaxDrop.response);	// Executing the response from Ajax as Javascript code	
 }
 function createSeason()
 {
	var obj = document.getElementById('selSeason');
	eval(ajaxDrop.response);	// Executing the response from Ajax as Javascript code	
 }
 
//TEAM DROP DOWN ----------------------------------------------------------------->
function getTeamList(sel)
 {
	var soccertype = document.frmwidget.selTeamtype.value;	
	var countryId  = document.frmwidget.selCounty.value;
	document.getElementById('selTeamList').options.length = 0;	// Empty competition select box
	
	if(countryId.length>0){
		ajaxDrop.requestFile = 'ajax_include/ajax_getTeamListWithId.php?teamtype='+soccertype+'&countryid='+countryId;	// Specifying which file to get
		ajaxDrop.onCompletion = createCities;	// Specify function that will be executed after file has been found
		ajaxDrop.runAJAX();		// Execute AJAX function
	}
 }
function createCities()
 {
	var obj = document.getElementById('selTeamList');
	eval(ajaxDrop.response);	// Executing the response from Ajax as Javascript code	
 }
 function createTeamName()
 {
	var obj = document.getElementById('selTeamListOne');
	eval(ajaxDrop.response);	// Executing the response from Ajax as Javascript code	
 }
 function createSecondTeamName()
 {
	var obj = document.getElementById('selTeamListTwo');
	eval(ajaxDrop.response);	// Executing the response from Ajax as Javascript code	
 }
function getTeamName(sel,siteURL)
 {
	var teamname = sel.options[sel.selectedIndex].value;
	document.frmwidget.action = siteURL+"/team/"+teamname+"/index.php";
	document.frmwidget.submit();
 }
 
 //Team dropdown From Country
 function getTeamListFromCountry(sel)
 {
	var countryId  = document.frmteam.selCountyOne.value;
	document.getElementById('selTeamListOne').options.length = 0;	// Empty competition select box
	if(countryId.length>0){
		ajaxDrop.requestFile = 'ajax_include/ajax_getTeamListWithCountryId.php?countryid='+countryId;	// Specifying which file to get
		ajaxDrop.onCompletion = createTeamName;
		ajaxDrop.runAJAX();		// Execute AJAX function
	}
 }
 
 function getSecondTeamListFromCountry(sel)
 {
	var dropdownName=sel.name;
	var countryId  = document.frmteam.selCountyTwo.value;
	document.getElementById('selTeamListTwo').options.length = 0;	// Empty competition select box
	
	if(countryId.length>0){
		ajaxDrop.requestFile = 'ajax_include/ajax_getTeamListWithCountryId.php?countryid='+countryId;	// Specifying which file to get
		ajaxDrop.onCompletion = createSecondTeamName;
		ajaxDrop.runAJAX();		// Execute AJAX function
	}
 }