var goleftimage='/site/sites/CFST/images/brodpilV.gif';
var goleftimagegray='/site/sites/CFST/images/brodpilGray.gif';
var gorightimage='/site/sites/CFST/images/brodpilH.gif';
var gorightimagegray='/site/sites/CFST/images/brodpilGray.gif';
var actualwidth=0;

var Opera=false;
var NSC4=document.layers;
var IE4OG5=document.all;
var NSC6=(document.getElementById);
if (IE4OG5) {NSC6=false};

//Opera understøttes ikke
var ua = window.navigator.userAgent;
var pOpera = window.navigator.userAgent.indexOf("Opera");
if (pOpera != -1) {Opera=true;IE4OG5=false;NSC6=false;NSC4=false;}

function JumpStart() {
if (IE4OG5) {test2.style.pixelLeft=0;document.images('leftimg').src=goleftimagegray;}
if (NSC4) {ns_scroll.left=0;}
if (NSC6) {document.getElementById("test2").style.left="4px";}
}

function JumpSlut() {
if (actualwidth>menuwidth){
if (IE4OG5) {test2.style.pixelLeft=menuwidth-actualwidth;document.images('rightimg').src=gorightimagegray;}
if (NSC4) {ns_scroll.left=menuwidth-actualwidth;}
if (NSC6) {document.getElementById("test2").style.left=menuwidth-actualwidth+"px";}
}}

function InitScroller(){
if (IE4OG5){
test2.innerHTML=menucontents;
actualwidth=test2.scrollWidth;
if (menuwidth>=actualwidth){document.images('rightimg').src=gorightimagegray;}
}
if (NSC4){
ns_scroll=document.ns_scrollmenu.document.ns_scrollmenu2;
//ns_scroll.document.write('<div class="brodkrumme">' + menucontents + '</div>');
ns_scroll.document.write(menucontents);
ns_scroll.document.close();
actualwidth=ns_scroll.document.width;
}
if (NSC6){
document.getElementById("test2").innerHTML=menucontents;
//actualwidth=(document.getElementById("test2").offsetWidth);
document.getElementById("test2").style.left="0px";
actualwidth=2400;
//fremtving opdatering
window.resizeBy(-1,0);
window.resizeBy(1,0);
}
JumpStart();
}
//window.onload=InitScroller

function moveleft(){
if (IE4OG5&&test2.style.pixelLeft>(menuwidth-actualwidth))
	{test2.style.pixelLeft-=scrollspeed;
	document.images('leftimg').src=goleftimage;}
	else if (IE4OG5&&test2.style.pixelLeft<=(menuwidth-actualwidth)) {document.images('rightimg').src=gorightimagegray;}
if (NSC4&&ns_scroll.left>(menuwidth-actualwidth))
	{ns_scroll.left-=scrollspeed;}
if (NSC6&&(parseInt(document.getElementById("test2").style.left)>(menuwidth-actualwidth)))
	{
	posleft=parseInt(document.getElementById("test2").style.left);
	posleft-=scrollspeed;
	document.getElementById("test2").style.left=posleft + "px";
	}
lefttime=setTimeout("moveleft()",50);
}

function moveright(){
window.status=NSC6;
if (IE4OG5&&test2.style.pixelLeft<0)
	{test2.style.pixelLeft+=scrollspeed;
	document.images('rightimg').src=gorightimage;}
	else if (IE4OG5&&test2.style.pixelLeft>=0) {document.images('leftimg').src=goleftimagegray;}
if (NSC4&&ns_scroll.left<0)
	{ns_scroll.left+=scrollspeed;}
if (NSC6&&parseInt(document.getElementById("test2").style.left)<0)
	{
	posleft=parseInt(document.getElementById("test2").style.left);
	posleft+=scrollspeed;
	document.getElementById("test2").style.left=posleft + "px";
	}
righttime=setTimeout("moveright()",50);
}
if (IE4OG5||NSC4||NSC6){
with (document){
	write('<table border="0" cellspacing="0" cellpadding="0" class="brodkrumme"><tr>');
	write('<td valign="top" align="left" class="brodkrumme" NOWRAP><span class="brodkrumme">Du er her:</span></td>');
	write('<td valign="top" class="brodkrumme" NOWRAP><a href="#" onClick="JumpStart()" onMouseover="moveright()" onMouseout="clearTimeout(righttime)"><img name="leftimg" src="'+goleftimage+'" border="0" vspace="0" hspace="0"></a>&nbsp;</td>');
	write('<td valign="top" width="'+menuwidth+'" NOWRAP class="brodkrumme">');

	if (IE4OG5){
		write('<span style="position:relative;width:'+menuwidth+';">');
		write('<span style="position:absolute;width:'+menuwidth+';clip:rect(0 '+menuwidth+' auto 0)">');
		write('<span id="test2" style="position:absolute;left:0;top:0">');
		write('</span></span></span>');
	}

	if (NSC4){
		write('<ilayer width='+menuwidth+' height="23" name="ns_scrollmenu">');
		write('<layer name="ns_scrollmenu2" left=0 top=0></layer></ilayer>');
	}

	if (NSC6){
		document.write('<span style="position:absolute;">');
		document.write('<span style="width:'+menuwidth+';position:absolute;left:0px;top:0px;height:20px;clip:rect(0px '+menuwidth+'px auto 0px);">');
		document.write('<span id="test2" name="test2" style="position:absolute;left:0px;top:0px;height:20px;">');
		document.write('</span></span></span>');
	}

	write('</td>');
	write('<td valign="top" class="brodkrumme" NOWRAP>&nbsp;<a href="#"');
	if (IE4OG5||NSC4){
		write(' onClick="JumpSlut()"');}
		write(' onMouseover="moveleft()" onMouseout="clearTimeout(lefttime)"><img name="rightimg" src="'+gorightimage+'" border="0" vspace="0" hspace="0"></a>&nbsp;');
		write('</td></tr></table>');
	}

	if (screen.width<800){document.body.style.overflowX='scroll';}
}