﻿function menu_btn (nr, id) {
    this.nr               = nr;
    this.btn              = $(id);
    this.id               = id;
    this.content_box      = $("content" + this.nr);
    this.activation       = function () {
        var item;
        var nr             = parseInt(this.id.match(/[\d]+$/));
        var buttons_length = buttons.length
        
        for (item = 0; item < buttons_length; ++item ) {
            buttons[item].deactivation();
        }

        buttons[nr].content_box.className += " active";
        buttons[nr].btn.className         += " active";
    }
    this.deactivation     = function () {
        var nr = parseInt(this.id.match(/[\d]+$/));
        if (buttons[nr].content_box.className.indexOf("active") > -1) {
            buttons[nr].content_box.className = buttons[nr].content_box.className.replace(/\s*active\s*/, "");
        }
        if (buttons[nr].btn.className.indexOf("active") > -1) {
            buttons[nr].btn.className = buttons[nr].btn.className.replace(/\s*active\s*/, "");
        }
    }
    this.btn.onmouseover = function () {
        var nr = parseInt(this.id.match(/[\d]+$/));
        Timer  = setTimeout("buttons[" + nr + "].activation()", TIME_DELAY);
    }
    this.btn.onmouseout   = function () {
        clearInterval(Timer);
    }
}
function link_on_box () {
    var item, nr, link;
    var content = $("most_visible_banner").getElementsByTagName('div');
    var item2 = content.length;
    for (item = 0; item < item2; ++item) {
        if (content[item].id.indexOf("offerItem") == 0) {
            link = $("offerLink" + content[item].id.match(/[\d]+$/));
            if (link) {
                content[item].onclick    = function () {location.href = $("offerLink" + this.id.match(/[\d]+$/)).href;}
                content[item].className += " pointer";
            }
        }
    }
}
