function addLoadEvent(func) { 
	var oldonload = window.onload; 
	if (typeof window.onload != 'function') { 
		window.onload = func; 
	} else { 
		window.onload = function() { 
			if (oldonload) { 
			oldonload(); 
			} 
		func(); 
		} 
	} 
} 
	 
addLoadEvent(complist);

var xmlDoc;
if (window.XMLHttpRequest)
  {
  	xhttp=new XMLHttpRequest();
  }
else // Internet Explorer 5/6
  {
  	xhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xhttp.open("GET","/xml/2010profiles.xml",false);
xhttp.send("");
xmlDoc=xhttp.responseXML;


function profiles(i)
	{
	var photo=(x[i].getElementsByTagName("photo")[0].childNodes[0].nodeValue);
	var name=(x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue);
	var loc=(x[i].getElementsByTagName("loc")[0].childNodes[0].nodeValue);
	var video=(x[i].getElementsByTagName("video")[0].childNodes[0].nodeValue);
	var bio=(x[i].getElementsByTagName("bio")[0].childNodes[0].nodeValue);
	var txt="<span class='profilename'>" + name + "</span><img src='/images/2010/competitors/" + photo + "' alt='" + name + "' class='imgl imgbor' /><div class='center'><object width='330' height='267'><param name='movie' value='http://www.youtube.com/v/" + video + "&hl=en_US&fs=1&'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/" + video + "&hl=en_US&fs=1&' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='330' height='267'></embed></object></div><p class='clrl'><span class='green'>Location:</span> " + loc + "</p><p><span class='green'>Bio:</span> " + bio + "</p><div  class='clear'></div>";
	document.getElementById("comprofile").innerHTML=txt;
}

	
function complist(){
	var x=xmlDoc.getElementsByTagName("artist");
	var li = document.createElement("li");
	var ul=document.createElement("ul");
	var span=document.createElement("span");
	var compList = document.getElementById('complist');
	
	
	for (i=0;i<5;i++){ 
		var compName = x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue;
  		compList.appendChild(span).setAttribute('class', 'green');
		compList.appendChild(ul);
		ul.appendChild(li);
		li.innerHTML= compName;
  	}
		

}

complist()

/*
var x=xmlDoc.getElementsByTagName("artist");
document.write("<span class='green'>Group A</span><ul>");
for (i=0;i<5;i++)
  { 
  	document.write("<li onclick='profiles(" + i + ")'>");
  document.write(x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue);
  document.write("</li>");
  }
   document.write("</ul><span class='green'>Group B</span><ul>");
for (i=5;i<9;i++)
  { 
  document.write("<li onclick='profiles(" + i + ")'>");
  document.write(x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue);
  document.write("</li>");
  }
   document.write("</ul><span class='green'>Group C</span><ul>");
for (i=9;i<14;i++)
  { 
  document.write("<li onclick='profiles(" + i + ")'>");
  document.write(x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue);
  document.write("</li>");
  }
document.write("</ul><span class='green'>Group D</span><ul>");
for (i=14;i<19;i++)
  { 
  document.write("<li onclick='profiles(" + i + ")'>");
  document.write(x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue);
  document.write("</li>");
  }
  document.write("</ul>");*/
  
