var F = function(id) {
    this.element = document.getElementById(id);
};
F.prototype.hide = function() {
    this.element.style.display = "none";
};

document.getElementById("button").onclick = function() {
    new F("image1").hide();
    new F("image2").hide();	
};