/************************************************************************
 * A 'bannerszam' változó a mutatandó bannerek számát adja meg!         *
 * Ha ez a szám változik, akkor a default.aspx oldalon a bannerek alatt *
 * megjelenő gombok számát is változtatni kell!                         *
 ************************************************************************
*/
var bannerszam = 5

var choosead = Math.floor(Math.random() * bannerszam-1) + 1;
var t = null;

// A bannerek közti idő
var idozites = 10000;

function GotoX(which) {
}

function ChangeLayer(which) {
        window.clearInterval(t)
    if (which == 'prev' || which == 'next') {
        //window.status = which + ' ? ' + choosead;
        if (which == 'prev') {
            choosead--;
            if (choosead < 1) {
                choosead = bannerszam;
            }
        }
        if (which == 'next') {
            choosead++;
            if (bannerszam < choosead) {
                choosead = 1;
            }
        }
        which = choosead;
    }
    var x1 = document.getElementById("advertise1")
    var x2 = document.getElementById("advertise2")
    var x3 = document.getElementById("advertise3")
    var x4 = document.getElementById("advertise4")
    var x5 = document.getElementById("advertise5")
    var x6 = document.getElementById("advertise6")
    if (which == 1) {
        choosead = which;
        x1.style.display = '';
        x2.style.display = 'none';
        x3.style.display = 'none';
        x4.style.display = 'none';
        x5.style.display = 'none';
        x6.style.display = 'none';
        t = window.setInterval("mytimer()", idozites);
    }
    else if (which == 2) {
        choosead = which;
        x1.style.display = 'none';
        x2.style.display = '';
        x3.style.display = 'none';
        x4.style.display = 'none';
        x5.style.display = 'none';
        x6.style.display = 'none';
        t = window.setInterval("mytimer()", idozites);
    }
    else if (which == 3) {
        choosead = which;
        x1.style.display = 'none';
        x2.style.display = 'none';
        x3.style.display = '';
        x4.style.display = 'none';
        x5.style.display = 'none';
        x6.style.display = 'none';
        t = window.setInterval("mytimer()", idozites);
    }
    else if (which == 4) {
        choosead = which;
        x1.style.display = 'none';
        x2.style.display = 'none';
        x3.style.display = 'none';
        x4.style.display = '';
        x5.style.display = 'none';
        x6.style.display = 'none';
        t = window.setInterval("mytimer()", idozites);
    }
    else if (which == 5) {
        choosead = which;
        x1.style.display = 'none';
        x2.style.display = 'none';
        x3.style.display = 'none';
        x4.style.display = 'none';
        x5.style.display = '';
        x6.style.display = 'none';
        t = window.setInterval("mytimer()", idozites);
    }
    else if (which == 6) {
        choosead = which;
        x1.style.display = 'none';
        x2.style.display = 'none';
        x3.style.display = 'none';
        x4.style.display = 'none';
        x5.style.display = 'none';
        x6.style.display = '';
        t = window.setInterval("mytimer()", idozites);
    }
}

function mytimer() {
    //alert('Szasztok skaccok');
    choosead = choosead + 1;
/*
*/
    if (choosead > bannerszam) {
        choosead = 1;
    }
    ChangeLayer(choosead);
//   if (t != null) {
//        window.clearInterval(t);
//    }
//    if (t == null) {
//       t = window.setInterval("mytimer()", 5000);
//    }
}