// JavaScript Document var IeAlpha; var IsRuning; var FadeIn; //IeAlpha = 100; function FadeImage(e, picarr2) { var nextpic, prevpic, posofpic; var avskaladURL = document.getElementById('bild').src; if(IsRuning != 1) { if(document.getElementById('bild').src.substring(avskaladURL.length-e.length, avskaladURL.length) != e) { IsRuning = 1; document.getElementById('bild').style.opacity = "1"; t=setInterval("fade('"+e+"')", 10); } posofpic = picarr2.ArrayPlats(e); if (posofpic >= picarr2.length - 1) { nextpic = 0; } else { nextpic = posofpic + 1; } if (posofpic <= 0) { prevpic = picarr2.length - 1; } else { prevpic = posofpic - 1; } document.getElementById('piclink_back').href = "javascript:FadeImage('" + picarr2[prevpic][0] + "', picarr);changeText('imgtext','" + picarr2[prevpic][1] + "');"; document.getElementById('piclink_forw').href = "javascript:FadeImage('" + picarr2[nextpic][0] + "', picarr);changeText('imgtext','" + picarr2[nextpic][1] + "');"; } } Array.prototype.ArrayPlats=function(o){ for(var i=0;i < this.length; i++) { if(this[i][0]==o) { return i; } } return -1; } function fade(e) { if (FadeIn != 1) { IeAlpha-=10; document.getElementById('bild').style.filter = "alpha(opacity=" + IeAlpha + ")"; currentAlpha = parseFloat(document.getElementById('bild').style.opacity); document.getElementById('bild').style.opacity = currentAlpha-0.1; } else { IeAlpha+=10; document.getElementById('bild').style.filter = "alpha(opacity=" + IeAlpha + ")"; currentAlpha = parseFloat(document.getElementById('bild').style.opacity); document.getElementById('bild').style.opacity = currentAlpha+0.1; if (parseFloat(document.getElementById('bild').style.opacity) == 1) { FadeIn = 0; clearInterval(t); IsRuning = 0; } if(IeAlpha == 100) { FadeIn = 0; clearInterval(t); IsRuning = 0; } } if (parseFloat(document.getElementById('bild').style.opacity) == 0) { document.getElementById('bild').src = e; FadeIn = 1; } if (IeAlpha == 0) { document.getElementById('bild').src = e; FadeIn = 1; } } function changeText(id, text){ document.getElementById(id).innerHTML = text; }