
function createclip(clipid, swffile, file, w, h, extra)
{
  if (arguments.length <= 5) extra = "";
    var data = swffile + '?file=' + file + '&autoStart=false';
    var x = document.getElementById(clipid).innerHTML;
    if (x.indexOf(file) !== -1)
      document.getElementById(clipid).innerHTML = "";
    else
    {
      if (arguments.length < 6) extra = '';
    document.getElementById(clipid).innerHTML = ('\
<object align=center type="application/x-shockwave-flash" data="'+data +'" width="'+w + '" height="' + (h+20) + '" wmode="transparent">\
 <param name="allowscriptaccess" value="always"></param>\
 <param name="movie" value="' + data + '" \/>\
  <param name="wmode" value="transparent" \/>\
<\/object>' + extra);
  }
}

// [[www.resturl text]] url
// [[http://resturl text]] url
// [[en:page text]] wikipedia page (page with _ instead of spaces)
function wikipedia(id, idistext)
{
  var x = id;
  if (arguments.length == 1 || !idistext)
    x = document.getElementById(id).innerHTML;

  // Generate mouseovers for dynamic drive pics
  // MUST USE single quotes for text !!!
  // Quotes in tags (e.g. <a href) should be escaped by \'  !!!
  // Untagged IMAGES should NOT be quoted !!!
  var re = /:::(.+?):::/mg;
  var a;
  var img_re = /^(.+?\.(gif|jpe?g|png))$/;
  while( a = re.exec(x))
  {
    a[1] = a[1].replace(img_re, "'<img src=\\'$1\\' alt=\\'missing $1\\' />'");
    a[1] = a[1].replace(/"/gm, "'");

    var repl =

  " onmouseover=\"ddrivetip("+a[1]+");\"  onmouseout=\"hideddrivetip();\"";
    x = x.replace(a[0], repl);
  }

  x = x.replace(/\[\[(https?:\/\/[\S]+)\s+([^\]]+)\]\]/mg, '<a href="$1" target="_wiki">$2<\/a>');
  x = x.replace(/\[\[(www\.\S+)\s+([^\]]+)\]\]/mg, '<a href="http://$1" target="_wiki">$2<\/a>');
  x = x.replace(/\[\[([a-z][a-z]):([\S]+)\s+([^\]]+)\]\]/mg, '<a href="http://$1.wikipedia.org/wiki/$2" target="_wiki">$3<\/a>');

  // replace spaces generating >onmouseover outside <A...> tag
  x = x.replace(/>(onmouseover.+?onmouseout="hideddrivetip\(\);")/gm, "$1>");;

  if (x != id)
  document.getElementById(id).innerHTML = x;
  return x;
}

//Show or Hide a Table when a link is clicked.
function showhidetable(theTable, on)
{
if (on == -1) on = (document.getElementById(theTable).style.display == 'none');
if (on)
  {
  document.getElementById(theTable).style.display = 'block';
  }
  else
  {
  document.getElementById(theTable).style.display = 'none';
  }
}

