var artists = new Array();
var global = this;

//functions
function xmlhttpArtistsFillPost(strURL) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('GET', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
   // self.xmlHttpReq.setRequestHeader('Content-Type', 'text/xml');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updateArtistsFill(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send(null);
}

function updateArtistsFill(str)
{
  //document.write(str);
  //document.close();
  //alert(str);
  global.eval(str);
  //openPopUp('0');
  for (var i=0; i<artists.length; i++) {
	var newNodeListItem = document.createElement("li");
	var newNodeLink = document.createElement("a");
	newNodeLink.href = "javascript:show(" + i + ")";
	newNodeLink.id = "artist"+i;
	newNodeLink.innerHTML = artists[i][1] + " " + artists[i][0];
//	var newText = document.createTextNode(artists[i][1] + " " + artists[i][0]);
//	newNodeLink.appendChild(newText);
	newNodeListItem.appendChild(newNodeLink);
	document.getElementById("artistsfill").appendChild(newNodeListItem);
  }
  if(artists.length>0)
  	show(0);
}

//functions
function show(idx,el) {
	var els =  document.getElementById("artistsfill").childNodes;
	// firstChild, index 0, is the text node
	for(var i=0; i<els.length; i++) {
		if(els[i].childNodes.length != 0)
			els[i].firstChild.className = "";
	}
	document.getElementById("artist"+idx).className = "active1";
	document.getElementById("artistname").innerHTML = artists[idx][1] + " " + artists[idx][0];
	document.getElementById("imagefill").setAttribute("src", "http://" + domain+ "/images/exhibition_programs/performance_crisis/artistslist/" + artists[idx][3]);
	document.getElementById("artistbio").innerHTML = artists[idx][2];
}
