/* 
 * Cricket365 Stats JavaScript
 * 
 */

function getCricketPlayer(data)  {
    // make sure we have atleast 3 chars before trying to find the player
    if (data.length >= 3) {       
        $("#topicSelector").html("<label>&nbsp;</label><img src='/shared/images/loading-wheel.gif' /> Searching.  Please wait...");
        $("#submitArea").hide();
        $.get("/stats/playerListing.php", {namefilter: data}, function(response) {
            $("#topicSelector").html(response);
        });
    }
}

function getCricketScorecard() {
	var team1 = $("[name='searchStr1']").val();   
	var team2 = $("[name='searchStr2']").val();
	var venueName = $("[name='searchStr3']").val();
	var fromYear = $("[name='searchStr5']").val();
	var toYear = $("[name='searchStr7']").val();
	var compType = $("[name='searchStr8']").val();

    $("#cardSelector").html("<label>&nbsp;</label><img src='/shared/images/loading-wheel.gif' /> Searching.  Please wait...");
    $("#cardList").hide();
    $.get("/stats/scorecardListing.php", {team1: team1, team2:team2, venueName:venueName, fromYear:fromYear, toYear:toYear, compType:compType}, function(response) {
        $("#cardSelector").html(response);
        // only show the submit button if something decent is returned
        if (response.match("<select")) {
            $("#cardList").show();
        }
    });
}

