Adv = function () {
    this.linkMax = 4;

    this.randomLinks = [
        ['/~june/ad/images/hks.gif', 'http://www.hks-power.co.jp/'],
        ['/~june/ad/images/trust.gif', 'http://www.trust-power.com/'],
        ['/~june/ad/images/nismo.gif', 'http://www.nismo.co.jp/']
    ];

    this.links = [
        ['/~june/ad/images/goo.gif', 'http://www.goo-net.com/'],
        ['/~june/ad/images/ad.gif', 'http://www.drift.jp/info/']
    ];
};

Adv.prototype = {
    setAdv : function() {
        for(var i = this.links.length; i < this.linkMax ; i++) {
            var j = Math.floor(Math.random() * this.randomLinks.length);
            this.links[i] = this.randomLinks[j];
            this.randomLinks.splice(j, 1);
        }

        var s = '';
        for(var i = 0 ; i < this.linkMax ; i++) {
            var j = Math.floor(Math.random() * this.links.length);
            s = s + '<p class="bannerSub">';
            s = s + '<a href="' + this.links[j][1] + '" target="_blank">';
            s = s + '<img src="' + this.links[j][0] + '" width="200" height="55" alt="" />';
            s = s + '</a></p>';

            this.links.splice(j, 1);
        }

        var banner = document.getElementById('banner')
        banner.innerHTML = s;
    }
};

