//AutoBackgroundChange script - for this site only
 var xxx = 2;
 var automat = true;
window.onload =  Start();
function Start()
{
    SetXxx(2);
    PreloadImages();
    DoAfterSomeTime();
}

function SetXxx(y)
{
    xxx = y;
}

function VypniZmeny()
{
   automat = false;
}
function ZapniZmeny()
{
   automat = true;
   
}

//Zachvili vymen obrazek
function DoAfterSomeTime() {
    setTimeout(ImageChange, 5000);
};

//Zmena obrazku

function ImageChange () {
if (automat) {
    if (xxx > 9) {
        xxx = 1;
    }

  ZmenObrazek(xxx++);
        
 }   
    DoAfterSomeTime();
}

function Zpruhledni(x)
{
    document.getElementById('header').style.opacity=x;
    document.getElementById('header').style.MozOpacity=x;
    document.getElementById('header').style.filter.alpha=x*100;
    //document.getElementById('header').style.filters.alpha.opacity=50;
    document.getElementById('header').filter = "alpha(opacity=" + x + ")";


}

function PreloadImages() {
    if (document.images)
    {
        preload_image_object = new Image();
        // set image url
        images = new Array();
        for (i = 1; i < 10; i++) {
            images[i-1] = new Image();
            images[i-1].src = 'images/theme/0' + i + '.gif';
        }
    }
}

function ZmenObrazek(x)
{
    var xz = 25;
    setTimeout(function() { Zpruhledni(0.90);}, xz);
   setTimeout(function() { Zpruhledni(0.80);}, xz*2);  
   setTimeout(function() { Zpruhledni(0.70);}, xz*3);
   setTimeout(function() { Zpruhledni(0.60);}, xz*4);  
   setTimeout(function() { Zpruhledni(0.50);}, xz*5);
   setTimeout(function() { Zpruhledni(0.40);}, xz*6);
   setTimeout(function() { Zpruhledni(0.30);}, xz*7);
   setTimeout(function() { Zpruhledni(0.20);}, xz*8);
   setTimeout(function() { Zpruhledni(0.10);}, xz*9);  
   setTimeout(function() { document.getElementById('header').style.background='url(images/theme/0' + x + '.gif) no-repeat';Zpruhledni(0.01);}, xz*10);
   setTimeout(function() { Zpruhledni(0.10);}, xz*11);
   setTimeout(function() { Zpruhledni(0.20);}, xz*12);
   setTimeout(function() { Zpruhledni(0.30);}, xz*13);
   setTimeout(function() { Zpruhledni(0.40);}, xz*14);
   setTimeout(function() { Zpruhledni(0.50);}, xz*15);
   setTimeout(function() { Zpruhledni(0.60);}, xz*16);
   setTimeout(function() { Zpruhledni(0.70);}, xz*17);
   setTimeout(function() { Zpruhledni(0.80);}, xz*19);
   setTimeout(function() { Zpruhledni(0.90);}, xz*20);
   setTimeout(function() { Zpruhledni(1);}, xz*21);

}

function VyberObrazek(cislo)
{
VypniZmeny();
ZmenObrazek(cislo);
setTimeout(function() { ZapniZmeny();}, 15000);
xxx = cislo+1;

}


