var FadingObject = new Array();
var FadeRunning = false;
var FadeInterval = 30;
var i=0;

var text = new Array();
text[0] = "L&#228;s om Israels framtid och Jesu &#229;terkomst,000000,1000,2500";
text[1] = "www.flammor.com,ff0000,1000,1700";
text[2] = "Se kristen webbTV p&#229; svenska,000000,1000,2000";
text[3] = "www.kanal10.se,ff0000,1000,1700";
text[4] = "Jesus helar och befriar m&#228;nniskor idag,000000,1000,2000";
text[5] = "www.bennyhinn.org,ff0000,1000,1700";
text[6] = "Och budskapet om riket skall f&#246;rkunnas,000000,1000,2000";
text[7] = "i hela v&#228;rlden,000000,1000,1500";
text[8] = "och bli till ett vittnesb&#246;rd f&#246;r alla folk.,000000,1000,2500";
text[9] = "sedan skall slutet komma. (Matteus 24:14),000000,1000,2500";
text[10] = "Ta emot Jesus och bli fr&#228;lst idag,ff0000,500,500";
text[11] = "Ta emot Jesus och bli fr&#228;lst idag,ff0000,500,500";
text[12] = "Ta emot Jesus och bli fr&#228;lst idag!,000000,1000,2500";
text[13] = "Du vet v&#228;l om att..,000000,1000,2500";
text[14] = "Jesus &#228;lskar dig!,000000,1000,2500";

function klocka()
{	
	datum = new Date();		
	var minute, hour;
			
	if( datum.getMinutes() < 10 )
	minute = '0' + datum.getMinutes();
	else
	minute = datum.getMinutes();
		
	if( datum.getHours() < 10 )
	hour = '0' + datum.getHours();
	else
	hour = datum.getHours();
				
	return hour+':'+minute;
}	

function text_up()
{
	var text_info, info;
	
	if(i == text.length)
	{
		tid = klocka();
		text_info = "Klockan &#228;r "+klocka()+",000000,1000,2000";
		i=0;
	}
	else
		text_info = text[i++];
	
	info = text_info.split(",");
	fade_up('top_text',info[0],info[1]);
	setTimeout("text_down("+info[2]+");", info[3]);
}

function text_down(fade_text_down)
{
	fade_down('top_text');
	setTimeout("text_up();", fade_text_down);
}

function start_up()
{
	var rnd = 0;
			
	rnd = Math.random() * (text.length-1);
	i = Math.round(rnd);
	
	text_up();
}

var hexDigit=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");
function dec2hex(dec)
{
	return(hexDigit[dec>>4]+hexDigit[dec&15]);
}
function hex2dec(hex)
{
	return(parseInt(hex,16))
}

function createFaderObject(theDiv, numSteps, startColor)
{
	if(!startColor)
		startColor = "000000";
		
	this.name		= theDiv;
	this.text		= null;
	this.color		= "FFFFFF";
	this.next_text	= null;
	this.next_color	= null;
	this.state		= "OFF";
	this.index		= 0;
	this.steps		= numSteps;
	this.r		= hex2dec(startColor.slice(0,2));
	this.g		= hex2dec(startColor.slice(2,4));
	this.b		= hex2dec(startColor.slice(4,6));
}

function FadingText(theDiv, numSteps, startColor)
{
	FadingObject[theDiv] = new createFaderObject(theDiv, numSteps, startColor);
}

function start_fading()
{
	if(!FadeRunning)
		FadeAnimation();
}

function set_text(f)
{
	if(navigator.appName.indexOf("Netscape") != -1
		&& document.getElementById)
	{
		var theElement = document.getElementById(f.name);
		var newRange   = document.createRange();
		newRange.setStartBefore(theElement);
		var strFrag    = newRange.createContextualFragment(f.text);	

		while (theElement.hasChildNodes())
			theElement.removeChild(theElement.lastChild);
		theElement.appendChild(strFrag);
		theElement.style.color="#"+f.startColor;
	}
}

function getColor(f)
{
	var r=hex2dec(f.color.slice(0,2));
	var g=hex2dec(f.color.slice(2,4));
	var b=hex2dec(f.color.slice(4,6));

	r2= Math.floor(f.r+(f.index*(r-f.r))/(f.steps) + .5);
	g2= Math.floor(f.g+(f.index*(g-f.g))/(f.steps) + .5);
	b2= Math.floor(f.b+(f.index*(b-f.b))/(f.steps) + .5);

	return("#" + dec2hex(r2) + dec2hex(g2) + dec2hex(b2));
}

function setColor(fadeObj)
{
	var theColor=getColor(fadeObj);
	var str="<FONT COLOR="+ theColor + ">" + fadeObj.text + "</FONT>";
	var theDiv=fadeObj.name;
	
//if IE 4+
	if(document.all)
	{
		document.all[theDiv].innerHTML=str;
	}	
//else if NS 4
	else if(document.layers)
	{
		with(document.layers[theDiv].document)
		{
			open();
			write("<font size='2' face='verdana, arial'><center><b>" + str + "</b></center></font>");
			close();
		}
	}
//else if NS 6 (supports new DOM, may work in IE5) - see Website Abstraction for more info.
//http://www.wsabstract.com/javatutors/dynamiccontent4.shtml
	else if (document.getElementById)
	{
		theElement = document.getElementById(theDiv);
		theElement.style.color=theColor;
	}
	
}

function fade_up(theDiv, newText, newColor)
{
	var f=FadingObject[theDiv];

	if(newColor == null)
		newColor="FFFFFF";

	if(f.state == "OFF")
	{
		f.text  = newText;
		f.color = newColor;
		f.state = "FADE_UP";
		set_text(f);
		start_fading();
	}
	else if( f.state == "FADE_UP_DOWN"
		|| f.state == "FADE_DOWN"
		|| f.state == "FADE_DOWN_UP")
	{
		if(newText == f.text)
			f.state = "FADE_UP";
		else
		{
			f.next_text  = newText;
			f.next_color = newColor;
			f.state      = "FADE_DOWN_UP";
		}
	}
}

function fade_down(theDiv)
{
	var f=FadingObject[theDiv];

	if(f.state=="ON")
	{
		f.state="FADE_DOWN";
		start_fading();
	}
	else if(f.state=="FADE_DOWN_UP")
	{
		f.state="FADE_DOWN";
		f.next_text = null;
	}
	else if(f.state == "FADE_UP")
	{
		f.state="FADE_UP_DOWN";
	}
}

function FadeAnimation()
{
	FadeRunning = false;
	for (var d in FadingObject)
	{
		var f=FadingObject[d];

		if(f.state == "FADE_UP")
		{
			if(f.index < f.steps)
				f.index++;
			else
				f.index = f.steps;
			setColor(f);

			if(f.index == f.steps)
				f.state="ON";
			else
				FadeRunning = true;
		}
		else if(f.state == "FADE_UP_DOWN")
		{
			if(f.index < f.steps)
				f.index++;
			else
				f.index = f.steps;
			setColor(f);

			if(f.index == f.steps)
				f.state="FADE_DOWN";
			FadeRunning = true;
		}
		else if(f.state == "FADE_DOWN")
		{
			if(f.index > 0)
				f.index--;
			else
				f.index = 0;
			setColor(f);

			if(f.index == 0)
				f.state="OFF";
			else
				FadeRunning = true;
		}
		else if(f.state == "FADE_DOWN_UP")
		{
			if(f.index > 0)
				f.index--;
			else
				f.index = 0;
			setColor(f);

			if(f.index == 0)
			{
				f.text      = f.next_text;
				f.color     = f.next_color;
				f.next_text = null;
				f.state     ="FADE_UP";
				set_text(f);
			}
			FadeRunning = true;
		}
	}
	/*** Check to see if we need to animate any more frames. ***/
	if(FadeRunning)
		setTimeout("FadeAnimation()", FadeInterval);

}

/***********************************************
* Ultimate Fade-In Slideshow (v1.5): © Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
 
var fadeimages4=new Array()
fadeimages4[0]=["jpg/ny-davids_cd_underbara_land.jpg", "", ""]
fadeimages4[1]=["jpg/www_ny-david_nu__1.jpg", "", ""]
fadeimages4[2]=["jpg/www_ny-david_nu__2.jpg", "", ""]
fadeimages4[3]=["jpg/ny-david_lp1.jpg", "", ""]
fadeimages4[4]=["jpg/www_ny-david_nu__3.jpg", "", ""]
fadeimages4[5]=["jpg/www_ny-david_nu__4.jpg", "", ""]
fadeimages4[6]=["jpg/www_ny-david_nu__5.jpg", "", ""]
fadeimages4[7]=["jpg/ny-david_lp2.jpg", "", ""]
fadeimages4[8]=["jpg/www_ny-david_nu__6.jpg", "", ""]
fadeimages4[9]=["jpg/www_ny-david_nu__7.jpg", "", ""]
fadeimages4[10]=["jpg/www_ny-david_nu__8.jpg", "", ""]
fadeimages4[11]=["jpg/www_ny-david_nu__9.jpg", "", ""]
fadeimages4[12]=["jpg/www_ny-david_nu__10.jpg", "", ""]
fadeimages4[13]=["jpg/ny-david_lp3.jpg", "", ""]
fadeimages4[14]=["jpg/www_ny-david_nu__11.jpg", "", ""]
fadeimages4[15]=["jpg/www_ny-david_nu__12.jpg", "", ""]
fadeimages4[16]=["jpg/www_ny-david_nu__13.jpg", "", ""]
fadeimages4[17]=["jpg/www_ny-david_nu__14.jpg", "", ""]
fadeimages4[18]=["jpg/www_ny-david_nu__15.jpg", "", ""]
fadeimages4[19]=["jpg/www_ny-david_nu__16.jpg", "", ""]
fadeimages4[20]=["jpg/www_ny-david_nu__17.jpg", "", ""]
fadeimages4[21]=["jpg/www_ny-david_nu__18.jpg", "", ""]
fadeimages4[22]=["jpg/ny-david_lp4.jpg", "", ""]
fadeimages4[23]=["jpg/www_ny-david_nu__19.jpg", "", ""]
fadeimages4[24]=["jpg/www_ny-david_nu__20.jpg", "", ""]
fadeimages4[25]=["jpg/www_ny-david_nu__21.jpg", "", ""]
fadeimages4[26]=["jpg/www_ny-david_nu__22.jpg", "", ""]
fadeimages4[27]=["jpg/ny-david_lp5.jpg", "", ""]
fadeimages4[28]=["jpg/www_ny-david_nu__23.jpg", "", ""]
fadeimages4[29]=["jpg/www_ny-david_nu__24.jpg", "", ""]
fadeimages4[30]=["jpg/www_ny-david_nu__25.jpg", "", ""]
fadeimages4[31]=["jpg/www_ny-david_nu__26.jpg", "", ""]
fadeimages4[32]=["jpg/www_ny-david_nu__27.jpg", "", ""]
fadeimages4[33]=["jpg/www_ny-david_nu__28.jpg", "", ""]
fadeimages4[34]=["jpg/ny-david_lp6.jpg", "", ""]
fadeimages4[35]=["jpg/www_ny-david_nu__29.jpg", "", ""]
fadeimages4[36]=["jpg/www_ny-david_nu__30.jpg", "", ""]
fadeimages4[37]=["jpg/www_ny-david_nu__31.jpg", "", ""]
fadeimages4[38]=["jpg/www_ny-david_nu__32.jpg", "", ""]
fadeimages4[39]=["jpg/www_ny-david_nu__33.jpg", "", ""]
fadeimages4[40]=["jpg/www_ny-david_nu__34.jpg", "", ""]
fadeimages4[41]=["jpg/ny-david_lp7.jpg", "", ""]
fadeimages4[42]=["jpg/www_ny-david_nu__35.jpg", "", ""]
fadeimages4[43]=["jpg/www_ny-david_nu__36.jpg", "", ""]
fadeimages4[44]=["jpg/www_ny-david_nu__37.jpg", "", ""]
fadeimages4[45]=["jpg/www_ny-david_nu__38.jpg", "", ""]
fadeimages4[46]=["jpg/www_ny-david_nu__39.jpg", "", ""]
fadeimages4[47]=["jpg/ny-david_lp8.jpg", "", ""]
fadeimages4[48]=["jpg/www_ny-david_nu__40.jpg", "", ""]
fadeimages4[49]=["jpg/www_ny-david_nu__41.jpg", "", ""]
fadeimages4[50]=["jpg/www_ny-david_nu__42.jpg", "", ""]
fadeimages4[51]=["jpg/www_ny-david_nu__43.jpg", "", ""]
fadeimages4[52]=["jpg/www_ny-david_nu__44.jpg", "", ""]
fadeimages4[53]=["jpg/www_ny-david_nu__45.jpg", "", ""]
fadeimages4[54]=["jpg/www_ny-david_nu__46.jpg", "", ""]
fadeimages4[55]=["jpg/www_ny-david_nu__47.jpg", "", ""]
fadeimages4[56]=["jpg/www_ny-david_nu__48.jpg", "", ""]
fadeimages4[57]=["jpg/www_ny-david_nu__49.jpg", "", ""]
fadeimages4[58]=["jpg/www_ny-david_nu__50.jpg", "", ""]
fadeimages4[59]=["jpg/www_ny-david_nu__51.jpg", "", ""]
fadeimages4[60]=["jpg/www_ny-david_nu__52.jpg", "", ""]
fadeimages4[61]=["jpg/www_ny-david_nu__53.jpg", "", ""]
fadeimages4[62]=["jpg/www_ny-david_nu__54.jpg", "", ""]
fadeimages4[63]=["jpg/www_ny-david_nu__55.jpg", "", ""]
fadeimages4[64]=["jpg/www_ny-david_nu__56.jpg", "", ""]
fadeimages4[65]=["jpg/www_ny-david_nu__57.jpg", "", ""]
fadeimages4[66]=["jpg/www_ny-david_nu__58.jpg", "", ""]
fadeimages4[67]=["jpg/www_ny-david_nu__59.jpg", "", ""]
fadeimages4[68]=["jpg/www_ny-david_nu__60.jpg", "", ""]
fadeimages4[69]=["jpg/www_ny-david_nu__61.jpg", "", ""]
fadeimages4[70]=["jpg/www_ny-david_nu__62.jpg", "", ""]
fadeimages4[71]=["jpg/www_ny-david_nu__63.jpg", "", ""]
fadeimages4[72]=["jpg/www_ny-david_nu__64.jpg", "", ""]
fadeimages4[73]=["jpg/www_ny-david_nu__65.jpg", "", ""]
fadeimages4[74]=["jpg/www_ny-david_nu__66.jpg", "", ""]
fadeimages4[75]=["jpg/www_ny-david_nu__67.jpg", "", ""]
fadeimages4[76]=["jpg/www_ny-david_nu__68.jpg", "", ""]
fadeimages4[77]=["jpg/www_ny-david_nu__69.jpg", "", ""]
fadeimages4[78]=["jpg/svenska_flaggan.jpg", "", ""]
fadeimages4[79]=["jpg/Israel.jpg", "", ""]

var fadeimages3=new Array()
fadeimages3[0]=["jpg/ny-davids_cd_underbara_land.jpg", "musik.html", ""]
fadeimages3[1]=["jpg/ny-david_lp1.jpg", "musik.html", ""]
fadeimages3[2]=["jpg/ny-david_lp2.jpg", "musik.html", ""]
fadeimages3[3]=["jpg/ny-david_lp3.jpg", "musik.html", ""]
fadeimages3[4]=["jpg/ny-david_lp4.jpg", "musik.html", ""]
fadeimages3[5]=["jpg/ny-david_lp5.jpg", "musik.html", ""]
fadeimages3[6]=["jpg/ny-david_lp6.jpg", "musik.html", ""]
fadeimages3[7]=["jpg/ny-david_lp7.jpg", "musik.html", ""]
fadeimages3[8]=["jpg/ny-david_lp8.jpg", "musik.html", ""]

var fadeimages2=new Array()
fadeimages2[0]=["jpg/Israel.jpg", "links.html", ""]
fadeimages2[1]=["jpg/svenska_flaggan.jpg", "musik.html", ""]
fadeimages2[2]=["jpg/ny-david_maria_karoline_bild1.jpg", "nydavid.html", ""]
fadeimages2[3]=["jpg/ny-david_maria_karoline_bild2.jpg", "nydavid.html", ""]
fadeimages2[4]=["jpg/gitarr.jpg", "musik.html", ""]
fadeimages2[5]=["jpg/blomma1.jpg", "musik.html", ""]
fadeimages2[6]=["jpg/blomma2.jpg", "musik.html", ""]
fadeimages2[7]=["jpg/blomma3.jpg", "musik.html", ""]
fadeimages2[8]=["jpg/blomma4.jpg", "musik.html", ""]
fadeimages2[9]=["jpg/blomma5.jpg", "musik.html", ""]

var fadeimages1=new Array()
fadeimages1[0]=["gif/bild1.gif", "", ""]
fadeimages1[1]=["gif/bild2.gif", "", ""]
fadeimages1[2]=["gif/bild3.gif", "", ""]
fadeimages1[3]=["gif/bild4.gif", "", ""]
fadeimages1[4]=["gif/bild5.gif", "", ""]
fadeimages1[5]=["gif/bild6.gif", "", ""]
fadeimages1[6]=["gif/bild7.gif", "", ""]
fadeimages1[7]=["gif/bild8.gif", "", ""]
fadeimages1[8]=["gif/bild9.gif", "", ""]

var fadeimages0=new Array()
fadeimages0[0]=["gif/ny-david_och_maria.gif", "", ""]
fadeimages0[1]=["gif/ny-david_och_maria_.gif", "", ""]
fadeimages0[2]=["gif/ny-david_och_maria__.gif", "", ""]
fadeimages0[3]=["gif/ny-david_och_maria___.gif", "", ""]

var fadebgcolor="white";
var pause_image=0;

////NO need to edit beyond here/////////////
 
var fadearray=new Array() //array to cache fadeshow instances
var fadeclear=new Array() //array to cache corresponding clearinterval pointers
 
var dom=(document.getElementById) //modern dom browsers
var iebrowser=document.all
 
function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){
this.pausecheck=pause
this.mouseovercheck=0
this.delay=delay
this.degree=10 //initial opacity degree (10%)
this.curimageindex=0
this.nextimageindex=1
fadearray[fadearray.length]=this
this.slideshowid=fadearray.length-1
this.canvasbase="canvas"+this.slideshowid
this.curcanvas=this.canvasbase+"_0"
if (typeof displayorder!="undefined")
theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
this.theimages=theimages
this.imageborder=parseInt(borderwidth)
this.postimages=new Array() //preload images
for (p=0;p<theimages.length;p++){
this.postimages[p]=new Image()
this.postimages[p].src=theimages[p][0]
}
 
var fadewidth=fadewidth+this.imageborder*2
var fadeheight=fadeheight+this.imageborder*2
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox)
document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;-khtml-opacity:10;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;background-color:'+fadebgcolor+'"></div></div>')
else
document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox
this.startit()
else{
this.curimageindex++
setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)
}
}

function fadepic(obj){
if (obj.degree<100){
obj.degree+=10
if (obj.tempobj.filters&&obj.tempobj.filters[0]){
if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
obj.tempobj.filters[0].opacity=obj.degree
else //else if IE5.5-
obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
}
else if (obj.tempobj.style.MozOpacity)
obj.tempobj.style.MozOpacity=obj.degree/101
else if (obj.tempobj.style.KhtmlOpacity)
obj.tempobj.style.KhtmlOpacity=obj.degree/100
}
else{
clearInterval(fadeclear[obj.slideshowid])
obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
obj.populateslide(obj.tempobj, obj.nextimageindex)
obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
}
}
 
fadeshow.prototype.populateslide=function(picobj, picindex){
var slideHTML=""
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML+='</a>'
picobj.innerHTML=slideHTML
}
 
fadeshow.prototype.rotateimage=function(){
// if (this.pausecheck==1) //if pause onMouseover enabled, cache object
var cacheobj=this
if (this.mouseovercheck==1 || pause_image)
setTimeout(function(){cacheobj.rotateimage()}, 100)
else if (iebrowser&&dom||dom){
this.resetit()
var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
crossobj.style.zIndex++
fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)
this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
}
else{
var ns4imgobj=document.images['defaultslide'+this.slideshowid]
ns4imgobj.src=this.postimages[this.curimageindex].src
}
this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}
 
fadeshow.prototype.resetit=function(){
this.degree=10
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
if (crossobj.filters&&crossobj.filters[0]){
if (typeof crossobj.filters[0].opacity=="number") //if IE6+
crossobj.filters(0).opacity=this.degree
else //else if IE5.5-
crossobj.style.filter="alpha(opacity="+this.degree+")"
}
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=this.degree/101
else if (crossobj.style.KhtmlOpacity)
crossobj.style.KhtmlOpacity=obj.degree/100
}
 
fadeshow.prototype.startit=function(){
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
this.populateslide(crossobj, this.curimageindex)
if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
var cacheobj=this
var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)
crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
}
this.rotateimage()
}

/***********************************************
* Fading Scroller- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var delay1 = 2000; //set delay between message change (in miliseconds)
var maxsteps=30; // (30) number of steps to take to change from start color to endcolor
var stepdelay=40; // (40) time in miliseconds of a single step
//**Note: maxsteps*stepdelay will be total time in miliseconds of fading effect
var startcolor= new Array(255,255,255);	// start color (red, green, blue)
var endcolor=new Array(0,0,0);			// end color (red, green, blue)
var text_number = 0;

begintag='<div style="font-family: verdana, arial; font-size: 10pt; font-weight: normal; padding: 5px;">'; //set opening tag, such as font declarations
closetag='</div>';

var nydavid=new Array();
nydavid[0]="<b>Boka in ett bes&#246;k med Ny-David</b><br><br>Ring 023-301 04";
nydavid[1]="<br>Bjud in ofr&#228;lsta p&#229; v&#228;ckelsem&#246;te";
nydavid[2]="Jag brukar kalla mina m&#246;ten f&#246;r<br><br><b>S&#229;ng och gl&#228;dje med Ny-David</b>";

var fwidth='305px'; //set scroller width
var fheight='70px'; //set scroller height

var fadelinks=1;  //should links inside scroller content also fade like text? 0 for no, 1 for yes.

///No need to edit below this line/////////////////

var ie4=document.all&&!document.getElementById;
var DOM2=document.getElementById;
var faderdelay=0;
var index=0;

function changecontent()
{
  if (index>=nydavid.length)
    index=0
  if (DOM2){
    document.getElementById("fscroller").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")"
    document.getElementById("fscroller").innerHTML=begintag+nydavid[index]+closetag
    if (fadelinks)
      linkcolorchange(1);
    colorfade(1, 15);
  }
  else if (ie4)
    document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag;
  index++
}

function linkcolorchange(step)
{
  var obj=document.getElementById("fscroller").getElementsByTagName("A");
  if (obj.length>0){
    for (i=0;i<obj.length;i++)
      obj[i].style.color=getstepcolor(step);
  }
}

var fadecounter;
function colorfade(step)
{
  if(step<=maxsteps) {	
    document.getElementById("fscroller").style.color=getstepcolor(step);
    if (fadelinks)
      linkcolorchange(step);
    step++;
    fadecounter=setTimeout("colorfade("+step+")",stepdelay);
  }else{
    clearTimeout(fadecounter);
    document.getElementById("fscroller").style.color="rgb("+endcolor[0]+", "+endcolor[1]+", "+endcolor[2]+")";
    setTimeout("changecontent()", delay1);
  }   
}

function getstepcolor(step)
{
  var diff
  var newcolor=new Array(3);
  for(var i=0;i<3;i++) {
    diff = (startcolor[i]-endcolor[i]);
    if(diff > 0) {
      newcolor[i] = startcolor[i]-(Math.round((diff/maxsteps))*step);
    } else {
      newcolor[i] = startcolor[i]+(Math.round((Math.abs(diff)/maxsteps))*step);
    }
  }
  return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
}

function boka_nydavid()
{
	if (ie4||DOM2)
		document.write('<div id="fscroller" align="center" style="border: 1px solid #cccccc; width:'+fwidth+';height:'+fheight+'"></div>');

	if (window.addEventListener)
		window.addEventListener("load", changecontent, false)
	else if (window.attachEvent)
		window.attachEvent("onload", changecontent)
	else if (document.getElementById)
		window.onload=changecontent
}

function color_bg(rno,cnt,over)
{
	var temp="";
	var cnt2=0;
	
	if(!document.layers)
	{
		while( cnt2<cnt )
		{
			temp=document.getElementById('td_'+rno+(++cnt2));

			if(over)
				temp.className='td1';
			else
				temp.className='td3';
		}
	}
}

function stop_musik(nr1,nr2)
{
	if((document.getElementById(nr1).className=='td2')||(document.getElementById(nr2).className=='td2'))
		document.musik.stop();
}

function stop_mediaplayer(nr1)
{
	if((document.getElementById(nr1).className=='td2'))
		document.mediaplayer.stop();
}

function show_status(nr_A,nr_B,medd1,medd2)
{
	if(document.getElementById(nr_A).className=='td2')
	  window.status = medd1;
	else if(document.getElementById(nr_B).className=='td2')
		window.status = medd2;
	else
	  window.status = "";
	
	return true;
}

function musik_td(td_name,col_s,musik_name,m_name,m_time)
{
	if(!document.layers)
	{
		document.write("<td id='"+td_name+"' colspan='"+col_s+"' onclick=window.open('http://www.ny-david.nu/"+m_name+"'); onmouseover=this.className='td2' onmouseout=this.className='td1' style='cursor: pointer;'><img src='gif/mp3.gif' alt='musik' title='' width='20' height='10'>"+musik_name+"</td>");
		document.write("<td align='center'><font color='#666666'>"+m_time+"</font></td>");
	}
	else
	{
		document.write("<td colspan='"+col_s+"' style='cursor: pointer;'><a href='"+m_name+"'>"+musik_name+"</a></td>");
		document.write("<td align='center'><font color='#666666'>"+m_time+"</font></td>");
	}
}

function nydavids_mail()
{
	var skriv, ut, denna, text, nu = "";

	skriv = "<a href='m&#97;&#105;";
	ut = "&#108;&#116;&#111;&#58;ny-david&#64;ny-dav";
	denna = "id.";
	text = "nu' class='links'>ny-david&#64;ny-dav";
	nu= "id.nu</a>";

	document.write(skriv+ut+denna+text+nu);
}

function anders_mail()
{
	var skriv, ut, detta, text, nu = "";

	skriv = "<a href='m&#97;&#105;";
	ut = "&#108;&#116;&#111;&#58;an";
	denna = "ders&#64;ny-david.";
	text = "nu' class='links'>anders&#64;ny-david";
	nu= ".nu</a>";
	
	document.write(skriv+ut+denna+text+nu);
}

function rnd_song(numm3u)
{
  var randomNr = Math.random();
  var rnd_nr = randomNr*(numm3u-1);
  return Math.round(rnd_nr)+1;
}

if (document.images)
{
  bild1= new Image(28,14); 
  bild1.src="http://www.ny-david.nu/gif/play.gif";

  bild2= new Image(28,14); 
  bild2.src="http://www.ny-david.nu/gif/play_.gif";

  bild3= new Image(24,24); 
  bild3.src="http://www.ny-david.nu/gif/link.gif";

  bild4= new Image(24,24); 
  bild4.src="http://www.ny-david.nu/gif/link_.gif";

  bild5= new Image(26,12); 
  bild5.src="http://www.ny-david.nu/gif/pil1.gif";

  bild6= new Image(15,8); 
  bild6.src="http://www.ny-david.nu/gif/pil2.gif";

  bild7= new Image(13,10); 
  bild7.src="http://www.ny-david.nu/gif/pil3.gif";

  bild8= new Image(88,31); 
  bild8.src="http://www.ny-david.nu/gif/kanal10.gif";

  bild9= new Image(88,31); 
  bild9.src="http://www.ny-david.nu/gif/kanal10_.gif";

  bild10= new Image(156,6); 
  bild10.src="http://www.ny-david.nu/gif/moln.gif";

  bild11= new Image(251,64); 
  bild11.src="http://www.ny-david.nu/gif/ny-david_i_falun.gif";

  bild12= new Image(402,45); 
  bild12.src="http://www.ny-david.nu/gif/top1.gif";

  bild13= new Image(93,45); 
  bild13.src="http://www.ny-david.nu/gif/top2.gif";

  bild14= new Image(402,6); 
  bild14.src="http://www.ny-david.nu/gif/top3.gif";

  bild15= new Image(93,6); 
  bild15.src="http://www.ny-david.nu/gif/top4.gif";

  bild16= new Image(495,13); 
  bild16.src="http://www.ny-david.nu/gif/top5.gif";

  bild17= new Image(745,26); 
  bild17.src="http://www.ny-david.nu/gif/top6.gif";

  bild18= new Image(114,10); 
  bild18.src="http://www.ny-david.nu/gif/bild1.gif";

  bild19= new Image(114,10); 
  bild19.src="http://www.ny-david.nu/gif/bild2.gif";

  bild20= new Image(114,10); 
  bild20.src="http://www.ny-david.nu/gif/bild3.gif";

  bild21= new Image(114,10); 
  bild21.src="http://www.ny-david.nu/gif/bild4.gif";

  bild22= new Image(114,10); 
  bild22.src="http://www.ny-david.nu/gif/bild5.gif";

  bild23= new Image(114,10); 
  bild23.src="http://www.ny-david.nu/gif/bild6.gif";

  bild24= new Image(114,10); 
  bild24.src="http://www.ny-david.nu/gif/bild7.gif";

  bild25= new Image(114,10); 
  bild25.src="http://www.ny-david.nu/gif/bild8.gif";

  bild26= new Image(114,10); 
  bild26.src="http://www.ny-david.nu/gif/bild9.gif";

  bild27= new Image(62,14); 
  bild27.src="http://www.ny-david.nu/gif/klick.gif";
}

