document.getElementsByClassName = function(cl) {
    var retnode = [];
    var myclass = new RegExp('\\b'+cl+'\\b');
    var elem = this.getElementsByTagName('*');
    for (var i = 0; i < elem.length; i++) {
    var classes = elem[i].className;
    if (myclass.test(classes)) retnode.push(elem[i]);
    }
    return retnode;
};
function repositionAndResizePics() {
    var images = document.getElementsByClassName("img_start_aktion");
    for (var i = 0; i < images.length; i++) {
        var differenceWidth = images[i].offsetWidth - 135;
        if (differenceWidth > 0) {
            images[i].width = "135";
        }
        var differenceHeight = images[i].offsetHeight - 105;
        if (differenceHeight > 0) {
            images[i].removeAttribute("width");
            images[i].height = "105";
        }
        var left = (135 - images[i].offsetWidth) / 2;
        var top = (105 - images[i].offsetHeight) / 2;
        images[i].style.left = left + "px";
        images[i].style.top = top + "px";
        images[i].style.visibility = "visible";
    }
    images = document.getElementsByClassName("img_start_produkt");
    for (i = 0; i < images.length; i++) {
        differenceWidth = images[i].offsetWidth - 140;
        if (differenceWidth > 0) {
            images[i].width = "140";
        }
        differenceHeight = images[i].offsetHeight - 105;
        if (differenceHeight > 0) {
            images[i].removeAttribute("width");
            images[i].height = "105";
        }
        left = (140 - images[i].offsetWidth) / 2;
        top = (105 - images[i].offsetHeight) / 2;
        images[i].style.left = left + "px";
        images[i].style.top = top + "px";
        images[i].style.visibility = "visible";
    }
    images = document.getElementsByClassName("img_aktion");
    for (i = 0; i < images.length; i++) {
        differenceWidth = images[i].offsetWidth - 135;
        if (differenceWidth > 0) {
            images[i].width = "135";
        }
        differenceHeight = images[i].offsetHeight - 105;
        if (differenceHeight > 0) {
            images[i].removeAttribute("width");
            images[i].height = "105";
        }
        left = (135 - images[i].offsetWidth) / 2;
        top = (105 - images[i].offsetHeight) / 2;
        images[i].style.left = left + "px";
        images[i].style.top = top + "px";
        images[i].style.visibility = "visible";
    }
    images = document.getElementsByClassName("img_produkt");
    for (i = 0; i < images.length; i++) {
        differenceWidth = images[i].offsetWidth - 140;
        if (differenceWidth > 0) {
            images[i].width = "140";
        }
        differenceHeight = images[i].offsetHeight - 105;
        if (differenceHeight > 0) {
            images[i].removeAttribute("width");
            images[i].height = "105";
        }
        left = (140 - images[i].offsetWidth) / 2;
        top = (105 - images[i].offsetHeight) / 2;
        images[i].style.left = left + "px";
        images[i].style.top = top + "px";
        images[i].style.visibility = "visible";
    }
    images = document.getElementsByClassName("img_shop");
    for (i = 0; i < images.length; i++) {
        differenceWidth = images[i].offsetWidth - 140;
        if (differenceWidth > 0) {
            images[i].width = "140";
        }
        differenceHeight = images[i].offsetHeight - 85;
        if (differenceHeight > 0) {
            images[i].removeAttribute("width");
            images[i].height = "85";
        }
        left = (140 - images[i].offsetWidth) / 2;
        top = (85 - images[i].offsetHeight) / 2;
        images[i].style.left = left + "px";
        images[i].style.top = top + "px";
        images[i].style.visibility = "visible";
    }
}
