var buttons = window.getElementsByClassName("ButtonUI");
for (var i = 0; i < buttons.length; i++) {
    buttons[i].OnClick = "OnClick";
}


function OnClick(obj) {
    if (obj.getName() == "closebtn") {
        window.closeWnd();
    }

}