function ArrStrCompare(a,b)
{ if(b[sortindex] == "")
  { if(a[sortindex] == "")
      return 0;
    return 1;
  }
  if(a[sortindex] == "") 
    return -1; 
  if (a[sortindex].toUpperCase() > b[sortindex].toUpperCase())
    return 1;
  else if( a[sortindex].toUpperCase() < b[sortindex].toUpperCase())
    return -1;
  return 0; 
}

function ArrNumCompare(a,b)
{ return a[sortindex] - b[sortindex];
}

function DoSort(index,headerflag)
{ var exc;
  var searcher=/#/g;
  sortindex = index; /* sortindex is global */
  if(index==7)
    MainArray.sort(ArrNumCompare);
  else
    MainArray.sort(ArrStrCompare);
  if(document.all)
    bodycolor=document.body.currentStyle.backgroundColor;
  else
    bodycolor = window.getComputedStyle(document.body, '').getPropertyValue('background-color')
        
  filler = "<table width=100% cellspacing=0 cellpadding=2><tr>"
    +"<td width=23%><a href=javascript:DoSort(1,0)><u><font color=black>Performer</font></u></a></td>"
    +"<td width=43%><a href=javascript:DoSort(3,0)><u><font color=black>Movements + Remarks</font></u></a></td>"
    +"<td width=16% align=right>File-info&nbsp;</td><td width=2%></td></tr>";
  row=1;
  cc=0;
  totcount=MainArray.length;
  for(i=0; i<totcount; i++)
  { if(i%2) 
      filler=filler+"<tr class=content2 onmouseover='this.style.backgroundColor=\"#e1e1da\"'; onmouseout='this.style.backgroundColor=\"#ddddfa\"';";
    else filler=filler+"<tr class=content onmouseover='this.style.backgroundColor=\"#e0e0e0\"'; onmouseout='this.style.backgroundColor=\"#eeeeee\"';";
    filler=filler+" ><td align=left><a href=../performers/"+MainArray[i][1]+".htm><u>"+MainArray[i][0]+"</u></a></td>";
    filler=filler+"<td align=left>"+MainArray[i][9];
    if(MainArray[i][5]!="")
      filler=filler+" ("+MainArray[i][5]+")"; 
    // removed from next line +</a>
    filler = filler+"</td><td align=right>";
    if((pos = MainArray[i][7].indexOf("R")) != -1)
    { count = MainArray[i][7].substr(0,pos);
      filler += "<img src=../registration.gif>";
    }
    else
      count = MainArray[i][7];
    quanta = "";
    if(count != 1)
      quanta = "/"+count;
    filler += "<b>"+MainArray[i][6]+"</b>&nbsp;"+MainArray[i][4]+quanta+"&nbsp;</td>";
    filler = filler+"<td><a href="+MainArray[i][2]+" ><img src=../tomusic.gif alt=\'Go to download page\' border=0></a></td></tr>";
  }
  filler = filler+"</table>\n"; /* \n toegevoegd voor IE Mac 5.x */

  divElt =  document.getElementById("div1");
  divElt.innerHTML = filler;
}

function suggestalink(composer,work,workname)
{ window.open("/suggestalink.php?c="+composer+"&w="+work+"&wn="+workname,"", "resizable,width=640,height=410");
}
