// JavaScript Document
// Featured Band PARSER SCRIPT 
/* This script parses the featured band xml and created the featured band feature */

function parseFeatured() {
	//alert("parseFeatred was called");
	
	var bandPhotoNode = featuredXML.getElementsByTagName("image");
	var bandPhoto = bandPhotoNode[0].childNodes[0].nodeValue;
	
	var bandNameNode = featuredXML.getElementsByTagName("name");
	var bandName = bandNameNode[0].childNodes[0].nodeValue;
	
	var bandCopyNode = featuredXML.getElementsByTagName("copy");
	var bandCopy = bandCopyNode[0].childNodes[0].nodeValue;
	var bandCopyArray = splitLineBreaks(bandCopy);
	
	var bandPathNode = featuredXML.getElementsByTagName("path");
	var bandPath = bandPathNode[0].childNodes[0].nodeValue;
	
	createFeatured(bandPhoto, bandName, bandCopyArray, bandPath);
	
}

function createFeatured(photo, name, copyArray, path) {
	//alert("createFeatured was called");
	
	var featDiv = document.getElementById("FEATUREDBAND");
	
	//create the anchor tag
	var featAnchor = document.createElement("a");
	featAnchor.setAttribute("href", path);
	//create the photo & append to anchor
	var featImg = document.createElement("img");
	featImg.setAttribute("src", photo);
	featImg.setAttribute("className", "hero");
	featImg.setAttribute("class", "hero");
	featImg.setAttribute("border", "0");
	featAnchor.appendChild(featImg);
	//add the anchor & photo to the page
	featDiv.appendChild(featAnchor);
	
	//create the headline
	var featH1 = document.createElement("h1");
	//create the headline text node & add to headline
	var featName = document.createTextNode(name);
	featH1.appendChild(featName);
	//add the headline to the page
	featDiv.appendChild(featH1);
	
	//create the paragraph
	for (i = 0; i < copyArray.length; i ++) {
		var thisCopy = cleanSpaces(copyArray[i]);
		addParagraphs(thisCopy, featDiv);
	}
	
	
}