function menutoggle(id)
{
 id = document.getElementById(id);

 if (id.style.display == 'block') { id.style.display = 'none'; }
 else { id.style.display = 'block'; }
}


// sets language

function setlang(lang)
{
 document.cookie = 'lang=' + lang + '; expires=Sat, 31 Dec 2099 23:59:59 UTC; path=/';
 window.location.reload();
}

function changelist(id)
{
 document.getElementById("omni").innerHTML = document.getElementById(id).innerHTML;
}

// checks contact forms

function checkanswer(s)
{
 var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;

 // anti-bot question
 if (document.getElementById('answer').value != first + second)
 {
  alert('You did not answer the anti-bot question correctly.');
  return false;
 }
 // checks for valid email address
 else if (pattern.test(document.getElementById('email').value) == false)
 {
  alert('You did not enter an email address.');
  return false;
 }
 // checks for a subject
 else if (document.getElementById('subject').value == '')
 {
  if (s == 'contact') { alert('You did not enter a subject.'); }
  else { alert('You did not enter a game name.'); }

  return false;
 }
 // checks for a message
 else if (document.getElementById('message').value.length < 50)
 {
  if (s == 'submit') { alert('You did not enter a long enough review. Please take the time to thoughtfully and thoroughly review this game. The more complete your review, the more likely that I will be able to use your review and add your game to the site.'); }
  else { alert('You did not enter a long enough message. Very short messages tend to be spam.'); }

  return false;
 }
 // checks to see if a bot filled in the invisible field
 else if (document.getElementById('fake').value != '') { return false; }
 else { return true; }
}
