function populateArray(list, a)
{

	//if (!list) return;
	clearList(list.sel);
	for (i = 0; i < a.length; i++)
	{
	//alert(i);
	   addToList(list, a[i]);
	}
}
//----------------------------------
function addToList(list, t) {

list.sel.options[0] = new Option('Select an artist from ' + letter,'');
with (list.sel){ 

	options[length] = new Option(t,''); // must do it this way for NS4
	//length++;
   }
   list.sel.options[0].selected = true;
	
}
//----------------------------------
function clearList(list)
{

	list.selectedIndex = 0;
	list.length = 1;
}
//----------------------------------
function makeChange(i)
{
clearList(model.sel);
	var i = i -1;	   
	   var mo = m[i][2];
	   populateArray(model, mo); // repopulate all models based on make
	
}

var oldBut = "";
var oldSrc = "";
function setLetter(l){

	if(oldBut != ""){
	oldBut.src = oldSrc;
	oldBut.setAttribute("origsrc", oldSrc);
	//oldBut.setAttribute("src" = oldSrc);
	
	}
	letter = l;
	letterA = eval('let_' + l);
	populateArray(document.forms['artist'], letterA);
	

 var x = document.getElementsByTagName("img");
 for (var i=0;i<x.length;i++){
   var nm = x[i].getAttribute("name");
    if (nm == letter){
    //if first time need to do a stupid JS fix as the other function hasnt run yet
   //alert("1st " + x[i].getAttribute("origsrc"));
   if(oldBut == "" || oldBut == null){
	   //alert("hey im null");
    	oldSrc = x[i].getAttribute("src");
    }else{
		//alert("dude im not null")
    	oldSrc = x[i].getAttribute("origsrc");
    }
	//alert(x[i].getAttribute("origsrc"));
	
    oldBut = x[i];
  
   	//alert(oldSrc);
    oldBut.src = oldBut.getAttribute("oversrc");
   	//oldBut.setAttribute("origsrc",oldBut.src);
	//alert("2nd" + x[i].getAttribute("origsrc"));
   //	 break;  
    }
 }


}
//----------------------------------
function chooseArtist(n) 
{ 
//-1 due to array being zero based
var n = n- 1;
letterA = eval('let_' + letter);
artistName = letterA[n];

//get pathname doesnt include arguments
var tr = window.location.pathname;
//need to escape name for artsits with & in them
location.href = tr + '?letter=' + letter + '&artist=' + escape(artistName);
//}


} 

//----------------------------------

function searchforArtist(art){
var c = 0;
//search for records based on the artist name
//for(var y = ystart; y < yend+1;y++){
//for(var y = 1995; y < 1998;y++){
	
for(var y = yend; y > ystart-1;y--){
	//alert(y);
	var searchA = eval("A_" + y);
	//alert(searchA);
	var l = searchA.length;
	//var artN = unescape(art); // need to unescape so no %20
	
	for(var i = 0; i < l; i++){
	//look for mulitple credited items
	//var ext = "";
	var ext = searchA[i][7];
	//alert(ext.length);
	//if no multi credits items them check the normal place
		if(ext == undefined){
		
			var a = searchA[i][3];
			//alert(a);
				if(a == artN){
					//alert(searchA[i]);
					//alert(searchA[i][2]);
					c++;
					makeArtistPanel(searchA[i][2],searchA[i][0],searchA[i][1],searchA[i][4]);
				}
		}else{
//if there is multi credited items then loop through and search
		var l2 = ext.length;
			for(var ii = 0; ii < l2;ii++){
			var a = ext[ii];
				if(a == artN){
					//alert(ext[ii]);
					//alert(searchA[i][2]);
					c++;
					makeArtistPanel(searchA[i][2],searchA[i][0],searchA[i][1],searchA[i][4]);
				}
			}
		
		}
	}
	
	}
	//alert(c);
	if(c > 8){
	//alert("fff");
		longArtist = true;
	}else{
		longArtist = false;
	}
	//end search for artist
	//call function to make back to top
	setBack2top();
}

//----------------------------------

 var artistDiv = '<table width="474" border="0" cellspacing="0" cellpadding="0"><tr><td><img src="content/images/shim.gif" width="1" height="3"></td></tr></table>';

 function makeArtistPanel(typ,y,aw,re){
 
 //typ = type
 //y = year
 //aw = award
 
 if(typ == "0"){
 	//alert("nom!!");
 	var nom = true;
 }
 var aw = awardNameA[aw];
 //var aw = 'fff';
 //re = release
// alert(typ);
	var txt = "";
	
	txt +=  artistDiv;
	
	txt += '<table width="474" border="0" cellpadding="0" cellspacing="0">';              
	txt += '<tr>';
  
	if(nom){
		txt += '<td width="50" bgcolor="#E1D9D6" class="historyArtistTXT" align="center"><B>' + y + '</B></td>';
	}else{
		txt += '<td width="50" bgcolor="#E5E1C6" class="historyArtistTXT" align="center"><B>' + y + '</B></td>';
	}
  
  	txt += '<td width="3"><img src="content/images/shim.gif" width="3"></td>';
  
	if(nom){
		txt += '<td width="230" class="historyArtistTXT" bgcolor="#E1D9D6">Nominee:<br> <B>' + aw + '</B></td>';
	}else{
		txt += '<td width="230" class="historyArtistTXT" bgcolor="#E5E1C6">Winner:<br> <B>' + aw + '</B></td>';
	}
   
	txt += '<td width="3"><img src="content/images/shim.gif" width="3"></td>';
  
 
	if(nom){
		txt += '<td class="historyArtistTXT" bgcolor="#E1D9D6"><B>' + re + '</B></td>';
	}else{
		txt += '<td class="historyArtistTXT" bgcolor="#E5E1C6"><B>' + re + '</B></td>';
	}
	
	txt += '</tr>';
	//txt += '<tr><td colspan="5" height="3"><img src="content/images/shim.gif" height="3"></td></tr>';
	txt += '</table>';
              
document.write(txt);
}

function setBack2top(){
	if(longArtist){
		document.write('<tr><td height="7" valign="bottom"><br><a href="#theTOP" onMouseOver="MM_swapImage(\'back2top\',\'\',\'content/images/buttons/but_back2top_ove.gif\',1)" onMouseOut="MM_swapImgRestore()"><img src="content/images/buttons/but_back2top.gif" name="back2top" width="72" height="15" border="0" id="back2top"></a><\/td><\/tr>');
	}else{
		document.write('<tr><td height="7" valign="bottom"><img src="content/images/shim.gif" alt="" width="1" height="1" border="0"><\/td><\/tr>');
	}
	}
     
//-->
