var xmlhttp
function nextBook(pos) {
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null) {
		alert ("Your browser does not support AJAX!");
		return;
	}
	xmlhttp.onreadystatechange=stateChanged;
	var url="next-ajax.php?pos="+pos+"&id="+Math.random();
	xmlhttp.open("POST",url,true);
	xmlhttp.send(null);
}

function prevBook(pos) {
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null) {
		alert ("Your browser does not support AJAX!");
		return;
	}
	xmlhttp.onreadystatechange=stateChanged;
	var url="prev-ajax.php?pos="+pos+"&id="+Math.random();
	xmlhttp.open("POST",url,true);
	xmlhttp.send(null);
}

function noSession() {
	alert("This feature requires a session cookie. To use this feature, please set your browser to allow cookies.");
}

function getAuthor() {
   var myIndex = document.authors.author.selectedIndex;
   var url = "search.php?type=author&value="+document.authors.author.options[myIndex].value;
   window.location.href = url;
}

function getArtist() {
   var myIndex = document.artists.artist.selectedIndex;
   var url = "search.php?type=artist&value="+document.artists.artist.options[myIndex].value;
   window.location.href = url;
}

function getEditor() {
   var myIndex = document.editors.editor.selectedIndex;
   var url = "search.php?type=editor&value="+document.editors.editor.options[myIndex].value;
   window.location.href = url;
}

function getPublisher() {
   var myIndex = document.publishers.publisher.selectedIndex;
   var url = "search.php?type=publisher&value="+document.publishers.publisher.options[myIndex].value;
   window.location.href = url;
}

function getYears() {
   var myIndex = document.years.year.selectedIndex;
   var url = "search.php?type=year&value="+document.years.year.options[myIndex].value;
   window.location.href = url;
}

function getPrice() {
   var myIndex = document.prices.price.selectedIndex;
   var url = "search.php?type=price&value="+document.prices.price.options[myIndex].value;
   window.location.href = url;
}

function getThemes() {
   var myIndex = document.themes.theme.selectedIndex;
   var url = "search.php?type=theme&value="+document.themes.theme.options[myIndex].value;
   window.location.href = url;
}

function stateChanged() {
	if (xmlhttp.readyState==4) {
		document.getElementById("bookInfo").innerHTML=xmlhttp.responseText;
	}
}

function GetXmlHttpObject() {
	if (window.XMLHttpRequest) {
		// code for IE7+, Firefox, Chrome, Opera, Safari
		return new XMLHttpRequest();
	}
	if (window.ActiveXObject) {
		// code for IE6, IE5
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	return null;
}
