var xmlHttpfunction;

function DisplayListingBooks(str)
{
 xmlHttp=GetXmlHttpObject()
 if (xmlHttp==null)
 {
   alert("Browser does not support HTTP Request")
   return
 }
 
 

/* 
  if(document.getElementById(str).style.visibility == "visible")
  {
  	document.getElementById(str).style.visibility = "hidden";
  }
  else
  {
  	document.getElementById(str).style.visibility = "visible";
  }
*/ 
   x=document.BooksList
   var url="DisplayBookByAuthor.php"
   url=url+"?AuthorCode="+str
   getDoc(url, writeHTML, str);
}

function getDoc(url, doFunc, id)
{
	xmlhttp=GetXmlHttpObject();
	xmlhttp.onreadystatechange= function() { 
		if (xmlhttp.readyState==4)
		if (xmlhttp.status==200)
		doFunc(xmlhttp, id);
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
function writeHTML(req, id) 
{
    document.getElementById(id).innerHTML = req.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;
}
