addDOMLoadEvent(addRoundCorner);addDOMLoadEvent(prepareLinks);function addRoundCorner(){	if (!document.getElementById) return false;	elements = document.getElementsByTagName("div");	 for (j=0; j<elements.length; j++) {        if (classTool('check',elements[j],'w558')) {        			newDiv = document.createElement('div');        			newDiv.className = "Corner";        			elements[j].appendChild(newDiv);        			}      }	// add icons to links	allLinks = document.getElementsByTagName('a');	for (i=0; i<allLinks.length; i++) {		node = allLinks[i];		if (node.parentNode.nodeName.toLowerCase() == 'p') {			nodeLink = node.href;			// alert(i +" - " + node + " - " + nodeLink.substr(nodeLink.length - 4) + " - " + nodeLink.indexOf('.flv') );			if ( nodeLink.indexOf('.pdf') == nodeLink.length - 4 ) { classTool('add',node,'Download-pdf'); }			if ( nodeLink.indexOf('.flv') == nodeLink.length - 4 ) { classTool('add',node,'Filmklip'); }			if ( nodeLink.indexOf('/flip/') != -1 ) { classTool('add',node,'PageFlip'); }			if ( nodeLink.indexOf('/fotogalleri/') != -1 ) {				classTool('add',node,'Hus-foto');				// node.onclick = function() { makePhotobox(this); return false; }			}			if ( nodeLink.indexOf('/plantegninger/') != -1 ) { classTool('add',node,'Plantegning'); }					}	}}/*function ajaxGo(url){	if (!document.getElementById) return false;	initLightbox();	SI.Request.get(url.href+'?ajax=true', document.getElementById('SLB_lightbox'));}*/function makePhotobox(linknode){	if (!document.getElementById) return false;	contentDiv = document.createElement('div');	contentDiv.setAttribute('id','Photobox');	insertAfter(contentDiv,linknode.parentNode);	SI.Request.get(linknode.href+'?ajax=true', document.getElementById('Photobox'));}function initPhotobox(){	prepareLinks();	backLink = document.createElement('p');	backLink.setAttribute('id','Backlink');	contentDiv = document.getElementById('Photobox');		//contentDiv.appendChild(backLink);		//var linkHtml = '<a href="#Luk" onclick="killPhotobox(); return false;">Tilbage</a>';	//setInnerHTML(backLink, linkHtml);		contentDiv.previousSibling.firstChild.onclick = null;	contentDiv.previousSibling.firstChild.onclick = function() { killPhotobox(); return false; }	}function killPhotobox(){	contentDiv.previousSibling.firstChild.onclick = null;	contentDiv.previousSibling.firstChild.onclick = function() { makePhotobox(this); return false; }			parentElement = document.body;	contentDiv = document.getElementById('Photobox');	contentDiv.parentNode.removeChild(contentDiv);}function insertAfter(newElement,targetElement) {	//target is what you want it to go after. Look for this elements parent.	var parent = targetElement.parentNode;		//if the parents lastchild is the targetElement...	if(parent.lastchild == targetElement) {		//add the newElement after the target element.		parent.appendChild(newElement);		} else {		// else the target has siblings, insert the new element between the target and it's next sibling.		parent.insertBefore(newElement, targetElement.nextSibling);		}}function ajaxDone(){	prepareLinks();	backLink = document.createElement('p');	backLink.setAttribute('id','Backlink');	document.getElementById('GalleryText').appendChild(backLink);		var linkHtml = '<a href="#Luk" onclick="killLightbox(); return false;">Tilbage</a>';	setInnerHTML(backLink, linkHtml);	}function initLightbox(){	overlayDiv = document.createElement('div');	overlayDiv.setAttribute('id','SLB_overlay');	document.body.appendChild(overlayDiv);		// show transparent overlay	overlayDiv.style.visibility = 'visible';		contentDiv = document.createElement('div');	contentDiv.setAttribute('id','SLB_lightbox');	document.body.appendChild(contentDiv);		// IE6 needs some special treatment	if (document.getElementById('IE') != null) {		ccdiv = document.getElementById('IE');		if (classTool('check',ccdiv,'lte6_0')) {			htmlElement = document.getElementsByTagName('html')[0];			htmlElement.style.overflow = 'hidden';		}	}		//var lightboxHtml = '<div id="Showcase"><div class="Image"><a href="#" onclick="killLightbox(); return false;"><img id="MAP_image" width="500" src="'+l.href+'" /></a><p id="MAP_caption">'+l.innerHTML+'</p></div></div>';	//setInnerHTML(contentDiv, lightboxHtml);}function killLightbox(){	parentElement = document.body;	contentDiv = document.getElementById('SLB_lightbox');	overlayDiv = document.getElementById('SLB_overlay');	parentElement.removeChild(contentDiv);	parentElement.removeChild(overlayDiv);		// IE6 needs some special treatment	if (document.getElementById('IE') != null) {		ccdiv = document.getElementById('IE');		if (classTool('check',ccdiv,'lte6_0')) {			htmlElement = document.getElementsByTagName('html')[0];			htmlElement.style.overflow = 'auto';		}	}}// ----------------------------------------------------------------------// All thumbnail links should be placed in a div with the id "Thumbs"// The targetphoto should have the id "BigPhoto"// Images and their thumbnails should be name like this...// original = "image.jpg" -> thumb = "image_thmb.jpg"// ----------------------------------------------------------------------/*function prepareLinks(){	if (!document.getElementById) return false;	navRoot = document.getElementById("Thumbs");	if (!navRoot) return false;	for (i=0; i<navRoot.childNodes.length; i++) {		node = navRoot.childNodes[i];		if (node.nodeName.toLowerCase() == "a") {			node.onclick = function() { changeImage(this); return false; }		if (i<=1) classTool('add',node,'On');  		 }  	}}*/function prepareLinks(){	if (!document.getElementById) return false;	navRoot = document.getElementById("Thumbs");	if (!navRoot) return false;	for (i=0; i<navRoot.childNodes.length; i++) {		theFirstChild = 0;		node = navRoot.childNodes[i];  				if (node.nodeName.toLowerCase() == "a") {			node.onclick = function() { changeImage(this); return false; }		if (i == theFirstChild) classTool('add',node,'On');  		} else {			theFirstChild++;			i = i - 1;			navRoot.removeChild(node);  		}  		  	}}function changeImage(l){	if (!document.getElementById) return false;	// while (l != document.body && l.nodeName.toLowerCase() != "a") l = l.parentNode;	//thumbUrl = l.childNodes[0].src;		//var urlSplit = thumbUrl.split('/');	//var thumbName = urlSplit[urlSplit.length-1];	//var photoName = thumbName.replace("_thmb", "");	//alert("*/img/" + photoName+"*");		//alert(l.href);	if (l.href.indexOf('#') == -1) {		var url = l.href;	} else {	var url = l.childNodes[0].id;		url = url.replace( /URL:/, "/" );		url = url.replace( /:/, "/" );		url = url.replace( /:/, "/" );	}			document.getElementById("BigPhoto").src = url; //("/images/gallery/" + photoName);	clearClasses();	classTool('add',l,'On');}function clearClasses(){	if (!document.getElementById) return false;		navRoot = document.getElementById("Thumbs");		for (i=0; i<navRoot.childNodes.length; i++) {			node = navRoot.childNodes[i];			if (node.nodeName.toLowerCase() == "a") {				classTool('remove',node,'On');		}	}}function classTool(a,o,c1,c2)// This function takes four parameters:// a = defines the action you want to perform// o = the object in question// c1 = the name of the first class// c2 = the name of the second class//// Possible actions are:// swap		= replaces class c1 with class c2 in object o// add		= adds class c1 to the object o// remove	= removes class c1 from the object o// check	= tests if class c1 is already applied to object o and return true or false{	switch (a)	{		case 'swap':			o.className=!classTool('check',o,c1)?o.className.replace(c2,c1):			o.className.replace(c1,c2);		break;		case 'add':			if(!classTool('check',o,c1)) {o.className+=o.className?' '+c1:c1;}		break;		case 'remove':			var rep=o.className.match(' '+c1)?' '+c1:c1;			o.className=o.className.replace(rep,'');		break;		case 'check':			return new RegExp('\\b'+c1+'\\b').test(o.className);		break;	}}