var xmlHttp

function showCat(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="subCatAJAX.php"
url=url+"?category="+str
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("subCat").innerHTML=xmlHttp.responseText 
 } 
}


function showCatNotify(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="subCatNotifyAJAX.php"
url=url+"?category="+str
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}




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


function addCategory(category,subCat,id) {
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="addMyCatAJAX.php"
url=url+"?cat="+category+"&subCat="+subCat+"&teacherProfileNo="+id
xmlHttp.onreadystatechange=stateChangList 
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}


function stateChangList() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("list").innerHTML=xmlHttp.responseText 
 } 
}


function deleteCategory(id) {
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="addMyCatAJAX.php"
url=url+"?delete=delete&myCatId="+id
xmlHttp.onreadystatechange=stateChangList 
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}


function stateChangList() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("list").innerHTML=xmlHttp.responseText 
 } 
}


function addSchedule(avaliable,id) {
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="mySchedule.php"
url=url+"?avaliable="+avaliable+"&scheduleId="+id 
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}


function change(id,classOne,classTwo)
{
identity=document.getElementById(id);
class_name = identity.className;
if (class_name == classOne) {
identity.className = classTwo;
} else {
identity.className = classOne;
} 
}