// http://www.thefutureoftheweb.com/blog/adddomloadeventaddDOMLoadEvent=(function(){var e=[],t,s,n,i,o,d=document,w=window,r='readyState',c='onreadystatechange',x=function(){n=1;clearInterval(t);while(i=e.shift())i();if(s)s[c]=''};return function(f){if(n)return f();if(!e[0]){d.addEventListener&&d.addEventListener("DOMContentLoaded",x,false);/*@cc_on@*//*@if(@_win32)d.write("<script id=__ie_onload defer src=//0><\/scr"+"ipt>");s=d.getElementById("__ie_onload");s[c]=function(){s[r]=="complete"&&x()};/*@end@*/if(/WebKit/i.test(navigator.userAgent))t=setInterval(function(){/loaded|complete/.test(d[r])&&x()},10);o=w.onload;w.onload=function(){x();o&&o()}}e.push(f)}})();addDOMLoadEvent(initPage);function initPage() {	if (!document.getElementById) return false;	//var imageList = document.body.getAttribute('className');	//if (!imageList) imageList = document.body.getAttribute('class');	var imageList = document.getElementById('Wrapper').getAttribute('className');	if (!imageList) imageList = document.getElementById('Wrapper').getAttribute('class');		// Only initiate fade-function if a class-attribute is present on the body-tag	// and only if it contains more than one image (separated by '::')	if (imageList && imageList.match('::')) {		//var widephotodiv = getElementsByClassName(document.getElementById('Main'), 'div', 'w558');	var widephotodiv = getElementsByClassName('w558','div','Main');		assignElementId(widephotodiv[0], 'img', 'thephoto');	var thephoto = document.getElementById('thephoto');	//var theimage = widephotodiv[0].childNodes[1];		var temp = document.createElement('div');	temp.setAttribute('id', 'photoholder');	widephotodiv[0].appendChild(temp);	temp.appendChild(thephoto);		//photoholderdiv[0].setAttribute('id','photoholder');	if (!document.getElementById('photoholder')) return false;	assignId('photoholder', 'img', 'thephoto');	var imageId = 'thephoto';	var image = document.getElementById(imageId);	loadNewPhoto();	}		if (document.getElementById('newsletterCheckbox')) {		document.getElementById('newsletterInput').style.display = 'none';		document.getElementById('newsletterCheckbox').getElementsByTagName('input')[0].onclick = function() { toggleInputs(this); }		//document.getElementById('newsletterCheckbox').style.backgroundColor = 'red';		//alert('ok'+document.getElementById('newsletterInput'));	}		//addRoundCorners( getElementsByClass('Projekt','div','Wrapper') );	//addRoundCorners( getElementsByClass(['Projekt','Model'],'div','Wrapper') );	addRoundCorners( getElementsByClassName('Projekt','div','Wrapper') );	addRoundCorners( document.getElementById('NewsletterBox') );}// Written by Jonathan Snook, http://www.snook.ca/jonathan// Add-ons by Robert Nyman, http://www.robertnyman.com//http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/function getElementsByClassName(strClassName, strTagName, oElm){	if (isString(oElm)) { oElm = document.getElementById(oElm); }	if (oElm == null) { oElm = document; }	if (strTagName == null) { strTagName = '*'; }	var arrElements = (strTagName == '*' && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);	var arrReturnElements = new Array();	strClassName = strClassName.replace(/\-/g, "\\-");	var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");	var oElement;	for(var i=0; i<arrElements.length; i++){		oElement = arrElements[i];		if(oRegExp.test(oElement.className)){			arrReturnElements.push(oElement);		}	}	return (arrReturnElements)}function addRoundCorners(e){	if (!e) { return false };	if (!isArray(e)) e = new Array(e);	for (j=0; j<e.length; j++) {		newDiv = document.createElement('div');		newDiv.className = "CornerTL";		e[j].appendChild(newDiv);		newDiv = document.createElement('div');		newDiv.className = "CornerTR";		e[j].appendChild(newDiv);        					newDiv = document.createElement('div');		newDiv.className = "CornerBL";		e[j].appendChild(newDiv);		newDiv = document.createElement('div');		newDiv.className = "CornerBR";		e[j].appendChild(newDiv);	}}// http://www.planetpdf.com/developer/article.asp?ContentID=testing_for_object_types_in_jafunction isString() {	if (typeof arguments[0] == 'string') return true;	if (typeof arguments[0] == 'object') {		var criterion = arguments[0].constructor.toString().match(/string/i); 		return (criterion != null);	}	return false;}// http://www.planetpdf.com/developer/article.asp?ContentID=testing_for_object_types_in_jafunction isArray() {	if (typeof arguments[0] == 'object') {		var criterion = arguments[0].constructor.toString().match(/array/i);		 return (criterion != null);		}	return false;}function toggleInputs(e) {	if (document.getElementById('newsletterCheckbox').getElementsByTagName('input')[0].checked == false) {		document.getElementById('newsletterInput').style.display = 'none';		//alert('false - '+e);	} else {		document.getElementById('newsletterInput').style.display = 'block';		//alert('true - '+e);	}}function delayFadeout() {	window.setTimeout("fadeOut('photoholder',100)", 4000);}function initNewImage() {	swapId('photoholder','temporaryholder');	removeAllChildren('temporaryholder');	setOpacity(document.getElementById('temporaryholder'), 100);	assignId('photoholder', 'img', 'thephoto');	loadNewPhoto();}function loadNewPhoto() {	if (!document.getElementById('temporaryholder')) {	var temp = document.createElement('div');	temp.setAttribute('id', 'temporaryholder');	//temp.setAttribute('class', 'w558');	var photoholder = document.getElementById('photoholder');	photoholder.parentNode.insertBefore(temp, photoholder);	}	// SI.Request.get(document.getElementById('nextPhoto').href, document.getElementById('temporaryholder'));	presentImageurl = document.getElementById('thephoto').src;	presentImage = presentImageurl.substring (presentImageurl.lastIndexOf('/') + 1, presentImageurl.length);	//var imageList = document.body.getAttribute('onload');	//imageList = imageList.replace(/initPage\(/, '');	//imageList = imageList.replace(/\'|\[|\]\);/g, '');	//imageList = imageList.split(',');		//var imageList = document.body.getAttribute('className');	//if (!imageList) imageList = document.body.getAttribute('class');	var imageList = document.getElementById('Wrapper').getAttribute('className');	if (!imageList) imageList = document.getElementById('Wrapper').getAttribute('class');	imageList = imageList.split('::');		//alert(imageList);	//alert(presentImage);		for(var i = 0; i < imageList.length; i++) {    	if (imageList[i] == presentImage) imageNo = (i + 1);    	if (imageNo >= imageList.length) imageNo = 0;	}		if (imageNo == imageList.length) imageNo = 0;			var imageTag = '<img width="558" height="212" src="/billeder/' + imageList[imageNo] + '" alt="" onload="delayFadeout();" />';		// <img width="487" height="542" src="/images/indgang.jpg" alt="" onload="delayFadeout();" />		//alert(imageTag);		setInnerHTML(document.getElementById('temporaryholder'), imageTag);}function swapId(firstId,secondId) {	var firstElement = document.getElementById(firstId);	firstElement.setAttribute('id','tempid');	var secondElement = document.getElementById(secondId);	secondElement.setAttribute('id',firstId);	var firstElement = document.getElementById('tempid');	firstElement.setAttribute('id',secondId);}function assignId(containerID, theElement, theID){	container = document.getElementById(containerID);	if (!container) return false;	for (i=0; i<container.childNodes.length; i++) {		node = container.childNodes[i];		if (node.nodeName.toLowerCase() == theElement) {			node.setAttribute('id',theID); }  	}}function assignElementId(container, theElement, theID){	if (!container) return false;	for (i=0; i<container.childNodes.length; i++) {		node = container.childNodes[i];		if (node.nodeName.toLowerCase() == theElement) {			node.setAttribute('id',theID); }  	}}function removeAllChildren(parentId){	theParent = document.getElementById(parentId);	if (!theParent) return false;	while (theParent.childNodes.length!=0) {    	theParent.removeChild(theParent.firstChild);	}}function fadeIn(objId,opacity) {	if (document.getElementById) {		obj = document.getElementById(objId);		if (opacity <= 100) {			setOpacity(obj, opacity);			opacity += 5;			window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 50);		} 	}}function fadeOut(objId,opacity) {	if (document.getElementById) {		obj = document.getElementById(objId);		if (opacity >= 0) {			setOpacity(obj, opacity);			opacity -= 5;			window.setTimeout("fadeOut('"+objId+"',"+opacity+")", 50);		} else {			initNewImage();		}	}}function setOpacity(obj, opacity) {	opacity = (opacity == 100)?99.999:opacity;	// IE/Win	obj.style.filter = "alpha(opacity:"+opacity+")";	// Safari<1.2, Konqueror	obj.style.KHTMLOpacity = opacity/100;	// Older Mozilla and Firefox	obj.style.MozOpacity = opacity/100;	// Safari 1.2, newer Firefox and Mozilla, CSS3	obj.style.opacity = opacity/100;}function wipeOut(objId, width) {	if (document.getElementById) {		obj = document.getElementById(objId);		if (width >= 0) {			theWidth = 487 - (487*((100-width)/100));			obj.style.width = Math.round(theWidth) + 'px';			//window.status = width + " / " + Math.round(theWidth) + 'px';			width -= 2;			window.setTimeout("wipeOut('"+objId+"',"+width+")", 25);		} else {			obj.style.width = '100px';			initNewImage();		}	}}function setInnerHTML(target, content) {	if (!SI) { var SI = new Object(); };	if (SI.IE && (target.nodeName == 'TBODY' || target.nodeName == 'TABLE'))	{		SI.IE.fixInnerHTML(target, content);	} else {		target.innerHTML = content;	}};