
function calculator(order_price) {
    var parts = Array.from(document.getElementsByClassName("vhost_parts"));
    parts.forEach(function(part) { //loop
        //console.log(part);
        order_price += parseInt((part.getAttribute('cost') - part.getAttribute('sale')) * part.options[part.selectedIndex].value);
        document.getElementById('price').value = order_price;
        document.getElementById('order_price').textContent = new Intl.NumberFormat().format(order_price);
    });
    var current = document.getElementById('paymentday');
    if (!current.selectedIndex) {
        alert("결제일을 선택해주세요");
        current.focus();
        return false
    }
}
function addDevice(category, key, label) {
    var categoryBox = document.getElementById(category + "Box");
    var div = document.createElement("div");
    var checkbox = document.createElement("input");
    checkbox.setAttribute("type", "checkbox");
    checkbox.setAttribute("name", category + '[]');
    checkbox.setAttribute("value", key);
    checkbox.setAttribute("checked", true);
    checkbox.setAttribute("class", 'device');
    div.appendChild(checkbox);
    div.appendChild(document.createTextNode(label));
    // console.log(div);
    categoryBox.appendChild(div);
}