
function fv() {
  if (document.getElementById) {
    f = document.getElementById("feedback");
    f.style.display = (f.style.display == "none" || f.style.display == "") ? "block" : "none";
    fs.style.display = f.style.display == "none" ? "block" : "none";
  }
}

function fc(form, message, text, name) {
  if (form.Text.value.length < 5) {alert(message + " <" + text + ">."); return false;}
  if (form.Name.value.length < 1) {alert(message + " <" + name + ">."); return false;}
  return true;
}

function feedback(locale, action, button, subject, page) {
  var f = [];
  if (locale) {
    f[0] = button ? "Questions?.. Comments?" : "Comments?..";
    f[1] = "You can leave your message, query, or comment:";
    f[2] = "Your name"; f[3] = "E-mail";
    f[4] = "Message"; f[5] = "Public"; f[6] = "Private";
    f[7] = "Topic"; f[8] = "Text";
    f[9] = "Submit!"; f[10] = "Cancel";
    f[11] = "Before sending the message, please fill in the field";
  } else {
    f[0] = button ? "Комментарии?.. Вопросы?" : "Комментарии?..";
    f[1] = "Вы можете оставить свое сообщение, вопрос, или отзыв:";
    f[2] = "Ваше имя"; f[3] = "E-mail";
    f[4] = "Сообщение"; f[5] = "Публичное"; f[6] = "Частное";
    f[7] = "Тема"; f[8] = "Текст";
    f[9] = "Отправить!"; f[10] =  "Отмена";
    f[11] = "Перед отправкой сообщения, пожалуйста, заполните поле";
  };
  document.write(
    '<p id = "fs"><input onclick = "javascript:fv();" type = "button" value = "&#160;' + f[0] + '&#160;"/></p>' +
    '<p><div id = "feedback"><form action = "' + action +
    '" method = "post" onsubmit = "return fc(this, \'' + f[11] + '\', \'' + f[8] + '\', \'' + f[2] + '\');">' +
    '<p>' + f[1] + '</p><input type = "hidden" name = "Page" value = "' + page + '"/>'
   );
  document.write(
    '<p><table><tr><td><b>' + f[2] + '</b></td><td><input name = "Name" size = "25"/></td></tr>' +
    '<tr><td>' + f[3] + '</td><td><input name = "Mail" size = "25"/></td></tr>' +
    '<tr><td>' + f[4] + '</td><td><select name = "Type"><option>' + f[5] + '</option><option>' + f[6] + '</option></select></td></tr>'
  );
  if (subject) document.write('<tr><td>' + f[7] + '</td><td>' + subject + '</td></tr>');
  document.write(
    '<tr><td><b>' + f[8] + '</b></td><td><textarea name = "Text" rows = "8" cols = "80" wrap = "hard"></textarea></td></tr></table></p>' +
    '<p><input type = "submit" value = "&#160;' + f[9] + '&#160;"/>&#160;' +
    '<input onclick = "javascript:fv();" type = "button" value = "&#160;' + f[10] + '&#160;"/></p>' +
    '</form></div></p>'
  );
}

function email(e) {
  document.write("<a href = mailto:" + e + "@moodbook.com>" + e + "@moodbook.com</a>");
}
