// function invoked on image load
function imageLoaded(dir) {  
	document.getElementById("comic").setAttribute("src", dir);
	
	
     }
	 
function displayComic(xml) {
	
	//Gets the directory from the <dir> child
	var dir = xml.getElementsByTagName("dir")[0].firstChild.nodeValue;
	
	//Gets comic id from the id attribute in the root
	var comicId = xml.getElementsByTagName("comic")[0].attributes.getNamedItem("id").nodeValue

/* Loads the comic image */
	
	// create an image object
	objImage = new Image();
	
	// set what happens once the image has loaded
	objImage.onLoad = imageLoaded(dir);
	
	// preload the image file
	objImage.src = dir;
	
	 
/* update the comic list */
	
	//Set the selected option in the list
	var list = document.getElementById('comicList');
	
	//The option corresponding to the display comic will be selected
	document.getElementById(comicId).selected = true;
	
	//Remove loading anim when Image has downloaded
	
	
}