function cleanUp (contentToBeCleanedUp, removing, trim) {
	switch (removing){
		case "font":
			return (contentToBeCleanedUp.replace(/<\/?font[^>]*>/ig, ""));
		break;
		case "span":
			return (contentToBeCleanedUp.replace(/<\/?span[^>]*>/ig, ""));
		break;
		case "clearAllTags":
			var cleanedUp = contentToBeCleanedUp.replace(/<br>/ig, "&br;");
			cleanedUp = cleanedUp.replace(/<p>/ig, "&br;");
			cleanedUp = cleanedUp.replace(/<\/?[^>]*>/ig, "");
			cleanedUp = cleanedUp.replace(/&br;/ig, " ");
			
			if (trim == '0') {
				trim = cleanedUp.length;
			}
			return (cleanedUp.substring(0, trim));
		break;
	}
}

function OpenBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) {

	if(window.screen)if(isCenter)if(isCenter=="true"){
		var myLeft = (screen.width-myWidth)/2;
		var myTop = (screen.height-myHeight)/2;
		features+=(features!='')?',':'';
		features+=',left='+myLeft+',top='+myTop;
  	}
  
	window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

function handleContactForm (formNumber) {
	
	currentForm = "contactForm_" + formNumber

	theForm = document.getElementById(currentForm);

	sendForm = true;
	var sendFormErrors = '';

	if (theForm.navn.value == "") {
		sendForm = false;
		sendFormErrors += '\nNavn';
	}
	
	if (theForm.telefon.value == "") {
		sendForm = false;
		sendFormErrors += '\nTelefon';
	}
	
	if (theForm.email.value == "") {
		sendForm = false;
		sendFormErrors += '\nEmail';
	}
	
	if (theForm.emne.value == "") {
		sendForm = false;
		sendFormErrors += '\nEmne';
	}
	
	if (theForm.besked.value == "") {
		sendForm = false;
		sendFormErrors += '\nBesked';
	}
	
	if (sendForm) {
		theForm.submit();
	} else {
		alert ("Du har ikke indtastet:\n" + sendFormErrors);
	}
} 

function clearContactForm (formNumber) {
	
	document.getElementById("contactForm_" + formNumber).reset();
	
}

function fnFlashBanner() {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="822" height="140" id="flashbanner" align="middle">')
		document.write('<param name="allowScriptAccess" value="sameDomain" />')
		document.write('<param name="allowFullScreen" value="false" />')
		document.write('<param name="movie" value="imgLoader2.swf" />')
		document.write('<param name="quality" value="high" />')
		document.write('<param name="wmode" value="transparent" />')
		document.write('<param name="bgcolor" value="#ffffff" />')
		document.write('<embed src="imgLoader2.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="822" height="140" name="flashbanner" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />')
	document.write('</object>\n')
}
