function displayList(xml) {
	
	//array storing all options
	var comics = xml.getElementsByTagName("option");
	
	//Reference to the list in the index.html
	var list = document.getElementById('comicList');
	
	for (i = 0; i < comics.length; i++){
		
		//Create new option
		list.options[i] = new Option(comics[i].firstChild.data);
		
		//Get id attribute
		var	comicId = comics[i].attributes.getNamedItem("id").nodeValue;
		
		//Set the value of the option
		list.options[i].value = comicId
		
		//Set the id of the option
		list.options[i].setAttribute("id", comicId);
	}
	
	
}

function getSelectedComicId () {
	
	replaceWithLoadingAnim('comic');
	
	//Gets the value of the selected option, which is the comic id
	comicId = document.getElementById('comicList').options[document.getElementById('comicList').selectedIndex].value;
	
	
	
	getDataReturnXml('ajax/php/getcomic.php?id=' + comicId, displayComic);
}
function prev() {
  alert("comic id: " + comicId);
  replaceWithLoadingAnim('comic');
  comicId = parseInt(comicId) - 1;
  getDataReturnXml('ajax/php/getcomic.php?id=' + comicId, displayComic);
}
function next() {
  replaceWithLoadingAnim('comic');
  comicId = parseInt(comicId) + 1;
  getDataReturnXml('ajax/php/getcomic.php?id=' + comicId, displayComic);
}