function OnChange(dropdown)
   {
      var myindex = dropdown.selectedIndex;
      var SelValue = dropdown.options[myindex].value;
      var baseURL = "/stats/addInnings.php?RoundNumber=" + SelValue;
      top.location.href = baseURL;
      return true;
   }

function OnChangeInnings(dropdown)
{
    var myindex = dropdown.selectedIndex;
    var SelValue = dropdown.options[myindex].value;
    var baseURL = "/stats/addInnings.php?RoundNumber=" + SelValue;
    top.location.href = baseURL;
    return true;
}

function OnChangeRound(dropdown)
{
    var myindex = dropdown.selectedIndex;
    var SelValue = dropdown.options[myindex].value;
    var baseURL = "/stats/addBatting.php?RoundNumber=" + SelValue;
    top.location.href = baseURL;
    return true;
}

function OnChangeTeam(round, dropdown)
{
    var myindex = dropdown.selectedIndex;
    var SelValue = dropdown.options[myindex].value;
    var baseURL = "/stats/addBatting.php?RoundNumber=" + round + "&Team=" + SelValue;
    top.location.href = baseURL;
    return true;
}

function OnChangeNotOut(checkbox, dropdown)
{
    if (checkbox.checked) {
        dropdown.style.visibility = "hidden";
        dropdown.selected = 0;
        dropdown.value = '';
    }
    else {
        dropdown.style.visibility = "visible";
    }
}

function OnChangeDNB(cb, runs, howout, notout, fours, sixes)
{
    if (cb.checked)
    {
        runs.style.visibility = "hidden";
        runs.value = '';
        howout.style.visibility = "hidden";
        howout.selected = 0;
        howout.value = '';
        notout.style.visibility = "hidden";
        notout.checked = false;
        fours.style.visibility = "hidden";
        fours.value = '';
        sixes.style.visibility = "hidden";
        sixes.value = '';
    }
    else
    {
        runs.style.visibility = "visible";
        howout.style.visibility = "visible";
        notout.style.visibility = "visible";
        fours.style.visibility = "visible";
        sixes.style.visibility = "visible";
    }
}

function BattingAddChangeInnings(round, team, dropdown)
{
    var myindex = dropdown.selectedIndex;
    var SelValue = dropdown.options[myindex].value;
    var baseURL = "/stats/addBatting.php?RoundNumber=" + round + "&Team=" + team + "&Innings=" + SelValue;
    top.location.href = baseURL;
    return true;
}

function AddBowlingChangeRound(dropdown)
{
    var myindex = dropdown.selectedIndex;
    var SelValue = dropdown.options[myindex].value;
    var baseURL = "/stats/addBowling.php?RoundNumber=" + SelValue;
    top.location.href = baseURL;
    return true;
}

function AddBowlingChangeTeam(round, dropdown)
{
    var myindex = dropdown.selectedIndex;
    var SelValue = dropdown.options[myindex].value;
    var baseURL = "/stats/addBowling.php?RoundNumber=" + round + "&Team=" + SelValue;
    top.location.href = baseURL;
    return true;
}

function AddBowlingChangeInnings(round, team, dropdown)
{
    var myindex = dropdown.selectedIndex;
    var SelValue = dropdown.options[myindex].value;
    var baseURL = "/stats/addBowling.php?RoundNumber=" + round + "&Team=" + team + "&Innings=" + SelValue;
    top.location.href = baseURL;
    return true;
}
function checkBattingScores(formName) {
    var runsInput = document.forms[formName]['runs'];
    var runsScored = runsInput.value;
    document.forms[formName]['fours'].disabled = false;
    document.forms[formName]['sixes'].disabled = false;
    if (runsScored < 4) {
        document.forms[formName]['fours'].value = "0";
        document.forms[formName]['fours'].disabled = true;
    }
    if (runsScored < 6) {
        document.forms[formName]['sixes'].value = "0";
        document.forms[formName]['sixes'].disabled = true;
    }
}

