﻿// JScript File Opens book catalog and display title info when clicked on in the titles table
var xmlDoc;
if (window.XMLHttpRequest)
  {
  xhttp=new XMLHttpRequest();
  }
else // Internet Explorer 5/6
  {
  xhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xhttp.open("GET","bookcatalog.xml",false);
xhttp.send("");
xmlDoc=xhttp.responseXML;

var x=xmlDoc.getElementsByTagName("BOOK");

function show(i)
{
artist=(x[i].getElementsByTagName("ARTIST")[0].childNodes[0].nodeValue);
title=(x[i].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue);
price=(x[i].getElementsByTagName("PRICE")[0].childNodes[0].nodeValue);
cover=(x[i].getElementsByTagName("COVER")[0].childNodes[0].nodeValue);
dscrp=(x[i].getElementsByTagName("DSCRP")[0].childNodes[0].nodeValue);
are=(x[i].getElementsByTagName("ARE")[0].childNodes[0].nodeValue);
txt="Author: "+artist+"<br />Title: "+title+"<br />Price: "+price+"<br /><a href="+are+">Buy It Now!</a><br><br/>Overview:<p>"+dscrp+"</p><br/>";
document.getElementById("rightColumn").innerHTML=txt;
document.getElementById("rightColumnUpper").innerHTML="<center><img src="+cover+" height=300 width=200/></center>";
}

