function validateText(text) {
	text = text.replace(/Æ/g, "&AElig;");
	text = text.replace(/Ø/g, "&Oslash;");
	text = text.replace(/Å/g, "&Aring;");
	text = text.replace(/æ/g, "&aelig;");
	text = text.replace(/ø/g, "&oslash;");
	text = text.replace(/å/g, "&aring;");
	text = text.replace(/Ä/g, "&Auml;");
	text = text.replace(/ä/g, "&auml;");
	text = text.replace(/Ë/g, "&Euml;");
	text = text.replace(/ë/g, "&euml;");
	text = text.replace(/Ö/g, "&Ouml;");
	text = text.replace(/ö/g, "&ouml;");
	text = text.replace(/é/g, "&eacute;");
	return text;
}

function openChat(url, width, height){
	day = new Date();
	id = day.getTime();
	var top = (screen.height / 2) - (height / 2);
	var left = (screen.width / 2) - (width / 2);
	var features = 'height=' + height + ',width=' + width + ',top=' + top + ',left=' + left + ",toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0";
	eval("page" + id + " = window.open(url, '" + id + "', '" + features + "');");
}

function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

function printSelection(node){
	var content=node.innerHTML
	var pwin=window.open('','print_content','width=100,height=100');
	pwin.document.open();
	pwin.document.write('<html><body onload="window.print()">'+content+'</body></html>');
	pwin.document.close();
	setTimeout(function(){pwin.close();},1000);
}
