﻿function banner(imgSrc, imgWidth, imgHeight, imgAlt, href, type) {
    this.imgSrc = imgSrc;
    this.imgWidth = imgWidth;
    this.imgHeight = imgHeight;
    this.imgAlt = imgAlt;
    this.href = href;
    this.type = type;
}
banner.prototype = {
    imgSrc: null,
    imgWidth: null,
    imgHeight: null,
    imgAlt: null,
    href: null,
    type: null,
    show: function() {
        DD_sponsorType = document.getElementById('sponsorType');
        DD_sponsorImage = document.getElementById('sponsorImage');
        DD_sponsorType.innerHTML = this.type;
        DD_sponsorImage.innerHTML = '<a target="_blank" href="' + this.href + '"><img src="' + this.imgSrc + '" alt="' + this.imgAlt + '"  /></a>';
    }
};
function bannerRotator(bannersArray) {
    this.counter = 0;
    this.bannersArray = bannersArray;
    this.timeEachBannerWillBeShownInSeconds = 5;
};
bannerRotator.prototype = {
    counter: null,
    bannersArray: null,
    startRotation: function() {
        this.showNext();
        setInterval(function() { changeBannerAfterPause(bannerRotator) }, this.timeEachBannerWillBeShownInSeconds * 1000);
    },
    showNext: function() {
        if (this.counter >= this.bannersArray.length)
            this.counter = 0;
        this.bannersArray[this.counter].show();
        this.counter++;
    }
};
function changeBannerAfterPause(bannerRotator) { bannerRotator.showNext(); };

$(document).ready(function() {
    var banners = new Array();
//    banners.push(new banner('/userfiles/image/Intel_logo_site.jpg', null, null, 'Intel', 'http://www.intel.ru/', 'Платиновый спонсор'));
//    banners.push(new banner('/userfiles/image/logo_HP.jpg', null, null, 'HP', 'http://www.hp.ru/', 'Платиновый спонсор'));
//    banners.push(new banner('/userfiles/image/AMD_Brandmark_Tagline.jpg', null, null, 'Advanced Micro Devices, Inc.', 'http://www.amd.com/', 'Золотой спонсор'));
//    banners.push(new banner('/userfiles/image/Citrix_%D0%BB%D0%BE%D0%B3%D0%BE(2).jpg', null, null, 'Citrix Systems, Inc.', 'http://www.citrix.com/', 'Золотой спонсор'));
//    banners.push(new banner('/userfiles/image/sun_logo_cmyk.jpg', null, null, 'Sun Microsystems', 'http://www.sun.ru/', 'Золотой спонсор'));
//    banners.push(new banner('/userfiles/image/Logo_OLLY(1).jpg', null, null, 'ОЛЛИ', 'http://www.olly.ru/', 'Золотой спонсор'));
    //    banners.push(new banner('/userfiles/image/Logo_Kaspersky_site(1).jpg', null, null, 'Kaspersky', 'http://www.kaspersky.ru/', 'Золотой спонсор'));
    banners.push(new banner('/userfiles/image/logo_livejournal.jpg', null, null, 'LiveJournal.com', 'http://www.livejournal.com/', 'Золотой партнер'));
    banners.push(new banner('/userfiles/image/mail_logo.gif', null, null, 'Mail.Ru', 'http://mail.ru/', 'Золотой партнер'));
    banners.push(new banner('/userfiles/image/infobox_logo.gif', null, null, 'Infobox', 'http://infobox.ru/', 'Серебряный партнер'));
    banners.push(new banner('/userfiles/image/devexpress_logo.gif', null, null, 'DevExpress', 'http://www.devexpress.com/', 'Серебряный партнер'));
    banners.push(new banner('/userfiles/image/logo_galssoft.gif', null, null, 'ГАЛС Софт ', 'http://www.galssoft.ru/', 'Серебряный партнер'));

    banners.push(new banner('/userfiles/image/softkey_logo.gif', null, null, 'Softkey', 'http://softkey.ru/', 'Серебряный партнер'));
    banners.push(new banner('/userfiles/image/atilekt_cms.gif', null, null, 'Атилект', 'http://www.cms.atilekt.com/', 'Серебряный партнер'));
    //    banners.push(new banner('/userfiles/image/Acer_logo.jpg', null, null, 'Acer', 'http://www.acer.ru/', 'Серебряный спонсор'));
//    banners.push(new banner('/img/sponsors/WinEmbed.jpg', null, null, 'Windowsembedded', 'http://www.microsoft.com/windowsembedded/ru-ru/', 'Серебряный спонсор'));
//    banners.push(new banner('/userfiles/image/HTC_Blk(1).jpg', null, null, 'HTC Corporation', 'http://www.htc.com/ru/', 'Серебряный спонсор'));
//    banners.push(new banner('/userfiles/image/Logo-Russian.jpg', null, null, 'АйТи', 'http://www.it.ru/', 'Серебряный спонсор'));
//    banners.push(new banner('/userfiles/image/Intel_galaxy_logo.jpg', null, null, 'Intel ITGalaxy', 'http://www.intel.ru/ITGalaxy/', 'Спонсор'));
    bannerRotator = new bannerRotator(banners);
    bannerRotator.startRotation();
});