var xmlHttp; var countries; var cws; var dummyOption; var loadingOption; var or, orl, stte; function stateChanged() { var country = document.getElementById("country").value; var statesel = document.getElementById("state"); var state = statesel.value; if ( ( country == "United States" && (state == "FL" || state == "NY" || state == "PR" ) ) || ( country == "Canada" && (state == "QC"))) { alert ('This service is not currently available in your area. ' + 'Please see the Official Rules for details.'); statesel[0].selected = 1; return false; } return true; } function countryChanged() { var countrycode = document.getElementById("country").value; if (! cws[countrycode]) { // The country has no states. Show the region. if (stte == null) { // freelotto mode. Show the region and the regionlabel, load the // dummyOption. setstates(""); or.style.display = ''; orl.style.display = ''; } else { // FAST mode. Hide the states, show the region. Set label to Region setstates(""); or.style.display = ''; stte.style.display = 'none'; if (orl != null) orl.innerHTML = "Region:"; } if (stte != null && stte.value == or.value) { or.value = ''; } } else { // Show the states if we have them. Load them if we don't. if (countries[countrycode]) { setstates(countrycode); } else { fetchstates(countrycode); } if (stte == null) { // freelotto mode. Hide the region and its label. or.style.display = 'none'; orl.style.display = 'none'; } else { // FAST mode. Hide the region. Show the states. Change the label to // "State:" or.style.display = 'none'; stte.style.display = ''; if (orl != null) orl.innerHTML = 'State:'; } //if (stte != null) { // stte.value = ''; //} } } function pageLoaded() { initStates(); countryChanged(); stateChanged(); } function fetchstates(countrycode) { xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support HTTP Request."); return; } var state = document.getElementById('state'); state.options[0] = loadingOption; state.selectedIndex = 0; document.getElementById('country').disabled = true; var url = '/xmljs/countrystate.asp?cid=' + countrycode + '&rid=' + Math.random(); xmlHttp.onreadystatechange=statesarrived; xmlHttp.open("GET", url, true); xmlHttp.send(null); } // Set the states for the given country code. function setstates(countrycode) { var state = document.getElementById("state"); var selectedstate = document.getElementById("chosenstate"); var selectedindex = 0; selectedstate = (selectedstate == null) ? "" : selectedstate.value; selectedstate = selectedstate.toLowerCase(); // Clear the current states from the dropdown. while (state.length > 0) { state.remove(0); } if (! countrycode || countrycode == "") { state.options[0] = dummyOption; } else { var options = countries[countrycode]; for (var i=0; i