counter=antal=siffra=28;
preloadLeft=new Image(250,500); 
preloadRight=new Image(250,500);
browser="Annan";

function Initiera(){ 
		Now=new Date();
		counter=Math.floor(Now.getTime()/32000)%(antal+1);
		counter--;
		WaitLadda=setTimeout("LaddaBild()", 6000);
		if(document.all && navigator.appName == "Microsoft Internet Explorer" && eval(navigator.appVersion.charAt(0)>=4)) { browser="MSIE"; }
	if(navigator.userAgent.indexOf("Firefox")>0){ browser="Firefox"; }
		document.getElementById("PhotoL2").src = document.getElementById("PhotoL").src;
		document.getElementById("PhotoR2").src = document.getElementById("PhotoR").src;
	return true;
}

function LaddaBild(){
	counter++; if(counter>antal){ counter=0; }
	WaitByta=setTimeout("BytBild()", 20000);
	preloadLeft.src="/paneler/left"+counter+".jpg";
	preloadRight.src="/paneler/right"+counter+".jpg";
	return true;
}

function BytBild(){
	WaitLadda=setTimeout("LaddaBild()", 10000);
	if(browser=="MSIE") {
		document.getElementById("PhotoL").filters[0].Apply();
		document.getElementById("PhotoL").filters[0].Play();
		document.getElementById("PhotoR").filters[0].Apply();
		document.getElementById("PhotoR").filters[0].Play();
		document.getElementById("PhotoL").src = ("paneler/left"+counter+".jpg");
		document.getElementById("PhotoR").src = ("paneler/right"+counter+".jpg");
	}
	if(browser=="Firefox") {
		document.getElementById("PhotoL2").src = ("paneler/left"+counter+".jpg");
		document.getElementById("PhotoR2").src = ("paneler/right"+counter+".jpg");
		KrympaBild();
	}
	if(browser=="Annan") {
		document.getElementById("PhotoL2").src = ("paneler/left"+counter+".jpg");
		document.getElementById("PhotoR2").src = ("paneler/right"+counter+".jpg");
		FlyttaBild();
	}
	return true;
}

function FlyttaBild(){
	bildpositionen=document.getElementById("PhotoL").style.posTop-2;
	document.getElementById("PhotoL").style.posTop=bildpositionen;
	document.getElementById("PhotoR").style.posTop=bildpositionen;
	if(bildpositionen>-520) {
		WaitFlytta=setTimeout("FlyttaBild()", 1);
	} else {
		document.getElementById("PhotoL").src = ("paneler/left"+counter+".jpg");
		document.getElementById("PhotoR").src = ("paneler/right"+counter+".jpg");
		document.getElementById("PhotoL").style.posTop=0;
		document.getElementById("PhotoR").style.posTop=0;	
	}
	return true;
}

function KrympaBild(){
	bildhojden=document.getElementById("PhotoL").height-3;
	document.getElementById("PhotoL").height=bildhojden;
	document.getElementById("PhotoR").height=bildhojden;
	if(bildhojden>0) {
		WaitKrympa=setTimeout("KrympaBild()", 1);
	} else {
		document.getElementById("PhotoL").src = ("paneler/left"+counter+".jpg");
		document.getElementById("PhotoR").src = ("paneler/right"+counter+".jpg");
		document.getElementById("PhotoL").height=500;
		document.getElementById("PhotoR").height=500;
	}
	return true;
}

function OpenWin(adress){ 
	siffra++;
	window.open(adress,"skrh"+siffra,'toolbar=1,location=1,directories=1,status=1, menubar=1,scrollbars=1,width="100%",height="100%",resizable=1,left=0,top=0'); 
	return false;
}

function CreateEmail(InnanAt,EfterAt){
	document.write("<br /><a href='mailto:"+InnanAt+"@"+EfterAt+"'>"+InnanAt+"@"+EfterAt+"</a>");
	return true;
}
