Rdata = new Array();

Rdata[1] = {
    image:'http://altomare.com.ua/banners/b1.jpg',
    href: '/виды_отдыха/яхтинг/'
    }

Rdata[2] = {
    image:'http://altomare.com.ua/banners/b2.jpg',
    href: '/виды_отдыха/морские_круизы/'
    }

Rdata[3] = {
    image:'http://altomare.com.ua/banners/b3.jpg',
    href: '/виды_отдыха/экзотические_туры/'
    }

Rdata[4] = {
    image:'http://altomare.com.ua/banners/b4.jpg',
    href: '/%D0%B2%D0%B8%D0%B4%D1%8B_%D0%BE%D1%82%D0%B4%D1%8B%D1%85%D0%B0/%D1%8F%D1%85%D1%82%D0%B8%D0%BD%D0%B3/'
    }
Rdata[5] = {
    image:'http://altomare.com.ua/banners/b5.jpg',
    href: '/путешествия/Коллекция_туров_в_ИЗРАИЛЬ_/'
    }

Rotator = {
}

Rotator.autofire = function() {
    var x = Math.floor(Math.random() * 5  +1);
    Rotator.fire(x);
}

Rotator.fire = function (x) {
    Rotator.current = x;
    Rotator.main = document.getElementById('main-banner-image');
    Rotator.next = document.getElementById('next-banner-image');
    Rotator.next.className = 'banner-c0';
    Rotator.next.src = Rdata[x].image;
    Rotator.state = 0;
    Rotator.tfunc();
}

Rotator.stopAndFire = function(x) {
    clearInterval(Rotator.interval);
    Rotator.fire(x);
}

Rotator.click = function () {
    location.href = Rdata[Rotator.current].href;
}

Rotator.tfunc = function () {
    Rotator.state++;
//    alert(Rotator.state);
    if(Rotator.state < 6) {
	Rotator.next.className = 'banner-c' + Rotator.state;
	setTimeout('Rotator.tfunc()', 200);
    }
    if(Rotator.state == 6) {
	Rotator.main.src = Rotator.next.src;
	Rotator.next.className = 'banner-c0';
    }
}
