<% // Sound code
  String[] sound_ext = { ".mp3", ".wma", ".wav", ".mid", ".rm" };

  for(i = 0; i < sound_ext.length; i++)
    if(new File(imageDirectory, label + sound_ext[i]).exists()) break;

  if(i < sound_ext.length) {
    se.datadosen.util.IO.copyFile(new File(imageDirectory, label + sound_ext[i]), outputDirectory);

    out.println("<script language=\"JavaScript\" type=\"text/javascript\">");
    out.println("if (navigator.appName == \"Microsoft Internet Explorer\")");
    out.println("  document.writeln(\"<bgsound src=\\\"../" + label + sound_ext[i] + "\\\" loop=\\\"false\\\">\");");
  if(i == 0 || i == 2) {
    out.println("else if(navigator.userAgent.indexOf(\"Macintosh\") != -1) {");
    out.println("  document.writeln(\"<object classid=\\\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\\\" codebase=\\\"http://www.apple.com/qtactivex/qtplugin.cab\\\">\");");
    out.println("  document.writeln(\"<param name=\\\"src\\\" value=\\\"../" + label + sound_ext[i] + "\\\">\");");
    out.println("  document.writeln(\"<param name=\\\"hidden\\\" value=\\\"true\\\">\");");
    out.println("  document.writeln(\"<param name=\\\"autoplay\\\" value=\\\"true\\\">\");");
    out.println("  document.writeln(\"<param name=\\\"controller\\\" value=\\\"false\\\">\");");
    out.println("  document.writeln(\"<embed src=\\\"../" + label + sound_ext[i] + "\\\" pluginspage=\\\"http://www.apple.com/quicktime/download/\\\" type=\\\"video/quicktime\\\" controller=\\\"false\\\" autoplay=\\\"true\\\">\");");
    out.println("  document.writeln(\"</object>\"); }"); }
    out.println("else");
    out.println("  document.writeln(\"<embed type=\\\"application/x-mplayer2\\\" src=\\\"../" + label + sound_ext[i] + "\\\" pluginspage=\\\"http://www.microsoft.com/Windows/MediaPlayer/\\\" autostart=\\\"1\\\" showstatusbar=\\\"0\\\" showcontrols=\\\"0\\\" showdisplay=\\\"0\\\" volume=\\\"1\\\" height=\\\"1\\\" width=\\\"1\\\" loop=\\\"false\\\">\");");
    out.println("</script>");
  }
%>