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();
	
}
