function ververs()
{
  f = document.frmVertaal
  location.href = 'http://' + location.hostname + location.pathname + '?bronTaal=' + f.bronTaal.value + '&doelTaal=' + f.doelTaal.value +  '&prec=' + (f.prec[0].checked ? 1 : 0) + '&teVertalen=' + f.teVertalen.value + '&gebrTaal=' + f.gebrTaal.value
  s = document.getElementById('browsedict').href
  s = s.replace(/nTaal=.../, 'nTaal=' + f.bronTaal.value)
  s = s.replace(/lTaal=.../, 'lTaal=' + f.doelTaal.value)
}

function showKeyboards(txt2, txt3, txt4, txt5, txt6, gebrTaal)
{
  var windowParams
  document.write('<table bgcolor="#bdb76b" cellpadding="5"')
  document.write('<tr>')
  document.write('<th colspan="5">' + txt2 + '</th>')
  document.write('</tr>')
  document.write('<tr>')
  document.write('<td>');
  windowParams = "'lat_kb.html?" + gebrTaal + "', 'VKeyboardL', 'toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=550,height=300'"
  document.write('<input type="button" value="' + txt3 + '" onclick="window.open(' + windowParams + ')">')
  document.write('</td>')
  document.write('<td>')
  windowParams = "'cyr_kb.html?" + gebrTaal + "', 'VKeyboardC', 'toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=550,height=320'"
  document.write('<input type="button" value="' + txt4 + '" onclick="window.open(' + windowParams + ')">')
  document.write('</td>')
  document.write('<td>')
  windowParams = "'grk_kb.html?" + gebrTaal + "', 'VKeyboardG', 'toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=550,height=300'"
  document.write('<input type="button" value="' + txt5 + '" onclick="window.open(' + windowParams + ')">')
  document.write('</td>')
  document.write('<td>')
  windowParams = "'tai_kb.html?" + gebrTaal + "', 'VKeyboardT', 'toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=550,height=320'"
  document.write('<input type="button" value="' + txt6 + '" onclick="window.open(' + windowParams + ')">')
  document.write('</td>')
  document.write('</tr>');
  document.write('</table>')
}

function setLangs(comb)
{
  document.frmVertaal.bronTaal.value = comb.value.substring(0, 3).toLowerCase()
  document.frmVertaal.doelTaal.value = comb.value.substring(4, 7).toLowerCase()
  ververs()
}

function assignLangs(frmVertaal, frmSnelKiezen, selCombNr)
{
  var nextDate = new Date()
  nextDate.setDate(nextDate.getDate() + 7)
  bronTaal = frmVertaal.bronTaal.value.toUpperCase()
  doelTaal = frmVertaal.doelTaal.value.toUpperCase()
  frmSnelKiezen.elements[selCombNr].value = bronTaal + '-' + doelTaal
  var allCookies = document.cookie
  var pos = allCookies.indexOf('snlK=')
  var start = pos + 5
  var end = allCookies.indexOf(';', start)
  if (end == -1)
    end = allCookies.length
  var value = allCookies.substring(start, end)
  start = 0
  var newCookieVal = ''
  for (i = 0; i < 6; i++)
  {
    end = value.indexOf('0', start)
    if (end == -1)
      end = value.length
    var taalComb = value.substring(start, end)
    start = end + 1
    if (i != selCombNr)
      newCookieVal = newCookieVal + taalComb + '0'
    else
      newCookieVal = newCookieVal + bronTaal + '-' + doelTaal + '0'
  }
  document.cookie = 'snlK=' + newCookieVal.substring(0, newCookieVal.length - 1) + '; expires=' + nextDate.toGMTString(); 
}

function showPreSelect(s1, s2, s3, s4, s5, s6, tekst)
{
  document.write('<form name="frmSnelKiezen">')
  document.write('<fieldset>')
  document.write('<legend>' + tekst + '</legend>');
  document.write('<table cellpadding="5">')
  document.write('<tr>')
  document.write('<td><input type="button" value="' + s1 +'" name="s1" onclick="setLangs(s1)" class="fix"></td>')
  document.write('<td><input type="button" value="' + s2 +'" name="s2" onclick="setLangs(s2)" class="fix"></td>')
  document.write('<td><input type="button" value="' + s3 +'" name="s3" onclick="setLangs(s3)" class="fix"></td>')
  document.write('<td><input type="button" value="' + s4 +'" name="s4" onclick="setLangs(s4)" class="fix"></td>')
  document.write('<td><input type="button" value="' + s5 +'" name="s5" onclick="setLangs(s5)" class="fix"></td>')
  document.write('<td><input type="button" value="' + s6 +'" name="s6" onclick="setLangs(s6)" class="fix"></td>')
  document.write('</tr>')
  document.write('</table>')
  document.write('</fieldset>')
  document.write('</form>')
}

function showStoreComb(tekst)
{
  document.write('<fieldset>')
  document.write('<legend>' + tekst + '</legend>')
  document.write('<table cellpadding="5">')
  document.write('<tr>')
  document.write('<td>')
  document.write('<input type="button" name="selComb" style="width: 3em" value="1" onclick="assignLangs(frmVertaal, frmSnelKiezen, this.value)"> ')
  document.write('<input type="button" name="selComb" style="width: 3em" value="2" onclick="assignLangs(frmVertaal, frmSnelKiezen, this.value)"> ')
  document.write('<input type="button" name="selComb" style="width: 3em" value="3" onclick="assignLangs(frmVertaal, frmSnelKiezen, this.value)"> ')
  document.write('<input type="button" name="selComb" style="width: 3em" value="4" onclick="assignLangs(frmVertaal, frmSnelKiezen, this.value)"> ')
  document.write('<input type="button" name="selComb" style="width: 3em" value="5" onclick="assignLangs(frmVertaal, frmSnelKiezen, this.value)"> ')
  document.write('<input type="button" name="selComb" style="width: 3em" value="6" onclick="assignLangs(frmVertaal, frmSnelKiezen, this.value)"> ')
  document.write('</td>')
  document.write('</tr>')
  document.write('</table>')
  document.write('</fieldset>')
}

function terug(tekst)
{
  if (navigator.appName.indexOf("Microsoft") == -1)
    document.write('<a href="" onclick="back(); return false">' + tekst + '</a>')
}
