// setting the option value of the entry selection list to 1
var formBox = document.getElementById("form-box");
var options = document.getElementsByTagName("select");
for (var i = 0; i < options.length; i++) {
    options[i].value = "1";
    options[i].style.display = "none";
    var label = document.querySelector("label[for=id_form-" + i + "-Entry]");
    label.style.display = "none";
}
//options.value="1";
// setting saved_successed position
var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
var height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
var savedSuccessedWindow = document.getElementById("successful-saved");
var savedSuccessedWindowWidth = 200;
savedSuccessedWindow.style["position"] = "fixed";
savedSuccessedWindow.style["top"] = "15px";
var savedSuccessedWindowLeft = width / 2 - savedSuccessedWindowWidth;
savedSuccessedWindow.style["left"] = savedSuccessedWindowLeft.toString() + "px";
savedSuccessedWindow.style["width"] = savedSuccessedWindowWidth.toString() + "px";
var closeSuccSaved = document.getElementById("close-successful-saved");
var SuccSaved = document.getElementById("successful-saved");
closeSuccSaved.addEventListener("click", function (e) {
    SuccSaved.style["display"] = "none";
});
var editBottonList = document.getElementsByClassName('entry-edit-button');
for (var i = 0; i < editBottonList.length; i++) {
    editBottonList[i].addEventListener("click", function (e) {
        console.log(123);
        var tgt = e.target;
        var bottonId = tgt.id;
        var entryEditRegexp = /entry-edit-(\d+)/;
        var IdNum = entryEditRegexp.exec(bottonId)[1];
        var inputBoxClassName = ".ent-mod-inp-" + IdNum; // ent-mod-inp = entry-modify-input
        var inputBoxList = document.querySelectorAll(inputBoxClassName);
        for (var j = 0; j < inputBoxList.length; j++) {
            inputBoxList[j].style['display'] = 'block';
        }
    }, false);
}
