﻿function checkSoeg(s)  {
  if (document.forms[0].sg.value == "søg") {
  	document.forms[0].sg.value = '';     
  }
}

	var scrollerBoxCenter = null;
		var scrollerBoxRight = null;

//***************************** slide

var intCurrImg = 0;
function nextImage() {
	if(typeof(arrPageImages)!="undefined") {
		intCurrImg += 1;
		if(intCurrImg>=arrPageImages.length) {
			intCurrImg = 0;
		}
		g('MainImage').style.backgroundImage = "url(\"" + arrPageImages[intCurrImg] + "\")";
		g('Imgtxt').innerHTML = arrPageImagestxt[intCurrImg];
		
		if( arrPageImagestxt[intCurrImg] != "<br><br>" ){
			g("photoinfo").style.display = "block";
		}else{
			g("photoinfo").style.display = "none";
		}							
	}	
}

function prevImage() {
	if(typeof(arrPageImages)!="undefined") {
		intCurrImg -= 1;
		if(intCurrImg<0) {
			intCurrImg = arrPageImages.length - 1;
		}
		g('MainImage').style.backgroundImage = "url(\"" + arrPageImages[intCurrImg] + "\")";
		g('Imgtxt').innerHTML = arrPageImagestxt[intCurrImg];
		
		if( arrPageImagestxt[intCurrImg] != "<br><br>" ){
			g("photoinfo").style.display = "block";
		}else{
			g("photoinfo").style.display = "none";
		}			
		
	}
	

	
}
function thisImage() {
		intCurrImg = intCurrImgThumb;
		g('MainImage').style.backgroundImage = "url(\"" + arrPageImages[intCurrImg] + "\")";
		g('Imgtxt').innerHTML = arrPageImagestxt[intCurrImg];	
		/*if (lukstateimg == 1) {
		toggleImgTxt();
		}	*/
		g('Imgtxt').style.top = rypos('photoinfo') - g("Imgtxt").offsetHeight + g("photoinfo").offsetHeight - p(jsRF * 1) + "px";

		if( arrPageImagestxt[intCurrImg] != "<br><br>" ){
			g("photoinfo").style.display = "block";
		}else{
			g("photoinfo").style.display = "none";
		}		
		
}
//***************************** Thumbslide
var intCurrImgThumb = 0;
function nextImageThumb() {
	if(typeof(arrPageImagesThumb)!="undefined") {
		intCurrImgThumb += 1;
		if(intCurrImgThumb>=arrPageImagesThumb.length) {
			intCurrImgThumb = 0;
		}
		g('thumb').src = arrPageImagesThumb[intCurrImgThumb];
		g('currthumb').innerHTML = intCurrImgThumb + 1;
	}
}
function prevImageThumb() {
	if(typeof(arrPageImagesThumb)!="undefined") {
		intCurrImgThumb -= 1;
		if(intCurrImgThumb<0) {
			intCurrImgThumb = arrPageImagesThumb.length - 1;
		}
		g('thumb').src = arrPageImagesThumb[intCurrImgThumb];
		g('currthumb').innerHTML = intCurrImgThumb + 1;
	}
}
//***************************** show/hide text
var lukstate=2;
function togglePhoto() {	
	if (lukstate == 1) {
		lukstate=2;	
		g("submenu").style.display = "block";
		g("submenudots").style.display = "block";
		g("imgmenu").style.display = "block";		
		g("divBoxCenterTextMaster").style.display = "block";
		g("imgArrowScrolbarBoxCenterUp").style.display = "block";
		g("imgArrowScrolbarBoxCenterDown").style.display = "block";
		g("divScrollbarBoxCenter").style.display = "block";
		g("divScrollSliderBoxCenter").style.display = "block";
		
		g("imgArrowLeft").style.display = "none";	
		g("imgArrowRight").style.display = "none";
		
		g('togglephoto').style.left = rxpos('Site') + p(jsRF * 616) + "px";		
		g('togglephoto').style.top = rypos('Site')+ p(jsRF * 116) + "px";	
		
		g("togglephoto").innerHTML  = jstxtviewphoto;	
				
	}else{		
		
		lukstate=1;		
		g("submenu").style.display = "none";
		g("submenudots").style.display = "none";
		g("imgmenu").style.display = "none";		
		g("divBoxCenterTextMaster").style.display = "none";
		g("imgArrowScrolbarBoxCenterUp").style.display = "none";
		g("imgArrowScrolbarBoxCenterDown").style.display = "none";
		g("divScrollbarBoxCenter").style.display = "none";
		g("divScrollSliderBoxCenter").style.display = "none";
		
		g('togglephoto').style.left = rxpos('Site')+ g("Site").offsetWidth - (g("togglephoto").offsetWidth) - p(jsRF * 13) + "px";
		g('togglephoto').style.top = rypos('Site')+ p(jsRF * 502) + "px";		
		g("togglephoto").innerHTML  = jstxtviewtext;
		
		if (arrPageImages.length != 0) {
		g("imgArrowLeft").style.display = "block";	
		g("imgArrowRight").style.display = "block";
		

		
	}
	}
}
//***************************** show/hide imagetext
var lukstateimg=2;
function toggleImgTxt() {	
	if (lukstateimg == 1) {
		lukstateimg=2;	
		g("Imgtxt").style.display = "none";	
	}else{		
		lukstateimg=1;		
		g("Imgtxt").style.display = "block";
		
		g('Imgtxt').style.top = rypos('photoinfo') - g("Imgtxt").offsetHeight + g("photoinfo").offsetHeight - p(jsRF * 1) + "px";
		
		
	}
}

//***************************** show/hide Front

var lukstatefront=2;
function togglePhotoFront() {	
	if (lukstatefront == 1) {
		lukstatefront=2;	
		g("frontContent").style.display = "block";
		g("frontmap").style.display = "block";
		g("dots_front_right").style.display = "block";
		g("frontNews").style.display = "block";
		g("frontOffer").style.display = "block";
		
		g("togglephotofront").innerHTML  = jstxtviewphoto;		

			
	}else{		
		lukstatefront=1;		
		g("frontContent").style.display = "none";
		g("frontmap").style.display = "none";
		g("dots_front_right").style.display = "none";
		g("frontNews").style.display = "none";
		g("frontOffer").style.display = "none";
		
		g("togglephotofront").innerHTML  = jstxtviewtext;		
	}
}




//***************************** Stuff
var ie5;
var ns6;
function startup() {
	ie5=document.all&&document.getElementById;
	ns6=document.getElementById&&!document.all;
}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}


function delayPositionThings() {
		setTimeout("positionThings()", 500);
}

var blnFirstRun = true;

function positionThings() {


	if (blnFirstRun){
		if(window.captureEvents){
			window.onmousemove=sourceCheck;
		} else {
			document.onmousemove=sourceCheck;
		}		
	}


	var pageSize = getPageSize();
	//var pageHeight = (ie5 ? pageSize[1] : pageSize[3]);
	var pageWidth = (ie5 ? pageSize[0] : pageSize[2]);


	/*
	g('Site').style.top = p((pageHeight - g('Site').offsetHeight) / 2) + "px";
	if(p(g('Site').style.top) < 0) {
		g('Site').style.top = "0px";
	}
	*/
	if(g('Site')){
	g('Site').style.left = p((pageWidth - g('Site').offsetWidth) / 2) + "px";
	if(p(g('Site').style.left) < 0) {
		g('Site').style.left = "0px";
	}
	}



	//g('fill_left').style.left = rxpos('Site') + p(jsRF * 12) + "px";
	//g('fill_left').style.left = p(jsRF * 0) + "px";
	//g('fill_left').style.top =  p(jsRF * 29) + "px";
	
	if (((pageWidth - g('Site').offsetWidth)/2) < 0){
		g('fill_left').style.width = p(jsRF * 180) + "px";
	}else{
		g('fill_left').style.width =  (pageWidth - g('Site').offsetWidth)/2 + p(jsRF * 180) + "px";
	}
	g('fill_left').style.height = p(jsRF * 43) + "px";
	//g("fill_left").style.display = "none";

	g('fill_right').style.left = rxpos('Site') + g('Site').offsetWidth - p(jsRF * 0) + "px";
	g('fill_right').style.top =  rypos('fill_left') + "px";
	
	if (((pageWidth - g('Site').offsetWidth)/2) < 0){
		g('fill_right').style.width = p(jsRF * 40) + "px";
	}else{	
	//g('fill_right').style.width =  (pageWidth - g('Site').offsetWidth)/2 + p(jsRF * 40) + "px";
	var intWidth = (pageWidth - g('Site').offsetWidth)/2 - p(jsRF * 13);
	if (intWidth < 0){intWidth = 0}
	//g('fill_right').style.width =  (pageWidth - g('Site').offsetWidth)/2 - p(jsRF * 13) + "px";
	g('fill_right').style.width = intWidth + "px";
}
	
	g('fill_right').style.height = g('fill_left').offsetHeight + "px";
	//g("fill_right").style.display = "none";

//alert(rxpos('Site'));
	g('hovedmenu').style.left = rxpos('Site') + p(jsRF * 12) + "px";
	g('hovedmenu').style.top = rypos('Site') + p(jsRF * 44) + "px";

	//g('Logo').style.left = rxpos('Site') + p(jsRF * 830) + "px";
	g('Logo').style.left = rxpos('Site')+ g("Site").offsetWidth - (g("Logo").offsetWidth) - p(jsRF * 12) + "px";
	g('Logo').style.top = rypos('Site') + p(jsRF * 0) + "px";

	g('dots_front_top_left').style.left = rxpos('Site') + p(jsRF * 6) + "px";
	g('dots_front_top_left').style.top = rypos('Site') + p(jsRF * 29) + "px";
	g("dots_front_top_left").style.display = "none";


	g('adresse').style.left = rxpos('Site') + p(jsRF * 80) + "px";
	g('adresse').style.top = rypos('Site') + p(jsRF * 552) + "px";

	g('contact').style.left = rxpos('Site')+ p(jsRF * 12) + "px";
	g('contact').style.top = rypos('Site')+ p(jsRF * 552) + "px";

	g('home_print_search').style.left = rxpos('Site')+ p(jsRF * 12) + "px";
	g('home_print_search').style.top = rypos('Site')+ p(jsRF * 5) + "px";

	//g('toplinks').style.left = rxpos('Logo') - (g("toplinks").offsetWidth) - p(jsRF * 10) + "px";
//	g('toplinks').style.left = rxpos('Site')+ p(jsRF * 266) + "px";
//	g('toplinks').style.top = rypos('Site') + p(jsRF * 7) + "px";

	if (jsintForside == 0) {
		// Artikel elementer:
		
		if (jsres == 0 ){
			g('submenu').style.width = p(jsRF * 200) - p(jsRF * 2) + "px";
		}else if (jsres == 1 ){
			g('submenu').style.width = p(jsRF * 200) + "px";
			
		}else if (jsres == 2 ){
			g('submenu').style.width = p(jsRF * 200) - p(jsRF * 2) + "px";
		}
		if (arrPageImages.length == 0) {
			//g("thumbnav").style.display = "none";
			//g("photoinfo").style.display = "none";				
		}
		
		
		
		g('submenu').style.left = rxpos('Site')+ p(jsRF * 50) + "px";
		g('submenu').style.top = rypos('Site')+ p(jsRF * 44) + "px";
	
		//g('submenudots').style.left = rxpos('submenu') + p(jsRF * 1) + "px";
		//g('submenudots').style.top = rypos('Site')+ p(jsRF * 44) + "px";
		//g('submenudots').style.width = (g("submenu").offsetWidth) - p(jsRF * 1) + "px";
	
		g('imgmenu').style.left = rxpos('submenu') + "px";
		g('imgmenu').style.top = rypos('Site')+ p(jsRF * 406) + "px";
		g('imgmenu').style.width = (g("submenu").offsetWidth) + "px";
		
		g('imgmenubg').style.width = (g("submenu").offsetWidth) + "px";
		
	
		g('MainImage').style.left = rxpos('Site')+ p(jsRF * 12) + "px";
		g('MainImage').style.top = rypos('Site')+ p(jsRF * 61) + "px";
		
		g("photoinfo").style.width = p(jsRF * 70) + "px";
		g('photoinfo').style.left = rxpos('Site')+ g("Site").offsetWidth - (g("photoinfo").offsetWidth) - p(jsRF * 13) + "px";			
		g('photoinfo').style.top = rypos('Site')+ p(jsRF * 470) + "px";
	
	
	
		//g("togglephoto").style.width = p(jsRF * 70) + "px";
		//g('togglephoto').style.left = rxpos('Site')+ g("Site").offsetWidth - (g("togglephoto").offsetWidth) - p(jsRF * 13) + "px";
		//g('togglephoto').style.top = rypos('Site')+ p(jsRF * 502) + "px";	
		//g('togglephoto').style.left = rxpos('Site') + p(jsRF * 616) + "px";		
		//g('togglephoto').style.top = rypos('Site')+ p(jsRF * 116) + "px";	


		g('Imgtxt').style.left = rxpos('Site') + g("Site").offsetWidth - g("Imgtxt").offsetWidth - p(jsRF * 20) + "px";
		g('Imgtxt').style.top = rypos('Site')+ p(jsRF * 356) + "px";
		g("Imgtxt").style.display = "none";	
		
		
		g('imgArrowLeft').style.left = rxpos('Site') + p(jsRF * 15) + "px";
		g('imgArrowLeft').style.top = rypos('Site')+ p(jsRF * 300) + "px";
		g("imgArrowLeft").style.display = "none";			

		g('imgArrowRight').style.left = rxpos('Site') + g("Site").offsetWidth - p(jsRF * 35) + "px";
		g('imgArrowRight').style.top = rypos('Site')+ p(jsRF * 300) + "px";
		g("imgArrowRight").style.display = "none";		




		// vedr. content

		g("divBoxCenterTextMaster").style.left = rxpos('Site') + p(jsRF * 300) + "px";
		g("divBoxCenterTextMaster").style.top = rypos('Site') + p(jsRF * 130) + "px";
		g("divBoxCenterTextMaster").style.width = p(jsRF * 400) + "px";
		g("divBoxCenterTextMaster").style.filter = "alpha(opacity=80);";
		g("divBoxCenterTextMaster").style.MozOpacity  = 0.8;

		g("imgArrowScrolbarBoxCenterUp").style.left = rxpos("divBoxCenterTextMaster") + g("divBoxCenterTextMaster").offsetWidth - jsRF*10 - g("imgArrowScrolbarBoxCenterUp").offsetWidth /2 + "px";
		g("imgArrowScrolbarBoxCenterUp").style.top  = rypos("divBoxCenterTextMaster") + p(jsRF * 10) + "px";

		g("imgArrowScrolbarBoxCenterDown").style.left = rxpos("imgArrowScrolbarBoxCenterUp") + "px";
		g("imgArrowScrolbarBoxCenterDown").style.top  = rypos("divBoxCenterTextMaster") + g("divBoxCenterTextMaster").offsetHeight - g("imgArrowScrolbarBoxCenterDown").offsetHeight - p(jsRF * 10)+ "px";
	
		g("divScrollbarBoxCenter").style.left   = rxpos("imgArrowScrolbarBoxCenterUp") + g("imgArrowScrolbarBoxCenterUp").offsetWidth/2 + "px";
		g("divScrollbarBoxCenter").style.top    = rypos("imgArrowScrolbarBoxCenterUp") + jsRF*10 + "px";
		g("divScrollbarBoxCenter").style.height = rypos("imgArrowScrolbarBoxCenterDown") - g("imgArrowScrolbarBoxCenterDown").offsetHeight + jsRF*2 - rypos("divScrollbarBoxCenter") + "px";

		g("divScrollSliderBoxCenter").style.top = rypos("divScrollbarBoxCenter")+ "px";
		g("divScrollSliderBoxCenter").style.left = rxpos("divScrollbarBoxCenter") - g("divScrollSliderBoxCenter").offsetWidth/2 + "px";				



		if (scrollerBoxCenter == null)
		{
			scrollerBoxCenter = new textScroller(1);
		}
		scrollerBoxCenter.masterobj = 'divBoxCenterTextMaster';
		scrollerBoxCenter.scrollerobj = 'divBoxCenterTextDocument';
		scrollerBoxCenter.scrollbar = 'divScrollbarBoxCenter';
		scrollerBoxCenter.arrowobj = 'divScrollSliderBoxCenter'; //fake shit
		scrollerBoxCenter.scrollslider = 'divScrollSliderBoxCenter';
		scrollerBoxCenter.prepare();	

		// End vedr. content


		//alert(arrPageImagestxt[intCurrImg] != "<br><br>");
		/*
				if( arrPageImagestxt[intCurrImg] != "<br><br>"){
					g("photoinfo").style.display = "block";
				}else{
					g("photoinfo").style.display = "none";
				}	
		*/
		if( typeof(arrPageImagestxt[intCurrImg]) != "undefined" && arrPageImagestxt.length > 0 && arrPageImagestxt[0] != "<br><br>"){
			
			g("photoinfo").style.display = "block";
		}else{
			g("photoinfo").style.display = "none";
		}	


	}else{
			// Forside elementer:	
		
		// Ny scroll bar tekster i højre side .d31/1-2012
			
		g("divBoxRightTextMaster").style.left = rxpos('Logo')+ p(jsRF * 1) + "px";
		g("divBoxRightTextMaster").style.top = rypos('Logo') + g("Logo").offsetHeight - p(jsRF * 10) + "px";
		g("divBoxRightTextMaster").style.width = p(jsRF * 200) + "px";
		g("divBoxRightTextMaster").style.filter = "alpha(opacity=80);";
		g("divBoxRightTextMaster").style.MozOpacity  = 0.8;

		g("imgArrowScrolbarBoxRightUp").style.left = rxpos("divBoxRightTextMaster") + g("divBoxRightTextMaster").offsetWidth - jsRF*10 - g("imgArrowScrolbarBoxRightUp").offsetWidth /2 + "px";
		g("imgArrowScrolbarBoxRightUp").style.top  = rypos("divBoxRightTextMaster") + p(jsRF * 10) + "px";

		g("imgArrowScrolbarBoxRightDown").style.left = rxpos("imgArrowScrolbarBoxRightUp") + "px";
		g("imgArrowScrolbarBoxRightDown").style.top  = rypos("divBoxRightTextMaster") + g("divBoxRightTextMaster").offsetHeight - g("imgArrowScrolbarBoxRightDown").offsetHeight - p(jsRF * 10)+ "px";
	
		g("divScrollbarBoxRight").style.left   = rxpos("imgArrowScrolbarBoxRightUp") + g("imgArrowScrolbarBoxRightUp").offsetWidth/2 + "px";
		g("divScrollbarBoxRight").style.top    = rypos("imgArrowScrolbarBoxRightUp") + jsRF*10 + "px";
		g("divScrollbarBoxRight").style.height = rypos("imgArrowScrolbarBoxRightDown") - g("imgArrowScrolbarBoxRightDown").offsetHeight + jsRF*2 - rypos("divScrollbarBoxRight") + "px";

		g("divScrollSliderBoxRight").style.top = rypos("divScrollbarBoxRight")+ "px";
		g("divScrollSliderBoxRight").style.left = rxpos("divScrollbarBoxRight") - g("divScrollSliderBoxRight").offsetWidth/2 + "px";				


if (scrollerBoxRight == null)
		{
			scrollerBoxRight = new textScroller(1);
		}
		scrollerBoxRight.masterobj = 'divBoxRightTextMaster';
		scrollerBoxRight.scrollerobj = 'divBoxRightTextDocument';
		scrollerBoxRight.scrollbar = 'divScrollbarBoxRight';
		scrollerBoxRight.arrowobj = 'divScrollSliderBoxRight'; //fake shit
		scrollerBoxRight.scrollslider = 'divScrollSliderBoxRight';
		scrollerBoxRight.prepare();	
		
// Slut ny scroll bar

			g('LangSelection').style.left = rxpos('home_print_search')+ g("home_print_search").offsetWidth+ p(jsRF * 8) - 6 + "px";
			g('LangSelection').style.top = rypos('home_print_search')+ p(jsRF * 1) + "px";
								
		/*	g('frontContent').style.left = rxpos('Logo')+ p(jsRF * 1) + "px";
			g('frontContent').style.top = rypos('Logo') + g("Logo").offsetHeight - p(jsRF * 2) + "px";
			g("frontContent").style.filter = "alpha(opacity=80);";
			g("frontContent").style.MozOpacity  = 0.8;			*/

			g('divContentsFlash').style.left = rxpos('Site')+ p(jsRF * 12) + "px";
			g('divContentsFlash').style.top = rypos('Site')+ p(jsRF * 61) + "px";
			
			//g('frontmap').style.left = rxpos('Site')+ p(jsRF * 12) + "px";
			//g('frontmap').style.top = rypos('Site')+ p(jsRF * 61) + "px";

			//g("togglephotofront").style.width = p(jsRF * 70) + "px";
			//g('togglephotofront').style.left = rxpos('frontContent')+ g("frontContent").offsetWidth - (g("togglephotofront").offsetWidth) - p(jsRF * 0) + "px";		
			//g('togglephotofront').style.top = rypos('Site')+ p(jsRF * 514) + "px";	

			//g('dots_front_right').style.left = rxpos('frontContent') + p(jsRF * 0) + "px";
			//g('dots_front_right').style.top = rypos('divContentsFlash') + g("divContentsFlash").offsetHeight - g("dots_front_right").offsetHeight + "px";
			
			//g('frontNews').style.left = rxpos('Site')+ p(jsRF * 38) + "px";
			//g('frontNews').style.top = rypos('Site')+ p(jsRF * 404) + "px";			
			//g("frontNews").style.filter = "alpha(opacity=80);";
			//g("frontNews").style.MozOpacity  = 0.8;				

			//g('frontOffer').style.left = rxpos('Site')+ p(jsRF * 38) + "px";
			//g('frontOffer').style.top = rypos('Site')+ p(jsRF * 462) + "px";			
			//g("frontOffer").style.filter = "alpha(opacity=80);";
			//g("frontOffer").style.MozOpacity  = 0.8;		


			

	}

blnFirstRun = false;
	
}

