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();
    }
    else if (obj.getName() == "btn_resetsync") 
    {
        window.closeWnd();
    }
    else if(obj.getName() == "btn_cancel")
    {
        window.closeWnd();
    }
}