// JavaScript Document
var xmlHttp

function showSection(section,level,user_test,peer_one_test,peer_two_test,peer_three_test,expected_test)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request. Please update your browser.")
 return
 }

if(level == 1)
{
	var url="/pages/threesixty/section.php?section="+section+"&utid="+user_test+"&p1tid="+peer_one_test+"&p2tid="+peer_two_test+"&p3tid="+peer_three_test+"&etid="+expected_test+"&sid="+Math.random()
	xmlHttp.onreadystatechange=sectionStateChange
}
else if(level == 2)
{
	var url="/pages/threesixty/subsection.php?subsection="+section+"&utid="+user_test+"&p1tid="+peer_one_test+"&p2tid="+peer_two_test+"&p3tid="+peer_three_test+"&etid="+expected_test+"&sid="+Math.random()
	xmlHttp.onreadystatechange=subSectionStateChange
}

xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


function sectionStateChange()
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 	document.getElementById("section").innerHTML=xmlHttp.responseText
	
 }
 else
 {
	 document.getElementById("section").innerHTML="<center><img src='/images/loading.gif'><br/>...loading...</center>"
	 document.getElementById("subsection").innerHTML=""
 }
}

function subSectionStateChange()
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 	document.getElementById("subsection").innerHTML=xmlHttp.responseText 
 }
 else
 {
	 document.getElementById("subsection").innerHTML="<center><img src='/images/loading.gif'><br/>...loading...</center>"
 }
}

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;
}
