function createUnit(e) {
debug(this)
debug(e)
// display modal
var modal = document.getElementById('modifyOrderModal')
modal.classList.toggle('visible')
// block out rest of window to prevent clicking
// add new unit
var createUnit = document.getElementById('createUnit')
createUnit.addEventListener('click', function(event) {
// get unit type from select list
var u = document.getElementById('unitSelect')
var unit = u.options[u.selectedIndex].text
// get province from select list
var p = document.getElementById('provinceSelect')
var province = p.options[p.selectedIndex].text
// verify that province is unoccupied (need to have a master list in Node.js or
// a call to the database for current game session)
// append item to table
var tbody = document.getElementById('orderTable').getElementsByTagName('tbody')[0];
var row = tbody.insertRow(tbody.rows.length)
// append items
row.insertCell(0).appendChild(document.createTextNode('#1'))
row.insertCell(1).appendChild(document.createTextNode(province))
row.insertCell(2).appendChild(document.createTextNode('dsafsd'))
// create the button and append it to cell
var btn = document.createElement('button')
var btn = document.createElement("BUTTON");
btn.innerHTML = 'M'
btn.onclick = function() {
alert('lol');
}
row.insertCell(3).appendChild(btn)
debug(btn)
// http://stackoverflow.com/questions/8650975/javascript-to-create-a-button-with-onclick
// http://toddmotto.com/attaching-event-handlers-to-dynamically-created-javascript-elements/
// broadcast to all connected players (Node.js)
// hide modal
modal.setAttribute('class', '')
debug(unit)
debug(province)
})
debug(modal)