var crssword = crssword || {};

crssword.lang = (function () {

  var switchLang = function (lang) {
    crssword.clues.unhighlightClue();
    highlightLangBtn(lang);
    crssword.clues.addDirectionTitleTxt(lang, puzzleData.options.axis);
    crssword.clues.displayClues(lang);
  };

  var highlightLangBtn = function (lang) {
    var btns = document.querySelectorAll("#languagesContainer input");
    for (var btn = 0; btn < btns.length; btn++) {
      var btnLang = btns[btn].id.split("btn").join("");
      if (btnLang === lang) {
        crssword.repeats.updateClass("add", btns[btn], "active");
      } else {
        crssword.repeats.updateClass("remove", btns[btn], "active");
      }
    }
  };

  return {
    switchLang: switchLang,
    highlightLangBtn: highlightLangBtn
  };
})();