﻿// Opens the authors and bookcatalog and displays author info when author name is clicked on

var xmlDoc;
var xmlDoc2;
if (window.XMLHttpRequest)
  {
  xhttp=new XMLHttpRequest();
  xhttp2=new XMLHttpRequest();
  }
else // Internet Explorer 5/6
  {
  xhttp=new ActiveXObject("Microsoft.XMLHTTP");
  xhttp2=new ActiveXObjext("Microsoft.XMLHTTP");
  }
xhttp.open("GET","authors.xml",false);
xhttp.send("");
xmlDoc=xhttp.responseXML;
var x=xmlDoc.getElementsByTagName("WRITER");

xhttp2.open("GET","bookcatalog.xml",false);
xhttp2.send(null);
xmlDoc2=xhttp2.responseXML;

var y=xmlDoc2.getElementsByTagName("BOOK");

function show(i)
{
bio=(x[i].getElementsByTagName("BIO")[0].childNodes[0].nodeValue);
aname=(x[i].getElementsByTagName("ANAME")[0].childNodes[0].nodeValue);
email1=(x[i].getElementsByTagName("EMAIL1")[0].childNodes[0].nodeValue);
website=(x[i].getElementsByTagName("WEBSITE")[0].childNodes[0].nodeValue);
myspace=(x[i].getElementsByTagName("MYSPACE")[0].childNodes[0].nodeValue);
twitter=(x[i].getElementsByTagName("TWITTER")[0].childNodes[0].nodeValue);
facebook=(x[i].getElementsByTagName("FACEBOOK")[0].childNodes[0].nodeValue);
newrelease1=(x[i].getElementsByTagName("NEWRELEASE1")[0].childNodes[0].nodeValue);
newreleaselink1=(x[i].getElementsByTagName("NEWRELEASE1LINK")[0].childNodes[0].nodeValue);
newrelease2=(x[i].getElementsByTagName("NEWRELEASE2")[0].childNodes[0].nodeValue);
newreleaselink2=(x[i].getElementsByTagName("NEWRELEASE2LINK")[0].childNodes[0].nodeValue);
txt="<b>Click the Titles For More Information.Coming Soon Images Link To The Authors Homepage</b><br><p><a href="+newreleaselink1+"><img src="+newrelease1+" ALIGN=LEFT height=300 width=200></a><a href="+newreleaselink2+"><img src="+newrelease2+" ALIGN=MIDDLE height=300 width=200></a></p><br>Author Name: "+aname+"<br><br>Bio: "+bio+"<br><br>Email: <a href=mailto:"+email1+">"+email1+"</a><br><br>Website: <a href="+website+">"+website+"</a><br><br> Twitter: <a href="+twitter+">"+twitter+"</a><br><br>Myspace: <a href="+myspace+">"+myspace+"</a><br><br>Facebook: <a href="+facebook+">"+facebook+"</a><br><br>";
document.getElementById("rightColumn").innerHTML=txt;

}
