var xmlHttp;

function uRedirect()
{
    if (document.getElementById("state").value == 'Select A State') {
        alert('Please select a state to search.');
    } else {
        //if (document.getElementById("city").value == 'Select A City') {
        //    alert('Please select a City to search.');
        //} else {
            if (document.getElementById("school").value == 'Select a High School') {
                alert('Please select a High School to search.');
            } else {
                window.location = "http://www.victoryteamspirit.com/schools/switch.php?id=" + document.getElementById("school").value;
            }
        //}
    }
    
}

function showUser(str,str2)
{
//alert('firing');

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request");
 return;
 }
//dl.droplist.options[dl.droplist.selectedIndex].value;

//alert('Here is the state:' + document.getElementById("state").value);
//alert('Here is the city:' + document.getElementById("city").value);
var passstate = document.getElementById("state").value;
var passcity = "";

if (document.getElementById("city").value == 'Select A City') {    
} else {
    passcity = document.getElementById("city").value;
}
if (document.getElementById("school").value == 'Select a High School') {    
} else {
//     document.getElementById('buttonlink').href = "http://www.victorystore.com";
}
if (passcity == "") {
//    alert('Firing city Change!');
    var url="inc/city.php";
    url=url+"?state="+passstate;
    url=url+"&city="+passcity;
    url=url+"&sid="+Math.random();
    //alert(url);
    document.getElementById("txtCity").innerHTML= '<b>Retrieving results.....</b>';
    xmlHttp.onreadystatechange=stateChanged;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
//}
} else {    
//    alert('Firing School Change!');
    var url="inc/school.php";
    url=url+"?state="+passstate;
    url=url+"&city="+passcity;
    url=url+"&sid="+Math.random();
//    alert(url);
    document.getElementById("txtSchool").innerHTML= '<b>Retrieving results.....</b>';
    xmlHttp.onreadystatechange=stateChanged2;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);    
}
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("txtCity").innerHTML=xmlHttp.responseText;
 } 
}

function stateChanged2() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("txtSchool").innerHTML=xmlHttp.responseText;
 } 
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
