/* <![CDATA[ */
		
		//Begin: Browser detection
		var BrowserDetect = {
	        init: function () {
		        this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		        this.version = this.searchVersion(navigator.userAgent)
			        || this.searchVersion(navigator.appVersion)
			        || "an unknown version";
		        this.OS = this.searchString(this.dataOS) || "an unknown OS";
	        },
	        searchString: function (data) {
		        for (var i=0;i<data.length;i++)	{
			        var dataString = data[i].string;
			        var dataProp = data[i].prop;
			        this.versionSearchString = data[i].versionSearch || data[i].identity;
			        if (dataString) {
				        if (dataString.indexOf(data[i].subString) != -1)
					        return data[i].identity;
			        }
			        else if (dataProp)
				        return data[i].identity;
		        }
	        },
	        searchVersion: function (dataString) {
		        var index = dataString.indexOf(this.versionSearchString);
		        if (index == -1) return;
		        return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	        },
	        dataBrowser: [
		        {
			        string: navigator.userAgent,
			        subString: "Chrome",
			        identity: "Chrome"
		        },
		        { 	string: navigator.userAgent,
			        subString: "OmniWeb",
			        versionSearch: "OmniWeb/",
			        identity: "OmniWeb"
		        },
		        {
			        string: navigator.vendor,
			        subString: "Apple",
			        identity: "Safari"
		        },
		        {
			        prop: window.opera,
			        identity: "Opera"
		        },
		        {
			        string: navigator.vendor,
			        subString: "iCab",
			        identity: "iCab"
		        },
		        {
			        string: navigator.vendor,
			        subString: "KDE",
			        identity: "Konqueror"
		        },
		        {
			        string: navigator.userAgent,
			        subString: "Firefox",
			        identity: "Firefox"
		        },
		        {
			        string: navigator.vendor,
			        subString: "Camino",
			        identity: "Camino"
		        },
		        {		// for newer Netscapes (6+)
			        string: navigator.userAgent,
			        subString: "Netscape",
			        identity: "Netscape"
		        },
		        {
			        string: navigator.userAgent,
			        subString: "MSIE",
			        identity: "Explorer",
			        versionSearch: "MSIE"
		        },
		        {
			        string: navigator.userAgent,
			        subString: "Gecko",
			        identity: "Mozilla",
			        versionSearch: "rv"
		        },
		        { 		// for older Netscapes (4-)
			        string: navigator.userAgent,
			        subString: "Mozilla",
			        identity: "Netscape",
			        versionSearch: "Mozilla"
		        }
	        ],
	        dataOS : [
		        {
			        string: navigator.platform,
			        subString: "Win",
			        identity: "Windows"
		        },
		        {
			        string: navigator.platform,
			        subString: "Mac",
			        identity: "Mac"
		        },
		        {
			        string: navigator.platform,
			        subString: "Linux",
			        identity: "Linux"
		        }
	        ]

        };
        BrowserDetect.init();
		//End: Browser detection
		
		//Begin: Gets inner height of window
		function getWindowHeight() {
			var windowHeight = 0;
			if (typeof(window.innerHeight) == 'number') {
				windowHeight = window.innerHeight;
			}
			else {
				if (document.documentElement && document.documentElement.clientHeight) {
					windowHeight = document.documentElement.clientHeight;
				}
				else {
					if (document.body && document.body.clientHeight) {
						windowHeight = document.body.clientHeight;
					}
				}
			}
			return windowHeight;
		}
		//End: Gets inner height of window
		
		//Begin: Function to adjust width by one pixel so that body-background and content background line up
		function fjsAdjustWidth() {
		    
		    
		    var obj = document.getElementById("wrapper")
		    var iWidth = document.getElementById("body").offsetWidth
		    var iAdjust = 0;
		    //var strDebug = '(iWidth%2 != 0)='+ (iWidth%2 != 0) + " iWidth="+ iWidth +" offsetLeft=" + document.getElementById("wrapper").offsetLeft +' body.offsetWidth='+ iWidth;
		    
		    if (iWidth%2 != 0) {
		        if (BrowserDetect.browser.toLowerCase() != 'explorer') {
		            if (BrowserDetect.browser.toLowerCase() == 'firefox') {
		                iAdjust = -1;
		            } else {
		                iAdjust = 1;
		            }
		        }
		    }
		    
		    obj.style.left = iAdjust + 'px';
		    
		    //document.getElementById("debug2").innerHTML = strDebug + ' iAdjust=' + iAdjust;
		}
		//End: Function to adjust width by one pixel so that body-background and content background line up
		
		//Begin: Function that sets height and position af element that displays repeating backround below a certain height
		function setRepeatBackgroundDiv() {
		    var iBackgroundHeight = 947;
		    var iMysticalNumber;
			if (document.getElementById) {
				var windowHeight = getWindowHeight();
				var RepeatElementHeight;
				if (windowHeight > 0) {
				    var headerHeight = document.getElementById('header').offsetHeight;
					var contentHeight = document.getElementById('content').offsetHeight;
					var footerHeight = document.getElementById('footer').offsetHeight;
					var allElementHeight = headerHeight + contentHeight + footerHeight;
					var RepeatElement  = document.getElementById('PageBackground');
					
					iMysticalNumber = footerHeight;
					
					/*
					//Debugging
					alert('windowHeight='+windowHeight);
					alert('all element height='+parseInt(headerHeight+footerHeight+contentHeight,10));
					*/
					
					RepeatElement.style.top = iBackgroundHeight + 'px';
					if (windowHeight > iBackgroundHeight) {
					    if (windowHeight > allElementHeight) { 
					        RepeatElement.style.height = windowHeight - (iBackgroundHeight) + 'px';
					    } else {
					        RepeatElement.style.height = allElementHeight - (iBackgroundHeight) + 'px';
					    }
					} else if (allElementHeight > iBackgroundHeight) { 
					    if (allElementHeight > windowHeight) {
					        RepeatElement.style.height = allElementHeight - (iBackgroundHeight) + 'px';
					    } else {
					        RepeatElement.style.height = windowHeight - (iBackgroundHeight) + 'px';
					    }
					} else {
					    RepeatElement.style.top = '0px';
					    RepeatElement.style.height = '0px';
						RepeatElement.style.display = 'none';
					}
					
				}
			}
		}
		//End: Function that sets height and position af element that displays repeating backround below a certain height
		
		//Begin: position footer
		function setFooter() {
		    var iMysticalOffset = 180
		
            if (document.getElementById) {
                var windowHeight=getWindowHeight();
                if (windowHeight>0) {
                    var contentHeight = document.getElementById('content').offsetHeight;
                    var headerHeight = document.getElementById('header').offsetHeight;
                    var footerElement = document.getElementById('footer');
                    var footerHeight=footerElement.offsetHeight;
                    
                    //alert('contentHeight='+ contentHeight +' footerHeight='+ footerHeight +' windowHeight='+ windowHeight)
                    
                    if (windowHeight-(contentHeight+footerHeight)>= iMysticalOffset) {
                        footerElement.style.position='relative';
                        footerElement.style.top= (windowHeight-(contentHeight+footerHeight+headerHeight))+'px';
                        //footerElement.style.top= windowHeight+'px';
                    } else {
                        footerElement.style.position='static';
                    }
                    //alert('windowHeight='+windowHeight+' headerHeight='+headerHeight+' contentHeight='+contentHeight+' footerHeight='+footerHeight+' top-pos='+parseInt(windowHeight-(contentHeight+footerHeight+headerHeight)));
                }
            }
        }
		//End: position footer
		
// Start: Lag noe moro med lenker
function fjsLenkeMoro(strLenke){
    var strNyLenke = strLenke.replace(/bøllefrø(.*?)tekanne(.*?)/,"$1$2");
document.location.href = 'mailto:'+strNyLenke;
}
// Sluttt: Lag noe moro med lenker		

		window.onload = function() {
			setFooter();
		//	setRepeatBackgroundDiv();
			fjsAdjustWidth();
			
		}
		window.onresize = function() {
			setFooter();
			fjsAdjustWidth();
		}

		/* ]]> */