themes = new Array(7); 
themes[0] = "PMRI"
themes[1] = "EMRSI"
themes[2] = "IR"
themes[3] = "CAD"
themes[4] = "IGS"
themes[5] = "CEN"
themes[6] = "TIIR"

alts = new Array(7); 
alts[0] = "Physics of magnetic resonance imaging" 
alts[1] = "Experimental MR spectroscopy and imaging"
alts[2] = "Image registration"
alts[3] = "Computer-aided diagnosis"
alts[4] = "Image guidance of therapy"
alts[5] = "Clinical and experimental neuroimaging"
alts[6] = "Tomographic instrumentation and image reconstruction"

nrs = new Array(8); 
nrs[0] = 6
nrs[1] = 5
nrs[2] = 8
nrs[3] = 17
nrs[4] = 12
nrs[5] = 7
nrs[6] = 17

function writeLogos()
{
  document.writeln("<p align=center>");
  document.writeln("<table>");
  document.writeln("<tr>");
  
  shuffled = new Array(8);
  for (i=0;i<7;i++) shuffled[i] = i;
  shuffled[7] = Math.floor(Math.random()*7);
  doubletheme = shuffled[7]; // theme that will have two icons this time
  for (i=0;i<8;i++) {
    r1 = Math.floor(Math.random()*8);
    r2 = Math.floor(Math.random()*8);
    temp = shuffled[r1];
    shuffled[r1] = shuffled[r2];
    shuffled[r2] = temp;
  }  
  
  prev = 0; // previously selected image for lucky theme
  for (i=0;i<8;i++) {
    nr = Math.floor(Math.random()*nrs[shuffled[i]]+1);
    while (nr==prev) nr = Math.floor(Math.random()*nrs[shuffled[i]]+1);
    if (shuffled[i]==doubletheme) {
      if (prev==0) {
        prev = nr;
      }  
    }  
    theme = themes[shuffled[i]];
    document.writeln("<td><a href=\"/Research/Themes/"+theme+"\"><img alt=\""+alts[shuffled[i]]+"\"src=/img/logos/"+theme+nr+".jpg></a></td>"); 
    if (i==3) document.writeln("</tr><tr>");
  }  
  document.writeln("</tr>");
  document.writeln("</table>");
  document.writeln("</p>"); 
}

function oneLogo()
{
  document.writeln("<p align=center>");
  document.writeln("<table>");
  document.writeln("<tr>");
  theme = Math.floor(Math.random()*7);
  nr = Math.floor(Math.random()*nrs[theme]);
  document.writeln("<td><img src=http://www.isi.uu.nl/img/logos/"+themes[theme]+nr+".jpg></td>"); 
  document.writeln("</tr>");
  document.writeln("</table>");
  document.writeln("</p>"); 
}

function writeAllLogos()
{
  for (i=0;i<7;i++) {
    document.writeln("<h2>"+alts[i]+"</h2><p>");
    for (j=1;j<=nrs[i];j++) {
      document.writeln("<img src=/img/logos/"+themes[i]+j+".jpg> ");
    }
    document.writeln("</p>");
  }
}

function writeThemeGroupHeading(theme)
{
  document.writeln("<p>");
  document.writeln("<table>");
  document.writeln("<tr>");
  //theme = Math.floor(Math.random()*7);
  nr = Math.floor(Math.random()*nrs[theme]);
  document.writeln("<td><img src=http://www.isi.uu.nl/img/logos/"+themes[theme]+nr+".jpg width=50 height=50></td>"); 
  document.writeln("<td><h1>"+alts[theme]+"</h1></td>"); 
  document.writeln("</tr>");
  document.writeln("</table>");
  document.writeln("</p>"); 
}


