// JavaScript Document
var slidespeed = 1; // Geschwindigkeit des Sliders
var slidebgcolor = "#98B5D3"; // Hintergrundfarbe
var slidedir = "runter"; // Richtung - "hoch" oder "runter"
var leftrightslide = new Array();
var copyspeed = slidespeed;
var i = 0;
var pfadg = window.location.href;
var pfadgg = pfadg.split("~");
var pfad = pfadgg[1];

if(pfad == null)
{
var pfad="home";
var sliderwidth = 100; // Breite des Sliders
var sliderheight = 320; // Höhe des Sliders
mx = 15
} else {
mx = 10
var sliderwidth = 140; // Breite des Sliders
var sliderheight = 200; // Höhe des Sliders
}

i=0;
while (i<mx)
{file = i + 1 + '.jpg';
 leftrightslide[i] = '<div><img src="/includes/images/slide/' + pfad + '/' + file + '" width=' + sliderwidth + '"></div>';
 i++;}


// -----------------------------------------------------------------------------------------------------------------------------
leftrightslide = leftrightslide.join("");
var iedom = document.all || document.getElementById;
if (iedom)
	document.write('<span id="temp" style="visibility:hidden;position:absolute;left:-100px;top:-3000px">' + leftrightslide + '</span>');
var actualheight = '';
var cross_slide, ns_slide;

function fillup(){
	if (iedom){
		cross_slide=document.getElementById? document.getElementById("test2") : document.all.test2;
		cross_slide2=document.getElementById? document.getElementById("test3") : document.all.test3;
		cross_slide.innerHTML=cross_slide2.innerHTML=leftrightslide;
		actualheight=document.all? cross_slide.offsetHeight : document.getElementById("temp").offsetHeight;
		cross_slide2.style.top=actualheight+20+"px";
	}
	else if (document.layers){
		ns_slide=document.ns_slidemenu.document.ns_slidemenu2;
		ns_slide2=document.ns_slidemenu.document.ns_slidemenu3;
		ns_slide.document.write(leftrightslide);
		ns_slide.document.close();
		actualheight=ns_slide.document.height;
		ns_slide2.top=actualheight+20;
		ns_slide2.document.write(leftrightslide);
		ns_slide2.document.close();
	}
	if ( slidedir == "hoch" ) {
		lefttime=setInterval("slidetop()",30);
	} else {
		lefttime=setInterval("slidedown()",30);
	}
}
window.onload=fillup;
function slidetop(){
	if (iedom){
		if (parseInt(cross_slide.style.top)>(actualheight*(-1)+8))
			cross_slide.style.top=parseInt(cross_slide.style.top)-copyspeed+"px";
		else
			cross_slide.style.top=parseInt(cross_slide2.style.top)+actualheight+"px";

		if (parseInt(cross_slide2.style.top)>(actualheight*(-1)+8))
			cross_slide2.style.top=parseInt(cross_slide2.style.top)-copyspeed+"px";
		else
			cross_slide2.style.top=parseInt(cross_slide.style.top)+actualheight+"px";
	}
	else if (document.layers){
		if (ns_slide.top>(actualheight*(-1)+8))
			ns_slide.top-=copyspeed;
		else
			ns_slide.top=ns_slide2.top+actualheight;

		if (ns_slide2.top>(actualheight*(-1)+8))
			ns_slide2.top=copyspeed;
		else
			ns_slide2.top=ns_slide.top+actualheight;
	}
}

function slidedown(){
	if (iedom){
		if (parseInt(cross_slide.style.top)<(actualheight-8))
			cross_slide.style.top=parseInt(cross_slide.style.top)+copyspeed+"px";
		else
			cross_slide.style.top=parseInt(cross_slide2.style.top)-actualheight+"px";

		if (parseInt(cross_slide2.style.top)<(actualheight-8))
			cross_slide2.style.top=parseInt(cross_slide2.style.top)+copyspeed+"px";
		else
			cross_slide2.style.top=parseInt(cross_slide.style.top)-actualheight+"px";
	}
	else if (document.layers){
		if (ns_slide.top>(actualheight*(-1)+8))
			ns_slide.top-=copyspeed;
		else
			ns_slide.top=ns_slide2.top+actualheight;

		if (ns_slide2.top>(actualheight*(-1)+8))
			ns_slide2.top=copyspeed;
		else
			ns_slide2.top=ns_slide.top+actualheight;
	}
}

if (iedom||document.layers){
	with (document){
		document.write('<table border="0" cellspacing="0" cellpadding="0"><td>');
		if (iedom){
			document.write('<div style="position:relative;width:' + sliderwidth + 'px;height:' + sliderheight + 'px;overflow:hidden">');
			document.write('<div style="position:absolute;width:' + sliderwidth + 'px;height:' + sliderheight + 'px;background-color:' + slidebgcolor + '" onmouseover="copyspeed=0" onmouseout="copyspeed=slidespeed">');
			document.write('<div id="test2" style="position:absolute;left:0;top:0"></div>');
			document.write('<div id="test3" style="position:absolute;top:-1000;left:0"></div>');
			document.write('</div></div>');
		}
		else if (document.layers){
			document.write('<ilayer width='+sliderwidth+' height='+sliderheight+' name="ns_slidemenu" bgColor='+slidebgcolor+'>');
			document.write('<layer name="ns_slidemenu2" left=0 top=0 onmouseover="copyspeed=0" onmouseout="copyspeed=slidespeed"></layer>');
			document.write('<layer name="ns_slidemenu3" left=0 top=0 onmouseover="copyspeed=0" onmouseout="copyspeed=slidespeed"></layer>');
			document.write('</ilayer>');
		}
		document.write('</td></table>');
	}
}

