// JavaScript Document


/* Create a new XMLHttpRequest object to talk to the Web server */
var xmlHttp = false;
try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp = false;
  }
}
var xmlHttp2 = false;
try {
  xmlHttp2 = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp2 = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp2 = false;
  }
}
var xmlHttp3 = false;

try {
  xmlHttp3 = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp3 = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp3 = false;
  }
}



if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}
if (!xmlHttp2 && typeof XMLHttpRequest != 'undefined') {
  xmlHttp2 = new XMLHttpRequest();
}
if (!xmlHttp3 && typeof XMLHttpRequest != 'undefined') {
  xmlHttp3 = new XMLHttpRequest();
}


function callserver() {
  
  var tour = document.getElementById("tour").value;
  var code = document.getElementById("code").value;
//  var template_choosed = document.getElementById("template_choosed").value;

  // Build the URL to connect to
  var url = "serverpotd.php?tour=" + escape(tour) + "&code=" + escape(code);

  // Open a connection to the server
  xmlHttp.open("GET", url, true);

  // Setup a function for the server to run when it's done
  xmlHttp.onreadystatechange = updatePage;

  // Send the request
  xmlHttp.send(null);
}

function updatePage() {
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
    document.getElementById("sizes").innerHTML = response;
  }
}

function callserver2() {
  
  var tour = document.getElementById("tour").value;
  var code = document.getElementById("code").value;
//  var template_choosed = document.getElementById("template_choosed").value;

  // Build the URL to connect to
  var url = "serverpotd2.php?tour=" + escape(tour) + "&code=" + escape(code);

  // Open a connection to the server
  xmlHttp2.open("GET", url, true);

  // Setup a function for the server to run when it's done
  xmlHttp2.onreadystatechange = updatePage2;

  // Send the request
  xmlHttp2.send(null);
}

function updatePage2() {
  if (xmlHttp2.readyState == 4) {
    var response = xmlHttp2.responseText;
    document.getElementById("imagelink").innerHTML = response;
  }
}

function callserver3() {
  
  var tour = document.getElementById("tour").value;
  var code = document.getElementById("code").value;
//  var template_choosed = document.getElementById("template_choosed").value;

  // Build the URL to connect to
  var url = "serverpotd3.php?tour=" + escape(tour) + "&code=" + escape(code);

  // Open a connection to the server
  xmlHttp3.open("GET", url, true);

  // Setup a function for the server to run when it's done
  xmlHttp3.onreadystatechange = updatePage3;

  // Send the request
  xmlHttp3.send(null);
}

function updatePage3() {
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp3.responseText;
    document.getElementById("textarealink").innerHTML = response;
  }
}




