// Module to modify the fields of device name and mail address
// used in macupdate.html in lang(ja/en) directory

// get string of clicked field and insert edited string
function editstring(macAddress, strType, thisItem){

    newStr = prompt("Edit "+strType, thisItem.innerHTML);
    if (newStr != null){
        thisItem.innerHTML=newStr;
        insertHiddenInput(macAddress, strType+" "+newStr);
    }
}

// insert hidden input field for saving the edited string
// this string is sent at clicking the submit button
function insertHiddenInput(hname, hvalue){

    var parent, hiddenInput;
    parent = document.getElementById('hidden');
    hiddenInput = document.createElement('input');
    hiddenInput.type = 'hidden';
    hiddenInput.name = hname;
    hiddenInput.value = hvalue;
    parent.appendChild(hiddenInput);
}
