// Get the HTTP Object
<!--
var calmonth;
var calyear;

function getHTTPObject(){
  if (window.ActiveXObject) 
    return new ActiveXObject("Microsoft.XMLHTTP");
  else if (window.XMLHttpRequest) 
    return new XMLHttpRequest();
  else {
    alert("Your browser does not support AJAX.");
    return null;
  }
}

// Implement business logic
function getHistory(){
//alert("history");
  httpObject = getHTTPObject();
  if (httpObject != null) {
//      httpObject.open("GET", "/home/users/web/b2642/ipw.delcobas/public_html/cgi-bin/DelcoHistory.php", true);
      httpObject.open("GET", "./cgi-bin/DelcoHistory.php", true);
      httpObject.send(null);
      httpObject.onreadystatechange = setOutput;
    }
}

function getLeagueInfo(){
  httpObject = getHTTPObject();
  if (httpObject != null) {
      httpObject.open("GET", "./cgi-bin/TeamContacts.php", true);
      httpObject.send(null);
      httpObject.onreadystatechange = setOutput;
    }
}

function getLeagueStandings(){
  httpObject = getHTTPObject();
  if (httpObject != null) {
      httpObject.open("GET", "./cgi-bin/LeagueStandings.php", true);
      httpObject.send(null);
      httpObject.onreadystatechange = setOutput;
    }
}

function getDirections(field){
  httpObject = getHTTPObject();
  if (httpObject != null) {
      httpObject.open("GET", "./cgi-bin/Directions.php?field=" + field, true);
      httpObject.send(null);
      httpObject.onreadystatechange = setOutput;
    }
}

function getTeamInfo(team){
  httpObject = getHTTPObject();
  if (httpObject != null) {
      httpObject.open("GET", "./cgi-bin/Directions.php?team=" + team, true);
      httpObject.send(null);
      httpObject.onreadystatechange = setOutput;
    }
}

function uploadFile(){
  httpObject = getHTTPObject();
  var url = "./upload_schedule.php";
  var params = "lorem=ipsum&name=binny";
  if (httpObject != null) {
    httpObject.open("POST", url, true);
//  alert("got here too!");
//Send the proper header information along with the request
    httpObject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    httpObject.setRequestHeader("Content-length", params.length);
    httpObject.setRequestHeader("Connection", "close");

  
//      httpObject.open("GET", "./Schedule/upload_schedule.php, true);
      httpObject.send(null);
      httpObject.onreadystatechange = returnResult;
    }
    httpObject.send(params);
}

function addDirections(field,dirx){

  dirx=dirx.replace(/#/g,"no. ");
  dirx=dirx.replace(/\n/g,"<br />");
  httpObject = getHTTPObject();
  if (httpObject != null) {
      httpObject.open("GET", "./InputDirections.php?field=" + field + "&directions=" + dirx, true);
      httpObject.send(null);
      httpObject.onreadystatechange = returnResult;
    }
}

function login_to_admin(user,password)
{
  document.getElementById("server_response").value='';
  httpObject = getHTTPObject();
  if (httpObject != null) {
      httpObject.open("GET", "./login.php?user=" + user + "&password=" + password, true);
      httpObject.send(null);
      httpObject.onreadystatechange = setAdminOutput;
  }
}
// Change the value of the outputText field
function setAdminOutput(){
  if(httpObject.readyState == 4){
//    alert ("response is " + httpObject.responseText);
    document.getElementById("gs_calendar").innerHTML=httpObject.responseText;
  }
}


function returnUploadResult(){
  if(httpObject.readyState == 4 && http.status == 200){
    document.getElementById("sql_result").innerHTML=httpObject.responseText;
  }
}

function returnResult(){
  if(httpObject.readyState == 4){
    document.getElementById("sql_result").innerHTML=httpObject.responseText;
  }
}


      // Change the value of the outputText field
function setOutput(){
  if(httpObject.readyState == 4){
//    alert(httpObject.responseText);
    document.getElementById("content_pane").innerHTML=httpObject.responseText;
  }
}

function setval()
{
  document.getElementById('submitted').value="TRUE";
}


function testme()
{
  alert("test!");
}

function get_schedule(month,year)
{
//  calmonth=month;
//  calyear=year;
//  alert("TEST" + month);
  httpObject = getHTTPObject();
  if (httpObject != null) {
      httpObject.open("GET", "./cgi-bin/League_Calendar.php?month=" + month + "&year=" + year, true);
      httpObject.send(null);
      httpObject.onreadystatechange = setOutput;
    }
//  alert("TEST" + month);
}
function get_schedule_update(month,year)
{
  document.getElementById('gs_calendar').style.zindex="0";
  document.getElementById('gs_calendar').style.background="white";
  document.getElementById('gs_calendar').style.visibility="visible";
  calmonth=month;
  calyear=year;
//  alert("TEST1 - " + month);
  httpObject = getHTTPObject();
  if (httpObject != null) {
      httpObject.open("GET", "../cgi-bin/League_Calendar_GS.php?month=" + month + "&year=" + year, true);
      httpObject.send(null);
      httpObject.onreadystatechange = setAdminOutput;
    }
}

function get_team_schedule(team)
{
//alert(team + " Selected");
  httpObject = getHTTPObject();
  if (httpObject != null) {
      httpObject.open("GET", "../cgi-bin/TeamSchedule.php?Team=" + team, true);
      httpObject.send(null);
      httpObject.onreadystatechange = setOutput;
    }
}
function get_team_schedule_update(team)
{

  httpObject = getHTTPObject();
  if (httpObject != null) {
      httpObject.open("GET", "../cgi-bin/TeamSchedule_GS.php?Team=" + team, true);
      httpObject.send(null);
      httpObject.onreadystatechange = setTeamSchedOutput;
    }
}
function setTeamSchedOutput(){
  if(httpObject.readyState == 4){
//    alert ("response is " + httpObject.responseText);
    document.getElementById("team_schedule").innerHTML=httpObject.responseText;
  }
}

function updateSched(GameNum,GameDate,GameTime)
{
//  alert(GameNum);
//  alert(GameDate);
//  alert(GameTime);
  httpObject = getHTTPObject();
  if (httpObject != null) {
      httpObject.open("GET", "../cgi-bin/Schedule_Update.php?game_num=" + GameNum + "&game_date=" + GameDate + "&game_time=" + GameTime, true);
      httpObject.send(null);
      httpObject.onreadystatechange = Sched_Update_Result;
    }
}

function Sched_Update_Result()
{
  if(httpObject.readyState == 4)
  {
    alert(httpObject.responseText);
  }
}

function next_month()
{
  var month=calmonth+1;
  var year=calyear;
  if (month==13)
  {
    month=1;
    year++;
  }
    get_schedule(month,year);
}
function prev_month()
{
  var month=calmonth-1;
  var year=calyear;
  if (month==0)
  {
    month=12;
    year--;
  }
  get_schedule(month,year);
}
function next_gsmonth()
{
  var month=calmonth+1;
  var year=calyear;
  if (month==13)
  {
    month=1;
    year++;
  }
    get_schedule_update(month,year);
}
function prev_gsmonth()
{
  var month=calmonth-1;
  var year=calyear;
  if (month==0)
  {
    month=12;
    year--;
  }
  get_schedule_update(month,year);
}
function set_gamenum(num)
{
//  alert("num= " +num);
  document.getElementById("GameNumber").value=num;
  document.getElementById('gs_calendar').style.zindex="1000";

  document.getElementById("gs_calendar").style.visibility="hidden";
  
  document.getElementById("gameselect_form").submit();
  //document.getElementById("gs_calendar").innerHTML="";
  
}
-->
