var xmlhttp;
var xmlhttp1;

function showCond(screen)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url="displaySeconddrop.php";
url=url+"?q="+screen;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function showResult(condition,screen)
{
var cond = condition.value
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url="displayResult.php";
url=url+"?r="+screen+'-'+cond;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged1;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateChanged()
{
if (xmlhttp.readyState==4)
{
document.getElementById("option1").innerHTML=xmlhttp.responseText;
}
}

function stateChanged1()
{
if (xmlhttp.readyState==4)
{
document.getElementById("txtResult").innerHTML=xmlhttp.responseText;
}
}

function stateChanged2()
{
if (xmlhttp1.readyState==4)
{
document.getElementById("txtResult").innerHTML=xmlhttp1.responseText;
}
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}

function updateDrop(cond)
{
var screen = document.getElementById("screenDrop").value;

xmlhttp1=GetXmlHttpObject();
if (xmlhttp1==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url1="displayResult.php";
url1=url1+"?r="+screen+'-'+cond.value;
url1=url1+"&sid="+Math.random();
xmlhttp1.onreadystatechange=stateChanged2;
xmlhttp1.open("GET",url1,true);
xmlhttp1.send(null);

xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url="displaySeconddrop.php";
url=url+"?q="+screen;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function updateDrp(condition)
{
var screen = document.getElementById("screenDrop").value;
var tray = document.getElementById("trayNumber").value;
//alert(tray);
var cond = parseInt(condition.value);

if (tray == 1){
cond = cond
} else if (tray == 2){
cond = cond + 24
} else if (tray == 3){
cond = cond + 48
} else if (tray == 4){
cond = cond + 72
} else {
alert("Select a tray number!")
return
}
xmlhttp1=GetXmlHttpObject();
if (xmlhttp1==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url1="displayResult.php";
url1=url1+"?r="+screen+'-'+cond;
url1=url1+"&sid="+Math.random();
xmlhttp1.onreadystatechange=stateChanged2;
xmlhttp1.open("GET",url1,true);
xmlhttp1.send(null);

xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url="displaySeconddrop.php";
url=url+"?q="+screen;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function updateRadio(sel)
{
var table = document.getElementById("ninetysixradio");
var radiobuttons = table.getElementsByTagName("input");
radiobuttons[sel.value-1].checked = true;
var table = document.getElementById("twentyfour");
var radiobuttons = table.getElementsByTagName("input");
radiobuttons[sel.value-1].checked = true;
}

function tableDisplay(obj) {
no = obj.options[obj.selectedIndex].value;
count = obj.options.length;
//for(i=1;i<count;i++) {
//document.getElementById('option'+i).style.display = 'none';
//}
document.getElementById('option0').style.display = 'none';
document.getElementById('option1').style.display = 'none';
document.getElementById('option2').style.display = 'none';
document.getElementById('option3').style.display = 'none';
//if(no>0)
document.getElementById('option'+no).style.display = 'block';
}

