// JavaScript Document

var xmlHttp;

function showUniversity(str)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
//var url="getcustomer.php";
//url=url+"?q="+str;
//url=url+"&sid="+Math.random();
   if(str=="Other Organizations")
      {
		myform.WorkPlace.disabled = true;
		myform.Faculty.disabled = true;
		myform.Title.disabled = true;
		document.getElementById("workplace_btn").disabled = false;
		window.document.getElementById("div1").style.display = 'inline';
		window.document.getElementById("div2").style.display = 'inline';
		window.document.getElementById("div3").style.display = 'inline';
		window.document.getElementById("div4").style.display = 'none';
		window.document.getElementById("div5").style.display = 'none';
		window.document.getElementById("div6").style.display = 'none';
		window.document.getElementById("txtHint").disabled = true;
		
		
		
		myform.Faculty.name     = "neglect" ;
		myform.HighestDegree.disabled = false;
		myform.HighestDegree.id = "Faculty" ;
		myform.HighestDegree.name= "Faculty" ;
		
		myform.Title.name     = "neglect" ;
		myform.OtherTitle.disabled = false;
		myform.OtherTitle.id = "Title" ;
		myform.OtherTitle.name= "Title" ;
		
		myform.WorkPlace.name     = "neglect" ;
		myform.OtherWorkPlace.disabled = false;
		myform.OtherWorkPlace.id = "University" ;
		myform.OtherWorkPlace.name= "University" ;
		
		  
		  }
       else
       {
		window.document.getElementById("div4").style.display = 'inline';
		window.document.getElementById("div5").style.display = 'inline';
		window.document.getElementById("div6").style.display = 'inline';
         xmlHttp.onreadystatechange=stateChanged;
         xmlHttp.open("GET","getUniversity.php?q="+str,true);
         xmlHttp.send(null);
       }
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("workplace_btn").disabled = false;
document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
}

}

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;
}
