var controller = { addWall: function() { var identifier = model.newIdentifierFor.wall; model.addWall(identifier, 0, 0, 0); view.addWall(identifier, 0, 0, 0); }, deleteWall: function(button) { var identifier = button.id.split('-').pop(); model.deleteWall(identifier); var target = button.parentNode; target.parentNode.removeChild(target); view.updateWallsSquare(); view.updateTotalSquareWithoutApertures(); view.updateTotalSquare(); view.updateHProfilesCount(); view.updateVinylPanelsCount(); view.updatePanelsFinishPlanksCount(); view.updateStartPlanksCount(); view.updateSiberianVinylPanelsCount(); }, addWindow: function() { var identifier = model.newIdentifierFor.window; model.addWindow(identifier, 0, 0, 0); view.addWindow(identifier, 0, 0, 0); }, deleteWindow: function(button) { var identifier = button.id.split('-').pop(); model.deleteWindow(identifier); var target = button.parentNode; target.parentNode.removeChild(target); view.updateWindowsFinishPlanksCount(); view.updateWindowsPlanksCount(); view.updateVinylPanelsCount(); view.updateSiberianVinylPanelsCount(); }, addDoor: function() { var identifier = model.newIdentifierFor.door; model.addDoor(identifier, 0, 0, 0); view.addDoor(identifier, 0, 0, 0); }, deleteDoor: function(button) { var identifier = button.id.split('-').pop(); model.deleteDoor(identifier); var target = button.parentNode; target.parentNode.removeChild(target); view.updateWideJProfilesCount(); view.updateVinylPanelsCount(); view.updateSiberianVinylPanelsCount(); }, addOuterCorner: function() { var identifier = model.newIdentifierFor.outerCorner; model.addOuterCorner(identifier, 0, 0); view.addOuterCorner(identifier, 0, 0); }, deleteOuterCorner: function(button) { var identifier = button.id.split('-').pop(); model.deleteOuterCorner(identifier); var target = button.parentNode; target.parentNode.removeChild(target); view.updateOuterCornersCount(); }, addInnerCorner: function() { var identifier = model.newIdentifierFor.innerCorner; model.addInnerCorner(identifier, 0, 0); view.addInnerCorner(identifier, 0, 0); }, deleteInnerCorner: function(button) { var identifier = button.id.split('-').pop(); model.deleteInnerCorner(identifier); var target = button.parentNode; target.parentNode.removeChild(target); view.updateInnerCornersCount(); }, addPediment: function() { var identifier = model.newIdentifierFor.pediment; model.addPediment(identifier, 0, 0, 0); view.addPediment(identifier, 0, 0, 0); }, deletePediment: function(button) { var identifier = button.id.split('-').pop(); model.deletePediment(identifier); var target = button.parentNode; target.parentNode.removeChild(target); view.updatePedimentsJProfilesCount(); view.updateCornicesJProfilesCount(); view.updatePanelsFinishPlanksCount(); view.updateVinylPanelsCount(); view.updateSiberianVinylPanelsCount(); }, addCornice: function() { var identifier = model.newIdentifierFor.cornice; model.addCornice(identifier, 0, 0, 0); view.addCornice(identifier, 0, 0, 0); }, deleteCornice: function(button) { var identifier = button.id.split('-').pop(); model.deleteCornice(identifier); var target = button.parentNode; target.parentNode.removeChild(target); view.updateCornicesJProfilesCount(); view.updateCornicesFinishPlanksCount(); view.updateJFacetCount(); view.updateSoffitsCount(); }, updateWallHeight: function(input) { var identifier = input.id.split('-').pop(); var value = parseFloat(input.value); if (model.walls[identifier].height !== value && typeof value === 'number') { model.walls[identifier].height = value; view.updateWallsSquare(); view.updateTotalSquareWithoutApertures(); view.updateTotalSquare(); view.updateHProfilesCount(); view.updateVinylPanelsCount(); } }, updateWallWidth: function(input) { var identifier = input.id.split('-').pop(); var value = parseFloat(input.value); if (model.walls[identifier].width !== value && typeof value === 'number') { model.walls[identifier].width = value; view.updateWallsSquare(); view.updateTotalSquareWithoutApertures(); view.updateTotalSquare(); view.updatePanelsFinishPlanksCount(); view.updateHProfilesCount(); view.updateStartPlanksCount(); view.updateVinylPanelsCount(); } }, updateWallCount: function(input) { var identifier = input.id.split('-').pop(); var value = parseFloat(input.value); if (model.walls[identifier].count !== value && typeof value === 'number') { model.walls[identifier].count = value; view.updateWallsSquare(); view.updateTotalSquareWithoutApertures(); view.updateTotalSquare(); view.updatePanelsFinishPlanksCount(); view.updateHProfilesCount(); view.updateStartPlanksCount(); view.updateVinylPanelsCount(); view.updateSiberianVinylPanelsCount(); } }, updateWindowHeight: function(input) { var identifier = input.id.split('-').pop(); var value = parseFloat(input.value); if (model.apertures.windows[identifier].height !== value && typeof value === 'number') { model.apertures.windows[identifier].height = value; view.updateWindowsFinishPlanksCount(); view.updateWindowsPlanksCount(); view.updateVinylPanelsCount(); view.updateSiberianVinylPanelsCount(); view.updateAperturesSquare(); view.updateTotalSquareWithoutApertures(); } }, updateWindowWidth: function(input) { var identifier = input.id.split('-').pop(); var value = parseFloat(input.value); if (model.apertures.windows[identifier].width !== value && typeof value === 'number') { model.apertures.windows[identifier].width = value; view.updateWindowsFinishPlanksCount(); view.updateWindowsPlanksCount(); view.updateVinylPanelsCount(); view.updateSiberianVinylPanelsCount(); view.updateAperturesSquare(); view.updateTotalSquareWithoutApertures(); } }, updateWindowCount: function(input) { var identifier = input.id.split('-').pop(); var value = parseFloat(input.value); if (model.apertures.windows[identifier].count !== value && typeof value === 'number') { model.apertures.windows[identifier].count = value; view.updateWindowsFinishPlanksCount(); view.updateWindowsPlanksCount(); view.updateVinylPanelsCount(); view.updateSiberianVinylPanelsCount(); view.updateAperturesSquare(); view.updateTotalSquareWithoutApertures(); } }, updateDoorHeight: function(input) { var identifier = input.id.split('-').pop(); var value = parseFloat(input.value); if (model.apertures.doors[identifier].height !== value && typeof value === 'number') { model.apertures.doors[identifier].height = value; view.updateWideJProfilesCount(); view.updateVinylPanelsCount(); view.updateSiberianVinylPanelsCount(); view.updateAperturesSquare(); view.updateTotalSquareWithoutApertures(); } }, updateDoorWidth: function(input) { var identifier = input.id.split('-').pop(); var value = parseFloat(input.value); if (model.apertures.doors[identifier].width !== value && typeof value === 'number') { model.apertures.doors[identifier].width = value; view.updateWideJProfilesCount(); view.updateVinylPanelsCount(); view.updateSiberianVinylPanelsCount(); view.updateAperturesSquare(); view.updateTotalSquareWithoutApertures(); } }, updateDoorCount: function(input) { var identifier = input.id.split('-').pop(); var value = parseFloat(input.value); if (model.apertures.doors[identifier].count !== value && typeof value === 'number') { model.apertures.doors[identifier].count = value; view.updateWideJProfilesCount(); view.updateVinylPanelsCount(); view.updateSiberianVinylPanelsCount(); view.updateAperturesSquare(); view.updateTotalSquareWithoutApertures(); } }, updateOuterCornerHeight: function(input) { var identifier = input.id.split('-').pop(); var value = parseFloat(input.value); if (model.corners.outer[identifier].height !== value && typeof value === 'number') { model.corners.outer[identifier].height = value; view.updateOuterCornersCount(); } }, updateOuterCornerCount: function(input) { var identifier = input.id.split('-').pop(); var value = parseFloat(input.value); if (model.corners.outer[identifier].count !== value && typeof value === 'number') { model.corners.outer[identifier].count = value; view.updateOuterCornersCount(); } }, updateInnerCornerHeight: function(input) { var identifier = input.id.split('-').pop(); var value = parseFloat(input.value); if (model.corners.inner[identifier].height !== value && typeof value === 'number') { model.corners.inner[identifier].height = value; view.updateInnerCornersCount(); } }, updateInnerCornerCount: function(input) { var identifier = input.id.split('-').pop(); var value = parseFloat(input.value); if (model.corners.inner[identifier].count !== value && typeof value === 'number') { model.corners.inner[identifier].count = value; view.updateInnerCornersCount(); } }, updatePedimentHeight: function(input) { var identifier = input.id.split('-').pop(); var value = parseFloat(input.value); if (model.pediments[identifier].height !== value && typeof value === 'number') { model.pediments[identifier].height = value; view.updatePedimentsJProfilesCount(); view.updateCornicesJProfilesCount(); view.updateVinylPanelsCount(); view.updateSiberianVinylPanelsCount(); view.updatePedimentsSquare(); view.updateTotalSquare(); view.updateTotalSquareWithoutApertures(); } }, updatePedimentWidth: function(input) { var identifier = input.id.split('-').pop(); var value = parseFloat(input.value); if (model.pediments[identifier].width !== value && typeof value === 'number') { model.pediments[identifier].width = value; view.updatePedimentsJProfilesCount(); view.updateCornicesJProfilesCount(); view.updatePanelsFinishPlanksCount(); view.updateVinylPanelsCount(); view.updateSiberianVinylPanelsCount(); view.updatePedimentsSquare(); view.updateTotalSquare(); view.updateTotalSquareWithoutApertures(); } }, updatePedimentCount: function(input) { var identifier = input.id.split('-').pop(); var value = parseFloat(input.value); if (model.pediments[identifier].count !== value && typeof value === 'number') { model.pediments[identifier].count = value; view.updatePedimentsJProfilesCount(); view.updateCornicesJProfilesCount(); view.updatePanelsFinishPlanksCount(); view.updateVinylPanelsCount(); view.updateSiberianVinylPanelsCount(); view.updatePedimentsSquare(); view.updateTotalSquare(); view.updateTotalSquareWithoutApertures(); } }, updateCorniceLength: function(input) { var identifier = input.id.split('-').pop(); var value = parseFloat(input.value); if (model.cornices[identifier].length !== value && typeof value === 'number') { model.cornices[identifier].length = value; view.updateCornicesJProfilesCount(); view.updateCornicesFinishPlanksCount(); view.updateJFacetCount(); view.updateSoffitsCount(); view.updateCornicesSquare(); } }, updateCorniceWidth: function(input) { var identifier = input.id.split('-').pop(); var value = parseFloat(input.value); if (model.cornices[identifier].width !== value && typeof value === 'number') { model.cornices[identifier].width = value; view.updateSoffitsCount(); view.updateCornicesSquare(); } }, updateCorniceCount: function(input) { var identifier = input.id.split('-').pop(); var value = parseFloat(input.value); if (model.cornices[identifier].count !== value && typeof value === 'number') { model.cornices[identifier].count = value; view.updateCornicesJProfilesCount(); view.updateCornicesFinishPlanksCount(); view.updateJFacetCount(); view.updateSoffitsCount(); view.updateCornicesSquare(); } } };