// // // // // //GLOBAL VARIABLES var bildId = 1; var speed =7000; var speedEffectFactor = 35; var firstTime = true; var srcString; var srcLength; // // // function imageShowFadeIn(maxImages, speedCategory) { var bildElement1 = document.getElementById("showFadeInImage1"); var bildElement2 = document.getElementById("showFadeInImage2"); if (firstTime) { setSpeed(speedCategory); srcString = bildElement1.src; srcLength = srcString.length; firstTime = false; } var srcStringTeil1 = srcString.substring(0,srcLength-5); var srcStringTeil2 = srcString.substring(srcLength-4,srcLength); var newSrc1 = srcStringTeil1 + bildId + srcStringTeil2; bildId = bildId + 1; if (bildId > maxImages) { bildId = 1; } var newSrc2 = srcStringTeil1 + bildId + srcStringTeil2; bildElement1.src = newSrc1; bildElement2.src = newSrc2; setTimeout(function(){fadeIn("showFadeInImage2");},speed); setTimeout(function(){imageShowFadeIn(maxImages,speedCategory);},speed); } // // // function changeOpacity(elementId, initialOpacity, endOpacity, count) { var element = document.getElementById(elementId); var opacityLeap = endOpacity - initialOpacity; var opacityStep = opacityLeap / speedEffectFactor; var newOpacity = 0; if (initialOpacity <= endOpacity) { newOpacity = opacityStep*count; } else { newOpacity = initialOpacity + (opacityStep*count); } if (newOpacity<0) { setOpacity(element,0); if (element.timer) { clearTimeout(element.timer); } } else if (newOpacity>1) { setOpacity(element,1); if (element.timer) { clearTimeout(element.timer); } } else { count = count + 1; setOpacity(element,newOpacity); element.timer = setTimeout(function(){changeOpacity(elementId, initialOpacity, endOpacity, count);},speedEffectFactor); } } // // // function setOpacity(object,opacityPct) { object.style.filter = 'alpha(opacity=' + opacityPct*100 + ')'; object.style.MozOpacity = opacityPct; object.style.opacity = opacityPct; } // // // function fadeIn(elementId) { var element = document.getElementById(elementId); changeOpacity(elementId,0,1,1); } // // // // var element = document.getElementById(elementId); // changeOpacity(elementId,1,0,1); // // // function setSpeed(speedCategory) { if(speedCategory == 1) { speed = 3000; speedEffectFactor = 30; } else if(speedCategory == 3) { speed = 14000; speedEffectFactor = 100; } else if(speedCategory == 4) { speed = 8000; speedEffectFactor = 50; } }