if (window.XMLHttpRequest){

          // If IE7, Mozilla, Safari, etc: Use native object
          var xmlhttp = new XMLHttpRequest()

}
else
{
if (window.ActiveXObject){

          // ...otherwise, use the ActiveX control for IE5.x and IE6
          var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
          }

}

function showSchools(borough) {

var theQuery = borough ;
if(theQuery !== "") {
//elem = document.getElementById('result').style;
//elem.display = 'inline';
//document.getElementById('result').innerHTML = '<span class="load">Please wait...</span>';
var url = 'show-schools.asp?borough=' + theQuery ;
xmlhttp.open('GET',url, true);
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 4){
if(xmlhttp.status == 200) {
//elem = document.getElementById('result').style;
//elem.display = 'inline';
document.getElementById('results').innerHTML = xmlhttp.responseText;

//new Effect.Highlight('schoolname', {startcolor: '#E0FE8E' , endcolor: '#3A6188', queue: 'end'});

} else {
alert("There was an unexpected error. Please refresh the page and try again.");
}
}
};
xmlhttp.send(null);  
}
}

function searchSchools() {

var theQuery = document.getElementById('srch').value ;
if(theQuery !== "") {
//elem = document.getElementById('result').style;
//elem.display = 'inline';
//document.getElementById('result').innerHTML = '<span class="load">Please wait...</span>';
var url = 'show-schools.asp?search=' + theQuery ;
xmlhttp.open('GET',url, true);
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 4){
if(xmlhttp.status == 200) {
//elem = document.getElementById('result').style;
//elem.display = 'inline';
document.getElementById('homepagecontent').innerHTML = xmlhttp.responseText;

//new Effect.Highlight('schoolname', {startcolor: '#E0FE8E' , endcolor: '#3A6188', queue: 'end'});

} else {
alert("There was an unexpected error. Please refresh the page and try again.");
}
}
};
xmlhttp.send(null);  
}
}

function top() {
$.scrollTo("#wrapper", 800);
}

$(document).ready(function(){
    
    $("#login-button").click(function () {
      if ($("#login-form").is(":hidden")) {
        $("#login-form").slideDown("slow");
      } else {
        $("#login-form").slideUp("slow");
      }
    });

    $("#contactform").click(function () {
      if ($("#contact-form").is(":hidden")) {
        $("#contact-form").slideDown("slow");
      } else {
        $("#contact-form").slideUp("slow");
      }
    });

    $("#moreinfo").click(function () {
      if ($("#more").is(":hidden")) {
        $("#more").slideDown("slow");
      } else {
        $("#more").slideUp("slow");
      }
    });


  });

function sendEmail() {
var personName = document.getElementById('name').value ;
var personEmail = document.getElementById('email').value ;
var query = document.getElementById('query').value ;
//elem = document.getElementById('result').style;
//elem.display = 'inline';
//document.getElementById('result').innerHTML = '<span class="load">Please wait...</span>';
var url = 'send-email.asp?name=' + personName + '&email=' + personEmail + '&query=' + query;
xmlhttp.open('GET',url, true);
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 4){
if(xmlhttp.status == 200) {
elem = document.getElementById('result').style;
elem.display = 'inline';
document.getElementById('result').innerHTML = xmlhttp.responseText;
} else {
alert("There was an unexpected error. Please refresh the page and try again.");
}
}
};
xmlhttp.send(null);  
}

function sendRegistration() {
var personName = document.getElementById('nme').value ;
var personEmail = document.getElementById('eml').value ;
var personPhone = document.getElementById('ph').value ;
var personSchool = document.getElementById('sch').value ;
var query = document.getElementById('q').value ;
//elem = document.getElementById('res').style;
//elem.display = 'inline';
//document.getElementById('res').innerHTML = '<span class="load">Please wait...</span>';
var url = 'register.asp?name=' + personName + '&email=' + personEmail + '&phone=' + personPhone + '&school=' + personSchool + '&query=' + query;
xmlhttp.open('GET',url, true);
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 4){
if(xmlhttp.status == 200) {
elem = document.getElementById('res').style;
elem.display = 'inline';
document.getElementById('res').innerHTML = xmlhttp.responseText;
} else {
alert("There was an unexpected error. Please refresh the page and try again.");
}
}
};
xmlhttp.send(null);  
}
