    perioud = 2000; // fading perioud
    steps= 15; // how many steps we need to fade
    delyTime = 5000; //waiting time between Pics
    timeout= perioud / steps;
    opacityAmmount = 1/steps;
    alphaAmmount = 100/steps;
    currentOpacity = 1;
    currentAlpha = 100;

    currentElem = 0;
    function changePic()
    {
        imageDisc = document.getElementById('toFadeDisc');
        image= document.getElementById("toFade");
        image.src=arrElem[currentElem];
        imageDisc.innerHTML = arrDisc[currentElem++];
        image.style.display="inline";
        if (currentElem >=arrElem.length )
            currentElem=0;
        
        fadeOut();
    }
    function fadeIn()
    {
        image= document.getElementById("toFade");
        imageDisc = document.getElementById('toFadeDisc');
        if (window.innerWidth!=undefined) // Means Not IE
        {
            currentOpacity -= opacityAmmount;
            image.style.opacity = currentOpacity;
            imageDisc.style.opacity = currentOpacity;
            if (image.style.opacity>0)
                setTimeout("fadeIn()",timeout);
            else 
                changePic();

        }
        else // IE
        {
            currentAlpha-=alphaAmmount;
            image.style.filter = "alpha(opacity="+currentAlpha+")";
			
            imageDisc.style.filter = "alpha(opacity="+currentAlpha+")";
            if (currentAlpha>0)
                setTimeout("fadeIn()",timeout);
            else 
                changePic();
        }
    }
    function fadeOut()
    {
        image= document.getElementById("toFade");
        imageDisc = document.getElementById('toFadeDisc');
        if (window.innerWidth!=undefined) // Means Not IE
        {
            currentOpacity += opacityAmmount;
            image.style.opacity = currentOpacity;
            imageDisc.style.opacity = currentOpacity;
            if (image.style.opacity<1)
                setTimeout("fadeOut()",timeout);
            else setTimeout("fadeIn()",delyTime);
        }
        else // IE
        {
            currentAlpha+=alphaAmmount;
            image.style.filter = "alpha(opacity="+currentAlpha+")";
            imageDisc.style.filter = "alpha(opacity="+currentAlpha+")";
            if (currentAlpha<100)
                setTimeout("fadeOut()",timeout);
            else setTimeout("fadeIn()",delyTime);
        }
    }
