document.onclick = function (e) {
var info = document.getElementById("buttom-purchase-info");
var but = document.getElementById("buttom-purchase");
var el = e ? e.target : window.event.srcElement;
switch (el) {
case but:
!info.className & (info.className = "active");
break;
case info:
break;
default:
info.className = "";
}
};
http://learn.javascript.ru/play/SPOkgb