var xmlHttp

function PlayAudio(txtFileName) {
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) 	{
		alert ("Browser does not support HTTP Request");
		return;
	}
//	alert(txtFileName);
	var url="avplay.php?f=" + txtFileName;
	xmlHttp.onreadystatechange=PlayTheFile;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function PlayTheFile() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")    	{
		document.getElementById("Player").innerHTML=xmlHttp.responseText
	}
} 

function ListBooks(txtPart) {
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) 	{
		alert ("Browser does not support HTTP Request");
		return;
	}        
	var url="biblelist.php";
	url=url+"?strPart="+txtPart;
	url=url+"&retHTML=1";
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=BooksListed;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function BooksListed() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")    	{
		document.getElementById("divBooks").innerHTML=xmlHttp.responseText
	}
} 


function ListSentences(strChapterName,intLang) {
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) 	{
		alert ("Browser does not support HTTP Request");
		return;
	}        
	var url="biblelist.php";
	url=url+"?txtChapter="+strChapterName;
	url=url+"&intLang="+intLang;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=SentencesListed;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function SentencesListed() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")    	{
		document.getElementById("divSentences").innerHTML=xmlHttp.responseText
	}
} 

function ListChapters(intBibleNo,intLang) {
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) 	{
		alert ("Browser does not support HTTP Request");
		return;
	}        
	var url="biblelist.php";
	url=url+"?lngId="+intBibleNo;
	url=url+"&intLang="+intLang;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=ChaptersListed;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function ChaptersListed() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")    	{
		document.getElementById("Chapters").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;
}
