// the width of the slideshow (pixels) !!! same as iframe width
var scrollerleft = 0;
var scrollerwidth = 155;


// the height of the slideshow (pixels) !!! same as iframe height
var scrollertop = 0;
var scrollerheight = 533 + scrollertop;


// the waittime and step (defines the speed of scrolling)
var pause = 40;
var step = 1;

// script variables
var scrollerright = scrollerleft + scrollerwidth;
var allpicturewidth;
var newstep = step;
var clipleft, clipright, cliptop, clipbottom;
var timer;
var picturecontent = "";
var ns4=document.layers ? 1 : 0;
//var ns6=document.getElementById&&!document.all?1:0 ;
var ie=document.all ? 1 : 0;
var ns6;
if (!ie && ! ns4) ns6 = 1;
else ns6 = 0;
var browserinfos = navigator.userAgent;
var opera = browserinfos.match(/Opera/);
var divid;

function init()
{
	if (ie)
	{
		divid = document.getElementById('picturediv');
		allpictureheight = divid.offsetHeight / 2;
		clipleft = 0;
		clipright = scrollerwidth;
		cliptop = 0;
		clipbottom = scrollerheight;
		divid.style.clip = "rect("+cliptop+"px "+clipright+"px "+clipbottom+"px "+clipleft+"px)";
		divid.style.visibility = "visible";
		scrollpicture();
	}
	else if (ns6)
	{
		divid = document.getElementById('picturediv');
		allpictureheight = divid.offsetHeight / 2;
		divid.style.top = scrollertop +  "px";
		divid.style.left = scrollerleft;
		clipleft = 0;
		clipright = scrollerwidth;
		cliptop = 0;
		clipbottom = scrollerheight;
		divid.style.clip = "rect("+cliptop+"px "+clipright+"px "+clipbottom+"px "+clipleft+"px)";
		divid.style.visibility = "visible";
		scrollpicture()
	}
	else if (ns4)
	{
		allpictureheight = document.roof.document.picturediv.document.height / 2;
		document.roof.document.picturediv.top = scrollertop;
		document.roof.document.picturediv.left = scrollerleft+scrollerwidth;
		document.roof.document.picturediv.clip.left = 0;
		document.roof.document.picturediv.clip.right = 0;
		document.roof.document.picturediv.clip.top = 0;
		document.roof.document.picturediv.clip.bottom = scrollerheight;
		document.roof.document.picturediv.visibility = "visible";
		scrollpicture()
	}

}

function scrollpicture()
{
	if (ie)
	{
		if (divid.style.posTop >= scrollertop - allpictureheight)
		{
			divid.style.posTop -= step;
			clipbottom += step;
			divid.style.clip = "rect("+cliptop+"px " + clipright + "px " + clipbottom + "px " + clipleft + "px)";
			if (clipbottom >= scrollerheight)
			{
				cliptop += step;
			}
			var timer = setTimeout("scrollpicture()",pause);
		}
		else
		{
			resetposition();
		}
	}
	if (ns6)
	{
		if (parseInt(divid.style.top) >= scrollertop-allpictureheight)
		{
			xtop = parseInt(divid.style.top) - step;
			divid.style.top=xtop+"px";
			clipbottom += step;
			if (clipbottom > scrollerheight)
			{
				cliptop += step;
			}
			divid.style.clip = "rect(" + cliptop + "px " + clipright + "px " + clipbottom + "px " + clipleft + "px)";
			var timer = setTimeout("scrollpicture()",pause);
		}
		else
		{
			resetposition();
		}
	}
	if (ns4)
	{
		if (document.roof.document.picturediv.left >= scrollerleft - allpicturewidth)
		{
			document.roof.document.picturediv.left -= step;
			document.roof.document.picturediv.clip.right += step;
			if (document.roof.document.picturediv.clip.right > scrollerwidth)
			{
				document.roof.document.picturediv.clip.left += step;
			}
			var timer = setTimeout("scrollpicture()",pause);
		}
		else
		{
			resetposition();
		}
	}
}

function onmsover()
{
	step = 0;
}
function onmsout()
{
	step = newstep;
}

function resetposition()
{
	if (ie)
	{
		divid.style.posTop = scrollertop;
		clipbottom = scrollerheight;
		cliptop=0;
		divid.style.clip = "rect(" + cliptop + "px " + clipright + "px " + clipbottom + "px " + clipleft + "px)";
		scrollpicture();
	}
	if (ns6)
	{
		divid.style.top = scrollertop + "px";
		cliptop = 0;
		clipbottom = scrollerheight;
		divid.style.clip = "rect(" + cliptop + "px " + clipright + "px " + clipbottom + "px " + clipleft + "px)";
		scrollpicture();
	}
	if (ns4)
	{
		document.roof.document.picturediv.top = scrollertop;
		document.roof.document.picturediv.clip.top = 0;
		document.roof.document.picturediv.clip.bottom = scrollerheight;
		scrollpicture();
	}
}

picturecontent = "";
picturecontent += "<table cellpadding=0 cellspacing=0>";
for (j = 0; j < 2; j++)
{
	for (i = 0; i <= slideurl.length-1; i++)
	{
		picturecontent += "<tr><td><center>";
		picturecontent += "<a  onclick='nstattgt()' href='"+slidelink[i]+"' target='"+slidetarget[i]+"' onMouseOver='javascript:onmsover()'";
		picturecontent += "onMouseOut='javascript:onmsout()'>";
		picturecontent += slideurl[i]+"</a>";
		picturecontent += "</center></td></tr>";
	}
}

picturecontent += "</table>";

if (ie || ns6)
{
	slwidth = document.getElementById('Slider_div').style.width;
	slheight = document.getElementById('Slider_div').style.height;
	htmltxt = '<div class="slidercontainer" style="position:absolute;overflow:hidden;width:'+slwidth+'; height:'+slheight+';">';
	htmltxt = htmltxt + '<div id="picturediv" style="position:absolute;top:' + scrollertop + 'px;left:' + scrollerleft + 'px;visibility:hidden">' + picturecontent+'</div>';
	htmltxt = htmltxt + '</div>';

	document.getElementById('Slider_div').innerHTML = htmltxt;

	window.onload=init;
}
if (ns4)
{
	document.write('<ilayer name="roof" width=' + scrollerwidth + ' height=' + scrollerheight + '>');
	document.write('<layer name="picturediv" width=' + scrollerwidth + ' height=' + scrollerheight + ' visibility=hide>' + picturecontent + '</layer>');
	document.write('</ilayer>');
	window.onload = init;
}
