active = '';
imgs = new Array();
iko = new Array();
param = '';
pic = '';

iko['onlineikke billedeikke favoritikke ignored'] = 'ikon_online.gif';
iko['onlineikke billedefavoritikke ignored'] = 'ikon_online_favorit.gif';
iko['onlinebilledeikke favoritikke ignored'] = 'ikon_online_foto.gif';
iko['onlinebilledefavoritikke ignored'] = 'ikon_online_favorit_cam.gif';
iko['onlineikke billedeikke favoritignored']	= 'ikon_online_ignored.gif';
iko['onlineikke billedefavoritignored'] = 'ikon_online_ignored.gif';
iko['onlinebilledeikke favoritignored'] = 'ikon_online_ignored_cam.gif';
iko['onlinebilledefavoritignored'] = 'ikon_online_ignored_cam.gif';

iko['offlineikke billedeikke favoritikke ignored'] = 'ikon_offline.gif';
iko['offlineikke billedefavoritikke ignored'] = 'ikon_offline_favorit.gif';
iko['offlinebilledeikke favoritikke ignored'] = 'ikon_offline_foto.gif';
iko['offlinebilledefavoritikke ignored'] = 'ikon_offline_favorit_cam.gif';
iko['offlineikke billedeikke favoritignored'] = 'ikon_offline_ignored.gif';
iko['offlineikke billedefavoritignored'] = 'ikon_offline_ignored.gif';
iko['offlinebilledeikke favoritignored'] = 'ikon_offline_ignored_cam.gif';
iko['offlinebilledefavoritignored'] = 'ikon_offline_ignored_cam.gif';

iko['awayikke billedeikke favoritikke ignored'] = 'ikon_away.gif';
iko['awayikke billedefavoritikke ignored'] = 'ikon_favorit_away.gif';
iko['awaybilledeikke favoritikke ignored'] = 'ikon_away_cam.gif';
iko['awaybilledefavoritikke ignored'] = 'ikon_favorit_away_cam.gif'; 
iko['awayikke billedeikke favoritignored'] = 'ikon_ignored_away.gif';
iko['awayikke billedefavoritignored'] = 'ikon_ignored_away.gif';
iko['awaybilledeikke favoritignored'] = 'ikon_ignored_away_cam.gif';
iko['awaybilledefavoritignored'] = 'ikon_ignored_away_cam.gif';


function resize(element,h,noscroll) {
	i = document.getElementById(element);
	i.style.height = h+'px';
	
	if (noscroll != 1) {
		top.scroll(0,0);
	}
}

function fixlinks() {
	for (var i=0;document.links.length>i;i++) {
		document.links[i].onfocus = document.links[i].blur;
	}
	
	for  (i=0;document.images.length>i;i++) {
		p = document.images[i].src;
		if (!imgs[p]) {
			imgs[p] = new Image();
			imgs[p].src = p;
		}
	}
}

function resize_billede(w, h) {
	obj = top.document.getElementById('billedboks');
	obj.style.width = w+'px';
	obj.style.height = (h+35)+'px';
	
	// Lægger overlay på
	olobj = top.document.getElementById('olpic');
	olobj.style.width = (w+40)+'px';
	olobj.style.height = (h+40)+'px';
	
	obj.focus();
}

var maxtop;
function visbillede(imgsrc, profilnavn, evt) {
	// Åbner billede i DIV som overlay
	if (profilnavn) {
		html  = '<h1 style="padding: 3px">'+profilnavn+'</h1>';
	} else {
		html = '';
	}
	html += '<img src="'+static_uri+top.rota(imgsrc)+'_big.jpg" id="profilpic" onload="top.resize_billede(this.width, this.height)" /><br />';
	html += '<img style="position: absolute; top: 0px; left: 0px" src="'+static_uri+'b.gif" id="olpic" onmouseup="top.hide_picture()" />';
	html += '<div style="position: relative; text-align: right; right: -15px">';
	html += '	<a href="javascript:top.hide_picture()"><img src="'+theme+'profil/billede/luk.gif" /></a>';
	html += '</div>';
	
	obj = top.document.getElementById('billedboks');
	obj.innerHTML = html;
	
	obj.style.display = 'block';
	
	obj.style.left = (theX+40)+'px';
	
	bund = posTop()+pageHeight();
	toppen = posTop();
	billede = 629+80;
	maxtop = Math.ceil((pageHeight()-billede)/2);
	obj.style.top = (posTop()+maxtop)+'px';
	
	ad = top.document.getElementById('if_ad');
	ad.style.display = 'none';
	
	// Stort banner, hvis findes
	ad300 = top.bf_content.document.getElementById('ad300x250');
	if (ad300 != 'null') {
		ad300.style.display = 'none';
	}
}

function photo(height,url) {
  photoWin=window.open(url,"",'height='+height+',width=460,top='+((screen.height-height)/2)+',left='+((screen.width-460)/2)+',scrollbars=no');
  if (parseInt(navigator.appVersion) >= 4){
		photoWin.window.focus();
	}
}

function photoProgress(height,url) {
  photoWinProgress=window.open(url,"",'height='+height+',width=460,top='+((screen.height-height)/2)+',left='+((screen.width-460)/2)+',scrollbars=no');
  if (parseInt(navigator.appVersion) >= 4){
		photoWinProgress.window.focus();
	}
}

function photoProgressDismiss() {
	if (typeof(photoWinProgress) != "undefined") {
		photoWinProgress.close();
		photoWinProgress = void(0);
		history.go(0);
	}
}

function toggleCheck(felt) {
	thisRow = top.bf_content.document.getElementById('tr'+felt);
	checkSet = top.bf_content.document.getElementById('del'+felt);
	checkSet.checked = !(checkSet.checked);
	
	if (checkSet.checked) {
		eval('row'+felt+' = "'+thisRow.className+'"');
		thisRow.className = 'm3';
	} else {
		eval('thisRow.className = row'+felt);
	}
}

function selectall(obj) {
	breve=obj.mails.elements;
	var thisrow;
	
	for (i=0; i<breve.length; i++) {
		if (breve[i].name=="del[]") {
			if (breve[i].checked) {
				breve[i].checked = 1;
			} else {
				breve[i].checked = 0;
			}
			toggleCheck(breve[i].value);
		}
	}
}

function quickinfo() {
	userlink=top.bf_content.chat_ieditor.document.getElementById('msg').to.value;
	if (userlink) {
		top.bf_content.location.href="/profile/chat_quickinfo.php?member="+userlink;
	}
} 

function drop(userid,room) {
	top.bf_content.chat_ieditor.document.getElementById('msg').to.value = userid;
	whatisit = top.bf_content.chat_ieditor.document.getElementById('msg').to.value;
	if (whatisit != userid) {
		top.bf_content.chat_ieditor.location.href= "/chat/chat_editor.php?room="+room+"&warn=1&member="+userid;
	}
	top.bf_content.chat_ieditor.document.getElementById('msg').txt1.focus();
}

function rightcss() {
	c  = '<style>';
	c += 'img {';
	c += '	border: none';
	c += '}';
	c += 'body {';
	c += '	background-color: '+bg_color+';';
	//c += '	background-image: url('+theme+'index/baggrund.jpg);';
	//c += '	background-repeat: repeat-x;';
	c += '	margin: 0px;';
	c += '}';
	c += '.status_bar_top {';
	c += '	background-image: url('+theme+'status/top.gif);';
	c += '	width: 160px;';
	c += '	cursor: pointer;';
	c += '}';
	c += '.status_bar_box {';
	c += '	background-image: url('+theme+'box/top.gif);';
	c += '	width: 160px;';
	c += '	height: 31px;';
	c += '	font-size: 11px;';
	c += '	vertical-align: middle;';
	c += '	line-height: 31px;';
	c += '}';
	c += '.status_bar_txt, .status_overskrift, .status_bar_top, .status_bar_box {';
	c += '	font-family: verdana, sans-serif;';
	c += '	font-weight: bold;';
	c += '	color: '+right_menu_color+';';
	c += '	text-align: center;';
	c += '}';
	c += '.status_bar {';
	c += '	font-family: verdana, sans-serif;';
	c += '	padding: 15px 10px 10px 10px;';
	c += '	color: white;';
	c += '	width: 140px;';
	c += '	background-color: '+body_bg+';';
	c += '}';
	c += '.status_bar_chat {';
	c += '	font-family: verdana, sans-serif;';
	c += '	padding: 1px 10px 3px 10px;';
	c += '	color: white;';
	c += '	width: 140px;';
	c += '	height: 13px;';
	c += '	position: relative;';
	c += '	background-color: '+body_bg+';';
	c += '	border-bottom: 1px solid '+moerk_ramme+';';
	c += '}';
	c += '.status_bar_mini {';
	c += '	background-image: url('+theme+'status/topmini.gif);';
	c += '	background-repeat: no-repeat;';
	c += '	width: 32px;';
	c += '	padding-right: 5px;';
	c += '	text-align: center;';
	c += '	height: 21px;';
	c += '}';
	c += '.status_bar_mini_txt {';
	c += '	font-family: verdana, sans-serif;';
	c += '	color: '+right_menu_color+';';
	c += '	font-size: 9px;';
	c += '	text-decoration: none;';
	c += '	padding-right: 4px;';
	c += '}';
	c += '.tbl130 {';
	c += '	width: 160px;';
	c += '}';
	c += '.pr {';
	c += '	color: '+status_link+';';
	c += '	line-height: 17px;';
	c += '}';
	c += '.status_profilnavn {';
	c += '	color: '+status_profilnavn+';';
	c += '	text-decoration: none;';
	c += '	font-weight: bold;';
	c += '	font-size: 16px;';
	c += '}';
	c += '.status_header {';
	c += '	color: '+status_header+';';
	c += '	text-decoration: none;';
	c += '	font-weight: bold;';
	c += '}';	
	c += '.status_online {';
	c += '	color: '+status_link+';';
	c += '	padding: 10px;';
	c += '	text-align: center;';
	c += '	background-color: '+status_online+';';
	c += '	width: 140px;';
	c += '}';	
	c += '.status_overskrift {';
	c += '	height: 31px;';
	c += '	width: 160px;';
	c += '	font-size: 11px;';
	c += '	vertical-align: middle;';
	c += '	line-height: 31px;';
	c += '	background-image: url('+theme+'status/header.gif);';
	c += '}';	
	c += '.status_kampagnelink {';
	c += '	color: '+status_link+';';
	c += '}';	
	
	c += 'td, .lister, h2, p, div {';
	c += '	font-size : 8pt;';
	c += '	font-family: verdana, sans-serif;';
	c += '}';
	c += '.tbl130 {';
	c += '	background-color: '+body_bg+';';
	c += '}';
	c += '.lister {';
	c += '	border : 1px solid Black;';
	c += '}';
	/*
	c += '.betalende {';
	c += '		background-color: #BBC7CE; margin: 2px;';
	c += '		border-top: 1px solid #B3BDC4;';
	c += '		border-bottom: 1px solid #B3BDC4;';
	c += '	}';
	*/
	c += '</style>';
	return c;
}

function css(h) {
	c  = '<style>';
	c += '#topmenu li:hover {';
	c += '	background: url("'+theme+'top/valgt.gif") repeat-x top left;';
	c += '}';
	c += '#pager_selection {';
	c += '	background-color: '+lys_ramme+'; text-align: right; display: none;';
	c += '}';
	c += '#pager_text {';
	c += '	background-image: url('+theme+'common/knap/middle.png);';
	c += '}';
 	c += '.ll{';
	c += '	overflow:hidden; white-space: nowrap; cursor: pointer;';
	c += '}';
	c += 'td, div{';
	c += '	font-family : Verdana,serif;';
	c += '	font-size : 8pt;';
	c += '}';
	c += '.priv {';
	c += '	Color: '+chat_priv+';';
	c += '}';
	c += '.menupunkt {';
	c += '	height: 31px;';
	c += '	text-align: center;';
	c += '	border-right: 1px solid '+menu_fb_border+';';
	c += '	cursor: pointer;';
	c += '}';	
	c += '.banner_bund {';
	c += '	background-image: url('+theme+'bund/baggrund.gif);';
	c += '	height: 26px;';
	c += '	width: 770px;';
	c += '	line-height: 26px;';
	c += '	text-align: center;';
	c += '}';	
	c += 'img {';
	c += '	border: none';
	c += '}';
	c += '.body {';
	c += '	background-color: '+bg_color+';';
	c += '	margin: 0px;';
	c += '}';
	c += '.toprow {';
	c += '	background-image: url('+theme+'top/topmenu.gif);';
	c += '	height: 89px;';
	c += '	width: 930px;';
	c += '	position: relative;';
	c += '}';
	c += 'table.tbl {';
	c += '	background-color: '+content_bg+';';
	c += '	width: 726px;';
	c += '}';
	c += '.innerdiv {';
	c += '	padding: 18px 22px 16px 22px;';
	c += '}';
	c += '.mailheader {';
	c += '	background-color: '+mail_header_bg+';';
	c += '	height: 20px;';
	c += '	color: '+mail_header_txt+';';
	c += '	padding: 4px;';
	c += '}';
	c += '.m1 {';
	c += '	background-color: '+m1_bg+';';
	c += '	line-height: 15px;';
	c += '	padding: 2px;';
	c += '}';
	c += '.m2 {';
	c += '	background-color: '+m2_bg+';';
	c += '	padding: 2px;';
	c += '	line-height: 15px;';
	c += '}';
	c += '.m3 {';
	c += '	background-color: '+m3_bg+';';
	c += '	padding: 2px;';
	c += '	line-height: 15px;';
	c += '}';
	c += 'h1{';
	c += '	font-size : 16px;';
	c += '	margin: 0px;';
	c += '	font-weight: bold;';
	c += '}';
	c += '.pager, .pager_valgt {';
	c += '	height: 16px;';
	c += '	width: 19px;';
	c += '	text-align: center;';
	c += '	cursor: pointer; float: left; margin: 1px; padding: 3px 0px 0px 0px';
	c += '}';	
	c += '.pager {';
	c += '	background-image: url('+theme+'pager/normal.gif);';
	c += '}';	
	c += '.pager_valgt {';
	c += '	background-image: url('+theme+'pager/valgt.gif);';
	c += '}';	
	c += '.gradientbg {';
	c += '	background-image: url('+theme+'common/gradientbg.jpg);';
	c += '}';	
	c += '.gradientbg_yellow {';
	c += '	background-image: url('+theme+'common/gradientbg_yellow.jpg);';
	c += '}';	
	c += 'form {';
	c += '	margin: 0px;';
	c += '}';	
	c += '.topbdrl, .topbdrr, .topbdrli {';
	c += '	border-top: 2px solid white;';
	c += '	padding-left: 5px';
	c += '}';	
	c += '.topbdrr {';
	c += '	color: #212121;';
	c += '}';	
	c += '.topbdrli {';
	c += '	border-left: 2px solid white;';
	c += '	color: #818181;';
	c += '}';	
	c += '.topbdrl, .home_link {';
	c += '	color: #818181;';
	c += '	text-decoration: none;';
	c += '}';	
	c += '.home_link {';
	c += '	color: #666666;';
	c += '	text-decoration: none;';
	c += '}';	
	c += '.lysbg {';
	c += '	background-color: '+lys_bg+';';
	c += '	padding-left: 10px;';
	c += '}';
	
	c += '.b2, .tma, #toplast, .tm {';
	c += '	background-color: white;';
	c += '}';
	c += '.tl {';
	c += '	font-family: verdana, sans-serif;';
	c += '	font-size: 10px;';
	c += '	text-decoration: none;';
	c += '}';
	c += '.tma, #toplast {';
	c += '	border-style: solid;';
	c += '	border-color: black;';
	c += '	width: 98px;';
	c += '}';
	c += '.tma {';
	c += '	border-width: 0px 0px 1px 1px;';
	c += '}';
	c += '#toplast {';
	c += '	border-width: 0px 1px 1px 0px;';
	c += '}';
	c += '.b2 {';
	c += '	margin: 0px;';
	c += '	padding: 0px;';
	c += '}';
	c += 'h1, h2, p, td, .lister, .fb {';
	c += '	font-family : Verdana, sans-serif;';
	c += '}';
	c += 'td, .lister, h2, p {';
	c += '	font-size : 8pt;';
	c += '}';
	c += 'h1, h2 {';
	c += '	font-weight : bold;';
	c += '}';
	c += 'hr {';
	c += ' height: 1px;';
	c += ' width: 100%;';
	c += '}';
	c += 'a, hr, .b2, .fb a, .fb a:hover, .fb a:active, .fb a:link {';
	c += '	color: black;';
	c += '}';
	c += '.lister {';
	c += '	border : 1px solid Black;';
	c += '}';
	c += '.fb {';
	c += '	width: 63px;';
	c += '	height: 20px;';
	c += '	font-size: 10px;';
	c += '	cursor: pointer;';
	c += '}';
	c += '.fb a, .fb a:hover, .fb a:active, .fb a:link {';
	c += '	background-color: inherit;';
	c += '	text-decoration: none;';
	c += '}';
	c += '.fbul, .tm {';
	c += '	border-style: solid;';
	c += '	border-color: black;';
	c += '	border-width: 0px 0px 1px 0px;';
	c += '}';
	c += '#fb_html {';
	c += '	height: 20px;';
	c += '}';
	/*
	c += '.bs, #topspace {';
	c += '	background-color: #9CA2AD;';
	c += '}';
	*/
	c += '#fb_html {';
	c += '	position: absolute;';
	c += '}';
	c += '#fb_html {';
	c += '	width: 300px;';
	c += '	left: 59px;';
	c += '	top: 98px;';
	c += '}';
	c += '#search_suggest {';
	c += '	position: absolute;';
	c += '	border: 1px solid '+lys_ramme+';';
	c += '	background-color: white;';
	c += '	width: 535px;';
	c += '	display: none;';
	c += '}';
	c += '.search_suggest_result {';
	c += '	margin: 4px;';
	c += '	padding: 3px;';
	c += '}';
	c += '.topborder {';
	c += '	border-top: 2px solid white;';
	c += '}';
	c += '.status_search {';
	c += '	border: 1px solid '+moerk_ramme+';';
	c += '	width: 115px;';
	c += '	position: relative;';
	c += '	float: left;';
	c += '}';
	c += '.gallery_picture {';
	c += '	border-color: '+m1_bg+';';
	c += '}';

	c += '</style>';
	return c;
}

// Udfaset 21/2/08
/*function getimg(img,ikon,param) {
	if (!imgs[img]) {
		imgs[img] = new Image();
		if (ikon) {
			imgs[img].src = static_uri+iko[img];
		} else {
			imgs[img].src = static_uri+img;
		}
	}
	return '<img src="'+imgs[img].src+'" alt="" border=0'+param+'>';
}*/

function emote(f,n) {
	h = '<html>';
	h += '<head>';
	h += '	<title>'+bf_emo+'</title>';
	h += '</head>';
	h += '<body style="background-color: '+lys_bg+';">';

	for (i=1;i<101;i++) {
		st = '0'+i;
		i = (st.length == 2) ? st : i;
		h += ' <a href="javascript:window.close();window.opener.top.doIt(\':'+i+':\',\''+f+'\',\''+n+'\')"><img src="'+static_uri+'emote/'+i+'.gif" border=0></a>';
	}

	h += '</body>';
	h += '</html>';
	
	win = window.open('','emote','width=480,height=300,menubar=no,scrollbars=no,toolbar=no,location=no,status=no,directories=no,resizable=no,top=100,left=100');
	win.document.write(h);
}

function doIt(emote,fname,tname) {
	eval('top.bf_content.document.'+fname+'.'+tname+'.value=top.bf_content.document.'+fname+'.'+tname+'.value+emote');
}

function ie_emote() {
	h = '<html>';
	h += '<head>';
	h += '	<title>'+bf_emo+'</title>';
	h += '</head>';
	h += '<body style="background-color: '+lys_bg+';">';

	for (i=1;i<101;i++) {
		st = '0'+i;
		i = (st.length == 2) ? st : i;
		h += ' <a href="javascript:window.close();window.opener.top.ie_doIt('+i+')"><img src="'+static_uri+'emote/'+i+'.gif" border=0></a>';
	}

	h += '</body>';
	h += '</html>';
	
	win = window.open('','emote','width=480,height=300,menubar=no,scrollbars=no,toolbar=no,location=no,status=no,directories=no,resizable=no,top=100,left=100');
	win.document.write(h);
}

function ie_doIt(emote) {
	obj = top.bf_content.document.getElementById("tekstfelt");
	
	emohtml = '<img src="'+static_uri+'emote/'+emote+'.gif">';
	
	obj.focus();
	range = top.bf_content.document.selection.createRange();
	range.pasteHTML(emohtml);
}

function remote_buy(id) {
	document.forms.remote_buy_form.subscription.value = id;
	document.forms.remote_buy_form.submit();
}

function remote_validation() {
	document.forms.remote_validation_form.submit();
}

function sms_buy(id) {
	window.open('/products/sms_buy.php','sms_buy','width=350,height=280,menubar=no,scrollbars=no,toolbar=no,location=no,directories=no,resizable=no');
}

function download_attachment(id) {
	document.forms.download_attachment_form.attachment.value = id;
	document.forms.download_attachment_form.submit();
}

// Mouseover profil description
function mouseposition_content(where) {
	obj = eval('top.'+where+'.document');
	obj.onmousemove = register_content;
}

// Mouseover profil description
function mouseposition_remote(where) {
	where.onmousemove = register_remote;
}

function register_content(e) {
	if (!e) {
		e = top.if_content.event;
	}
	
	if (e['clientX'] != 'undefined') {
		theX = e['clientX'];
		theY = e['clientY'];
	} else {
		theX = e['pageX'];
		theY = e['pageY'];
	}
}

function register_remote(e) {
	if (!e) {
		e = top.event;
	}
	
	if (e['clientX'] != 'undefined') {
		theX = e['clientX'];
		theY = e['clientY'];
	} else {
		theX = e['pageX'];
		theY = e['pageY'];
	}
}

function changedisplay(obj) {
	if (show == 1) {
		obj.style.display = 'block';
	} else {
		obj.style.display = 'none';
	}
}

function small_description(o, navn,alder,sted,pic,gender_target) {
	obj = document.getElementById(o);
	obj.style.display = 'none';
	
	if (gender_target == 'mand') {
		target = fyre;
	} else if (gender_target == 'kvinde') {
		target = piger;
	} else {
		target = begge_dele;
	}
	
	c = alder+' '+d_alderfra+' '+sted+'<br>'+d_derertil+' '+target;
	
	html  = '	<table cellspacing="0" cellpadding="0" style="background-color: #ffffcc; padding: 1px; border: 1px solid black; width: 140px">';
	
	if (pic != '' && pic) {
		html += '		<tr>';
		html += '			<td align="center"><img src="'+static_uri+'../'+pic+'_thumb.jpg" style="border: 1px solid black" /><br /><hr /></td>';
		html += '		</tr>';
	}
	
	html += '		<tr>';
	html += '			<td style="color: black">';
	html += '				<b>'+navn+'</b><br>';
	html += '				<div style="padding-left: 3px">'+c+'</div>';
	html += '			</td>';
	html += '		</tr>';
	html += '	</table>';
	
	obj.innerHTML = html;
	
	setTimeout('changedisplay(obj)',500);
}

function set_refresh_banner() {
	setInterval("refresh_banner()", 90000);
}

function refresh_banner() {
	top.frames.bf_ad.location.href = '/s.php?sid='+sid+'&area='+user_area;
}

function menuclick(loc) {
	top.frames.bf_content.location.href = loc;
}

function admin_menuclick(loc) {
	top.frames.bf_team.location.href = loc;
}

function pngfix(where) {
	var arVersion = navigator.appVersion.split("MSIE");
	var version = parseFloat(arVersion[1]);
	
	if ((version >= 5.5 && version < 7) && (where.body.filters))  {
		for(var i=0; i<where.images.length; i++) {
			var img = where.images[i]
			
			if (img.src.substring(img.src.length-3, img.src.length) == "png") {
				var imgStyle = "display:inline-block;" + img.style.cssText 
				
				if (img.align == "left") {
					imgStyle = "float:left;" + imgStyle
				} else if (img.align == "right") {
					imgStyle = "float:right;" + imgStyle
				} else if (img.parentElement.href) {
					imgStyle = "cursor: pointer;" + imgStyle
				}
				
				img.outerHTML = "<span style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
				+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
				+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
				i--;
			}
		}
	}
}

function showmail(arkiv, id, mode) {
	top.frames.bf_content.location.href = '/mail/show.php?archive='+arkiv+'&mode='+mode+'&key='+id;
}

function afspil() {
	if (browser == 'IE') {
		document.getElementById('lydting').volume = 0;
		document.getElementById('lydting').src = document.getElementById('lydting').src;
		document.getElementById('lydting').volume = -10000;
	} else {
		document.getElementById('lydting').Play();
	}
}

function thread_fokus(id, forum) {
	top.bf_content.document.location.href = '/forum/thread_focus.php?id='+id+'&forum='+forum;
}

function visvideo(user) {
	if (pic) {
		pic.close();
	}

	pic = window.open('/video/vis_videoprofil.php?id='+user,'visbillede','width=320,height=280,menubar=no,scrollbars=no,toolbar=no,location=no,directories=no,resizable=no');
}

// Ajax til folket
var xmlhttp = null;

function XMLhttp() {
	if (window.XMLHttpRequest) {
		// code for IE7, Firefox, Mozilla, etc.
		obj = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		// code for IE5, IE6
		obj = new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	if (obj != null) {
		return obj;
	} else {
		return false;
	}
}

// Newsticker
var news = null;

function start_news() {
	load_news();
	setInterval('load_news()', 1800000);
	setInterval('displayticker(news, tickerid)', 15000);
}

function load_news() {
	url = '/xml/newsticker.php';
	xmlhttp = XMLhttp();
	if (xmlhttp) {
		xmlhttp.onreadystatechange = fetch_news;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}
}

function fetch_news() {
	if (xmlhttp.readyState != 4) return;

	if (xmlhttp.status != 200) {
	  return;
  }

	news = xmlhttp.responseXML.documentElement.getElementsByTagName("item");
	
	displayticker(news, tickerid);
}

var tickerid = 0;
function displayticker(news, tickerid) {
	if (news.length >= 1) {
	  xx = top.news[tickerid].getElementsByTagName("link");
		newslink = '/news/link.php?id='+xx[0].firstChild.nodeValue;

	  xx = top.news[tickerid].getElementsByTagName("title");
		txt  = '<a href="'+newslink+'" target="_blank" style="text-decoration: none; color: '+newsticker+'; font-weight: bold">'+xx[0].firstChild.nodeValue+'</a><br >';
		
		xx = top.news[tickerid].getElementsByTagName("medie");
		txt += '<div style="text-align: right; width: 150px; font-size: xx-small">- <a href="'+newslink+'" target="_blank" style="text-decoration: none; color: '+newsticker+'">'+xx[0].firstChild.nodeValue+'</a></div>';
		
		document.getElementById('newsticker').innerHTML = txt;
		
		if (top.tickerid == top.news.length-1) {
			top.tickerid = 0;
		} else {
			top.tickerid++;
		}
	}
}

// Onlinestatus når man ikke er logget på
var xmlonlinestatus = null;
function load_online_status() {
	xmlonlinestatus = XMLhttp();
	if (xmlonlinestatus) {
		xmlonlinestatus.onreadystatechange = fetch_online_status;
		xmlonlinestatus.open("GET",'/xml/onlinestatus.php',true);
		xmlonlinestatus.send(null);
	}
}

function fetch_online_status() {
	if (xmlonlinestatus.readyState != 4) return;

	if (xmlonlinestatus.status != 200) {
	  return;
  }

	online_status = xmlonlinestatus.responseXML.documentElement.getElementsByTagName("item");
	update_online_status(online_status);
}

function update_online_status() {
	xx = online_status[0].getElementsByTagName("online");
	xy = online_status[0].getElementsByTagName("profiler");
  document.getElementById('status_online').innerHTML = xx[0].firstChild.nodeValue;
  document.getElementById('status_profiler').innerHTML = xy[0].firstChild.nodeValue;
}

function set_online_updater() {
	setInterval('load_online_status()', 60000);
}

// Opdaterer statusbaren
var xmlstatusbar = null;
function load_statusbar() {
	xmlstatusbar = XMLhttp();
	if (xmlstatusbar) {
		xmlstatusbar.onreadystatechange = fetch_statusbar;
		xmlstatusbar.open("GET",'/xml/statusbar.php',true);
		xmlstatusbar.send(null);
	}
}

function show_being_updated() {
	obj = document.getElementById('status_update_on');
	obj.style.display = 'block';
	obj.innerHTML = '<div style="font-style: italic">'+txt_opdaterer+'</div>';
	obj.style.color = 'white';
	
	obj2 = document.getElementById('status_update_off');
	obj2.style.display = 'none';
	
	setTimeout('hide_being_updated()', 750);
}

function hide_being_updated() {
	obj = document.getElementById('status_update_on');
	obj.style.display = 'none';
	obj.style.color = 'white';
	
	obj2 = document.getElementById('status_update_off');
	obj2.style.display = 'block';
	//obj = document.getElementById('status_update');
	//obj.innerHTML = '<div></div>';
	//obj.style.color = body_bg;
}

function start_statusbar() {
	load_statusbar();
	setInterval('load_statusbar()', 90000);
}

function fetch_statusbar() {
	if (xmlstatusbar.readyState != 4) return;

	if (xmlstatusbar.status != 200) {
	  return;
  }

	// Skal der spilles en post-lyd?
	postlyd = xmlstatusbar.responseXML.documentElement.getElementsByTagName("post_lyd");
	posthtml = '';
	if (postlyd.length == 1) {
		if (browser == 'IE') {
			posthtml = '<embed autostart="true" hidden="true" src="'+static_uri+maillyd_src+'">';
		} else {
			posthtml = '<embed autostart="true" hidden="true" src="'+static_uri+maillyd_src+'">';
		}
	}
	
	// Opdaterer posten
	post = xmlstatusbar.responseXML.documentElement.getElementsByTagName("post");
	
	if (post.length >= 1) {
		for (i=0;i<post.length;i++) {
			xx = post[i].getElementsByTagName('mail');
			id = xx[0].firstChild.nodeValue;
			xx = post[i].getElementsByTagName('icon');
			icon = xx[0].firstChild.nodeValue;
			xx = post[i].getElementsByTagName('username');
			username = xx[0].firstChild.nodeValue;
			
			posthtml += '<div style="width: 140px; overflow: hidden; height: 20px; white-space: nowrap">';
			posthtml += icon+"\n";
			posthtml += '<a href="/mail/show.php?key='+id+'&mode=in" title="'+username+'" class="pr">'+username+'</a></div>';
		}
		
		obj = document.getElementById('post_container');
		obj.innerHTML = posthtml;
		obj.style.display = 'block';
		obj = document.getElementById('postikon');
		obj.style.display = 'block';
	} else {
		obj = document.getElementById('postikon');
		obj.style.display = 'none';
		obj = document.getElementById('post_container');
		obj.innerHTML = '';
		obj.style.display = 'none';
	}
	
	// Opdaterer gæstelisten
	guest = xmlstatusbar.responseXML.documentElement.getElementsByTagName("guests");
	guesthtml = '';
	
	if (guest.length >= 1) {
		for (i=0;i<guest.length;i++) {
			xx = guest[i].getElementsByTagName('profil');
			id = xx[0].firstChild.nodeValue;
			xx = guest[i].getElementsByTagName('icon');
			icon = xx[0].firstChild.nodeValue;
			xx = guest[i].getElementsByTagName('username');
			username = xx[0].firstChild.nodeValue;
			xx = guest[i].getElementsByTagName('box');
			box = xx[0].firstChild.nodeValue;
			
			guesthtml += '<div style="width: 140px; overflow: hidden; height: 20px; white-space: nowrap" '+box+'>';
			guesthtml += icon+"\n";
			guesthtml += '<a href="/profile/vis.php?member='+id+'" class="pr">'+username+'</a></div>';
			guesthtml += '<div id="guest'+id+'" style="display: none; position: absolute; z-index: 2000"></div>';
		}
		
		obj = document.getElementById('guest_container');
		obj.innerHTML = guesthtml;
	}
	
	// Opdaterer favoritterne
	favorite = xmlstatusbar.responseXML.documentElement.getElementsByTagName("favorites");
	favoritehtml = '';
	
	if (favorite.length >= 1) {
		for (i=0;i<favorite.length;i++) {
			xx = favorite[i].getElementsByTagName('profil');
			id = xx[0].firstChild.nodeValue;
			xx = favorite[i].getElementsByTagName('icon');
			icon = xx[0].firstChild.nodeValue;
			xx = favorite[i].getElementsByTagName('username');
			username = xx[0].firstChild.nodeValue;
			xx = favorite[i].getElementsByTagName('box');
			box = xx[0].firstChild.nodeValue;
			
			favoritehtml += '<div style="width: 140px; overflow: hidden; height: 20px; white-space: nowrap" '+box+'>';
			favoritehtml += icon+"\n";
			favoritehtml += '<a href="/profile/vis.php?member='+id+'" class="pr">'+username+'</a></div>';
			favoritehtml += '<div id="favs'+id+'" style="display: none; position: absolute; z-index: 2000"></div>';
		}
		
		obj = document.getElementById('favorite_container');
		obj.innerHTML = favoritehtml;
	}
	
	// Er cybersafe online?
	cybersafe = xmlstatusbar.responseXML.documentElement.getElementsByTagName("cybersafe");
	obj = document.getElementById('cybersafe_container');
	if (cybersafe.length == 1) {
		obj.innerHTML = '<a href="/profile/vis.php?member=462871"><img src="'+static_uri+'cs.gif" /></a>';
		obj.style.display = 'block';
	} else {
		obj.innerHTML = '';
		obj.style.display = 'none';
	}
	
	
	// Opdaterer onlinetallene
	onlinestatus = xmlstatusbar.responseXML.documentElement.getElementsByTagName("onlinestatus");
	
	if (onlinestatus.length == 1) {
		xx = onlinestatus[0].getElementsByTagName('online');
		online = xx[0].firstChild.nodeValue;
		
		xx = onlinestatus[0].getElementsByTagName('visits');
		visits = xx[0].firstChild.nodeValue;
		
		obj = document.getElementById('online_container');
		obj.innerHTML = online;
		
		obj = document.getElementById('visits_container');
		obj.innerHTML = visits;
	}
}

function update_online_status() {
	xx = online_status[0].getElementsByTagName("online");
	xy = online_status[0].getElementsByTagName("profiler");
  document.getElementById('status_online').innerHTML = xx[0].firstChild.nodeValue;
  document.getElementById('status_profiler').innerHTML = xy[0].firstChild.nodeValue;
}

function open_mini() {
	window.open('/remote/r.php', 'remote_bf', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=160,height=400');
}

var xmllistadd = null;
function load_list_add(profil) {
	xmllistadd = XMLhttp();
	if (xmllistadd) {
		xmllistadd.onreadystatechange = fetch_list_add;
		xmllistadd.open("GET",'/xml/list_additional.php?member='+profil,true);
		xmllistadd.send(null);
	}
}

function fetch_list_add() {
	if (xmllistadd.readyState != 4) return;

	if (xmllistadd.status != 200) {
	  return;
  }

	list_add = xmllistadd.responseXML.documentElement.getElementsByTagName("item");
	update_list_add(list_add);
}

function update_list_add(list_add) {
	xx = list_add[0].getElementsByTagName("interest");
  interest = xx[0].firstChild.nodeValue;
	
	if (interest > 0) {
		o = top.bf_content.document.getElementById('int'+interest);
		if (o) {
			o.className = 'm1';
		}
	}
	
	xx = list_add[0].getElementsByTagName("last_visited");
	o = top.bf_content.document.getElementById('last_visited');
	if (o) {
	  o.innerHTML = xx[0].firstChild.nodeValue;
	}
	
	xx = list_add[0].getElementsByTagName("last_written");
	o = top.bf_content.document.getElementById('last_written');
	if (o) {
	  o.innerHTML = xx[0].firstChild.nodeValue;
	}
	
	xx = list_add[0].getElementsByTagName("note_txt");
	if (xx[0].firstChild.nodeValue) {
		o = top.bf_content.document.getElementById('note_txt');
		if (o) {
		  o.innerHTML = xx[0].firstChild.nodeValue;
		}
	} else {
		o = top.bf_content.document.getElementById('note_row1');
		if (o) {
			o.style.display = 'none';
		}
		o = top.bf_content.document.getElementById('note_row2');
		if (o) {
			o.style.display = 'none';
		}
	}
}

// Viser ekstra række i $_lists->write_line() ved mouseover
function show_list_info(id, picture, profil, username) {
	// Fjerner først evt. "gamle" bokse
	if (top.hideID) {
		clearTimeout(top.hideID);
	}
	
	if (top.show && top.show != id) {
		remove_list_info_real(top.show);
	}
	
	// Laver HTML'en
	html  = '<div style="border: 1px solid '+lys_ramme+'; padding: 3px; position: absolute; background-color: white; margin-left: 20px" id="list_info_container" onmouseover="top.cancel_list_info_hide()" onmouseout="top.remove_list_info('+id+')">';
	if (picture != '') {
		html += '<div style="float: left; position: relative; width: 130px; text-align: center; overflow: hidden">';
		html += '	<img src="'+static_uri+'../'+rota(picture)+'_thumb.jpg" style="border: 1px solid black" />';
		html += '	<a onclick="top.visbillede(\'../'+picture+'\',\''+username+'\')" href="javascript:void(0)"><img style="position: absolute; top: 0px; left: 0px; width: 130px; height: 130px" src="'+static_uri+'b.gif" /></a>';
		html += '</div>';
		twidth = 418;
	} else {
		twidth = 548;
	}
	
	html +=	'<table width="'+twidth+'" cellspacing=0 cellpadding=2 border=0 style="float: left; position: relative">';
	html +=	'		<tr class="m1">';
	html +=	'			<td>'+text1147+'</td>';
	html +=	'			<td>'+text1148+'</td>';
	html +=	'			<td>'+text1149+'</td>';
	html +=	'		</tr>';
	html +=	'		<tr>';
	html +=	'			<td style="padding: 3px">';
	html +=	'				<span id="int1"><img src="'+theme+'profil/interesse/0.gif" width=15 height=15 onclick="top.set_interest_level('+profil+', -2, this.parentNode)"></span>';
	html +=	'				<span id="int2"><img src="'+theme+'profil/interesse/1.gif" width=15 height=15 onclick="top.set_interest_level('+profil+', -1, this.parentNode)"></span>';
	html +=	'				<span id="int4"><img src="'+theme+'profil/interesse/2.gif" width=15 height=15 onclick="top.set_interest_level('+profil+', 1, this.parentNode)"></span>';
	html +=	'				<span id="int5"><img src="'+theme+'profil/interesse/3.gif" width=15 height=15 onclick="top.set_interest_level('+profil+', 2, this.parentNode)"></span>';
	html +=	'				<span id="int6"><img src="'+theme+'profil/interesse/4.gif" width=15 height=15 onclick="top.set_interest_level('+profil+', 3, this.parentNode)"></span>';
	html +=	'			</td>';
	html +=	'			<td id="last_visited"></td>';
	html +=	'			<td id="last_written"></td>';
	html +=	'		</tr>';
	html +=	'		<tr class="m1" id="note_row1">';
	html +=	'			<td style="padding-left: 3px" colspan="3">Note:</td>';
	html +=	'		</tr>';
	html +=	'		<tr id="note_row2">';
	html +=	'			<td style="padding: 3px" colspan="3"><div id="note_txt" style="overflow: hidden; width: '+(twidth-10)+'px; white-space: nowrap"></div></td>';
	html +=	'		</tr>';
	html +=	'	</table>';
	html +=	'</div>';
	
	row = top.bf_content.document.getElementById('row'+id);
	row.innerHTML = html;

	// Fetcher de data vi skal bruge
	load_list_add(profil);
	row.parentNode.style.display = 'block';
	
	// Finder højden på boksen
	container = top.bf_content.document.getElementById('list_info_container');
	
	theY+container
	top.bf_content.document.getElementById('outer').offsetHeight;

	divoffset = 100;
	divslutterher = top.bf_content.document.getElementById('outer').offsetHeight-divoffset;
	if (theY > divslutterher) {
		extendby = divslutterher + container.offsetHeight + divoffset;
	} else {
		extendby = divslutterher + divoffset;
	}
	
	// Resizer framen
	resize('if_content',extendby, 1);
	
	top.show = id;
}

function remove_list_info(profil) {
	// Sætter et delay for hvor lang tid der skal gå, før boksen forsvinder
	top.hideID = setTimeout('remove_list_info_real('+profil+')', 250);
}

function remove_list_info_real(profil) {
	tbl = top.bf_content.document.getElementById('row'+profil);
	if (tbl) {
		tbl.innerHTML = '';
		tbl.parentNode.style.display = 'none';
	}
	
	// Resizer framen
	resize('if_content',top.bf_content.document.getElementById('outer').offsetHeight, 1);
}

function cancel_list_info_hide() {
	clearTimeout(top.hideID);
}

var xmlinterest;
function set_interest_level(profil, level, knap) {
	xmlinterest = XMLhttp();
	if (xmlinterest) {
		xmlinterest.onreadystatechange = change_interest_level;
		xmlinterest.open("GET",'/xml/set_interest_level.php?profil='+profil+'&level='+level,true);
		xmlinterest.send(null);
	}
	
	top.knap = knap;
}

function change_interest_level() {
	if (xmlinterest.readyState != 4) return;

	if (xmlinterest.status != 200) {
	  return;
  }
	
	// Læser xml'en og ser hvad vi skal gøre
	ci = xmlinterest.responseXML.documentElement.getElementsByTagName("action");
  interest = ci[0].firstChild.nodeValue;
	
	if (interest == 'ok') {
		o = top.bf_content.document.getElementById('int1');
		if (o) {
			o.className = 'm2';
			top.bf_content.document.getElementById('int2').className = 'm2';
			top.bf_content.document.getElementById('int4').className = 'm2';
			top.bf_content.document.getElementById('int5').className = 'm2';
			top.bf_content.document.getElementById('int6').className = 'm2';
		}
		top.knap.className = 'm1';
	} else {
		// Subscription teaser
		listic = top.bf_content.document.getElementById('list_info_container');
		show_subscription_teaser(listic);
	}
}

var xmlteaser;
function show_subscription_teaser(insert) {
	xmlteaser = XMLhttp();
	if (xmlteaser) {
		xmlteaser.onreadystatechange = function() {
			if (xmlteaser.readyState != 4) return;
		
			if (xmlteaser.status != 200) {
			  return;
		  }
			
			// Indsætter html'en
			insert.innerHTML = xmlteaser.responseText;
		}
		xmlteaser.open("GET",'/xml/subscription_teaser.php',true);
		xmlteaser.send(null);
	}
}

function start_session_distribution() {
	document.forms.register_session.submit();
}

function rot( t, u, v ) {
 return String.fromCharCode( ( ( t - u + v ) % ( v * 2 ) ) + u );
}

function rota( s ) {
 var b = [], c, i = s.length,
  a = 'a'.charCodeAt(), z = a + 26,
  A = 'A'.charCodeAt(), Z = A + 26;
 while(i--) {
  c = s.charCodeAt( i );
  if( c>=a && c<z ) { b[i] = rot( c, a, 13 ); }
  else if( c>=A && c<Z ) { b[i] = rot( c, A, 13 ); }
  else { b[i] = s.charAt( i ); }
 }
 return b.join( '' );
}

/* Draggable elementer */
if  (document.getElementById){ (function(){
	//Stop Opera selecting anything whilst dragging.
	if (window.opera){
		document.write("<input type='hidden' id='Q' value=' '>");
	}

	var n = 500;
	var dragok = false;
	var y,x,d,dy,dx;

	function move(e){
		if (!e) e = window.event;
			if (dragok){
				d.style.left = dx + e.clientX - x + "px";
				d.style.top  = dy + e.clientY - y + "px";
				top.just_moved = 1;
				return false;
			}
		}

		function down(e){
			if (!e) e = window.event;
			var temp = (typeof e.target != "undefined")?e.target:e.srcElement;
			if (temp.tagName != "HTML"|"BODY" && temp.className != "dragclass"){
				temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement;
			}

			if (temp.className == "dragclass"){
				if (window.opera){
					document.getElementById("Q").focus();
				}

				dragok = true;
				temp.style.zIndex = n++;
				d = temp;
				dx = parseInt(temp.style.left+0);
				dy = parseInt(temp.style.top+0);
				x = e.clientX;
				y = e.clientY;
				document.onmousemove = move;
				
				top.just_moved = 0;
				return false;
			}
		}

		function up(){
			dragok = false;
			document.onmousemove = null;
		}

		document.onmousedown = down;
		document.onmouseup = up;
	})();
}

function hide_picture() {
	if (top.just_moved != 1) {
		top.document.getElementById('billedboks').style.display = 'none';
		ad = top.document.getElementById('if_ad');
		ad.style.display = 'block';
		
		ad300 = top.bf_content.document.getElementById('ad300x250');
		if (ad300 != 'null') {
			ad300.style.display = 'block';
		}
	}
}

// Søgefelt
// Ajax
var searchReq = top.XMLhttp();
var searchID;
var searchRow;

function mouse_clickSuggest(user) {
	top.bf_content.document.location.href = '/profile/vis.php?member='+user;
	ss = document.getElementById('search_suggest');
	ss.innerHTML = '';
	ss.style.display = 'none';
}

function mouse_moveSuggest(sel) {
	var offset = 1;
	// Markerer den rigtige række
	res = document.getElementById('searchResult');
	total = res.rows.length;
	for (i=0;i<total;i=i+offset) {
		res.rows[i].className = 'm1';
	}
	
	res.rows[sel].className = 'mailheader';
	
	searchRow = sel;
}

//Called from keyup on the search textbox.
//Starts the AJAX request.
function moveSuggest(e) {
	if(window.event) {
		keynum = e.keyCode;
	} else if (e.which) {
		keynum = e.which;
	}
	
	if (keynum == 38 || keynum == 40) {
		res = document.getElementById('searchResult');
		
		// Finder ud af hvad vi søger på, så vi kan beregne offset
		var offset = 1;
		
		if (res) {
			total = res.rows.length;
			// Laver alle rækker til class = m1
			
			// Markerer den rigtige række
			for (i=0;i<total;i=i+offset) {
				res.rows[i].className = 'm1';
			}
			
			if (keynum == 38) {
				searchRow = searchRow-offset;
			} else {
				if (searchRow == -1) {
					searchRow = 0;
				} else {
					searchRow = searchRow+offset;
				}
			}
			
			if (searchRow > total-1) {
				searchRow = 0;
			} else if (searchRow < 0) {
				searchRow = total-offset;
			}
			
			res.rows[searchRow].className = 'mailheader';
			linkRow = document.getElementById('link'+searchRow);
			document.forms.txtsf.action = '/profile/vis.php?member='+linkRow.innerHTML;
			//nameRow = document.getElementById('name'+searchRow);
			//document.forms.txtsf.txt.value = nameRow.innerHTML;
		}
	}
}

function searchSuggest(str, e) {
	if(window.event) {
		keynum = e.keyCode;
	} else if (e.which) {
		keynum = e.which;
	}
	
	if ((keynum < 37 || keynum > 40) && keynum != 13) {
		// Sætter formularens action
		document.forms.txtsf.action = '/search/soeg_submit.php';
		
		if (searchID) {
			clearTimeout(searchID);
		}
		
		str=str.replace(/\'/g,'\\\'');
		searchID = setTimeout("searchSuggest_run('"+str+"')", 250);
	}
}

function searchSuggest_run(str) {
	if (str == '') {
		var ss = document.getElementById('search_suggest');
		ss.innerHTML = '';
		ss.style.display = 'none';
	} else if (searchReq.readyState == 4 || searchReq.readyState == 0) {
		// Finder ud af hvad vi skal søge på
		searchReq.open("GET", '/xml/search_suggest.php?what=profilnavn&string=' + str, true);
		searchReq.onreadystatechange = handleSearchSuggest;
		searchReq.send(null);
	}
}

function handleSearchSuggest() {
	cssclass = 'm1';
	if (searchReq.readyState == 4) {
		var ss = document.getElementById('search_suggest');
		res = searchReq.responseXML.documentElement.getElementsByTagName("item");
		
		var offset = 1;
		
		if (res.length >= 1) {
			html = '<table cellspacing="0" cellpadding="3" style="margin: 3px" id="searchResult">';
			for (i=0;i<res.length;i++) {
				tekst = '';
				xx = res[i].getElementsByTagName('id');
				userid = xx[0].firstChild.nodeValue;
				xx = res[i].getElementsByTagName('icon');
				icon = xx[0].firstChild.nodeValue;
				xx = res[i].getElementsByTagName('username');
				username = xx[0].firstChild.nodeValue;
				xx = res[i].getElementsByTagName('gender');
				gender = xx[0].firstChild.nodeValue;
				xx = res[i].getElementsByTagName('target_gender');
				target_gender = xx[0].firstChild.nodeValue;
				xx = res[i].getElementsByTagName('target');
				gtarget = xx[0].firstChild.nodeValue;
				xx = res[i].getElementsByTagName('location');
				glocation = xx[0].firstChild.nodeValue;
				xx = res[i].getElementsByTagName('age');
				age = xx[0].firstChild.nodeValue;
				textobj = res[i].getElementsByTagName('text');
				if (textobj[0]) {
					tekst = textobj[0].firstChild.nodeValue;
				}
				
				html += '<tr style="cursor: pointer" class="m1" onmouseover="mouse_moveSuggest('+i*offset+')" onclick="mouse_clickSuggest('+userid+')">';
				html += '	<td align="right" style="width: 36px" class="topborder">'+icon+'</td>';
				html += '	<td style="width: 150px" class="topborder"><div style="width: 148px;" class="ll">'+username+'</div><span id="link'+(i*offset)+'" style="display: none">'+userid+'</span></td>';
				html += '	<td style="width: 40px" class="topborder">'+age+'&nbsp;'+text459+'</td>';
				html += '	<td valign="bottom" style="width: 35px" class="topborder">';
				html += '		<img src="'+top.static_uri+gender+'" />';
				html += '		<img src="'+top.static_uri+target_gender+'" />';
				html += '	</td>';
				html += '	<td style="width: 82px" class="topborder"><div style="width: 80px;" class="ll">'+gtarget+'</div></td>';
				html += '	<td style="width: 150px" class="topborder">'+glocation+'</td>';
				html += '</tr>';
				
				if (tekst) {
					html += '<tr>';
					html += '<td colspan="6" style="padding-bottom: 3px"><div style="overflow: hidden; width: 520px">'+tekst+'</div></td>';
					html += '</tr>';
				}
			}
			
			html += '</table>';
			
			ss.innerHTML = html;
			ss.style.display = 'block';
			searchRow = -1;
		} else {
			ss.innerHTML = '';
			ss.style.display = 'none';
		}
	}
}

function blur_hide_searchResult() {
	setTimeout('hide_searchResult()', 250);
}

function hide_searchResult() {
	obj = document.getElementById('search_suggest');
	obj.style.display = 'none';
}

// Minichat i statusbar
var minichat = null;
var minichat_runner;

function start_minichat() {
	load_minichat();
	minichat_runner = setInterval('load_minichat()', 20000);
}

function load_minichat() {
	url = '/xml/chat_content.php?count=5&where=mini';
	xmlhttpchat = XMLhttp();
	if (xmlhttpchat) {
		xmlhttpchat.onreadystatechange = fetch_minichat;
		xmlhttpchat.open("GET",url,true);
		xmlhttpchat.send(null);
	}
}

function fetch_minichat() {
	if (xmlhttpchat.readyState != 4) return;

	if (xmlhttpchat.status != 200) {
	  return;
  }

	minichatroom = xmlhttpchat.responseXML.documentElement.getElementsByTagName("room");
	
	if (minichatroom.length >= 1) {
		xx = minichatroom[0].getElementsByTagName("name");
		room = xx[0].firstChild.nodeValue;
		
		friobj = document.getElementById('status_bar_chat_room_fri');
		scoreobj = document.getElementById('status_bar_chat_room_score');
		privatobj = document.getElementById('status_bar_chat_room_privat');
		
		if (room == 'fri') {
			friobj.style.fontWeight = 'bold';
			scoreobj.style.fontWeight = 'normal';
			privatobj.style.fontWeight = 'normal';
		} else if (room == 'private') {
			friobj.style.fontWeight = 'normal';
			scoreobj.style.fontWeight = 'normal';
			privatobj.style.fontWeight = 'bold';
		} else {
			friobj.style.fontWeight = 'normal';
			scoreobj.style.fontWeight = 'bold';
			privatobj.style.fontWeight = 'normal';
		}
	}
	
	minichat = xmlhttpchat.responseXML.documentElement.getElementsByTagName("item");
	
	if (minichat.length >= 1) {
		i = 0;
		html = '';
		for (i=0;i<minichat.length;i++) {
		  xx = top.minichat[i].getElementsByTagName("writerid");
			writerid = xx[0].firstChild.nodeValue;
	
		  xx = top.minichat[i].getElementsByTagName("writername");
			writername = xx[0].firstChild.nodeValue;
	
		  xx = top.minichat[i].getElementsByTagName("txt");
			txt  = xx[0].firstChild.nodeValue;
			
			xx = top.minichat[i].getElementsByTagName("room");
			room = xx[0].firstChild.nodeValue;
			
			// Samler det hele til HTML
			if (room == 'private') {
				html += "<a href='/profile/vis.php?member="+writerid+"' style='color: "+chat_priv+"; text-decoration: none; font-weight: bold'>"+writername+"</a><span style='color: "+chat_priv+"'>: "+txt+"</span><br />";
			} else {
				html += "<a href='/profile/vis.php?member="+writerid+"' style='color: white; text-decoration: none; font-weight: bold'>"+writername+"</a>: "+txt+"<br />";
			}
		}
		
		document.getElementById('status_chat_content').innerHTML = html;
	} else {
		document.getElementById('status_chat_content').innerHTML = '';
	}
}

// Vælger chatrum
function select_chat(room) {
	url = '/xml/chat_content.php?count=5&where=mini&room='+room;
	xmlhttpchat = XMLhttp();
	if (xmlhttpchat) {
		xmlhttpchat.onreadystatechange = fetch_minichat;
		xmlhttpchat.open("GET",url,true);
		xmlhttpchat.send(null);
	}
}

function hide_minichat() {
	obj = document.getElementById('minichat_showhide');
	obj2 = document.getElementById('status_chat_header');
	obj3 = document.getElementById('status_chat_content');
	
	clearInterval(minichat_runner);
	
	obj2.style.display = 'none';
	obj3.style.display = 'none';
	
	obj.innerHTML = '<a class="status_bar_mini_txt" href="javascript:top.show_minichat();">vis</a>';
	change_mini_chat_status('off');
}

function show_minichat() {
	obj = document.getElementById('minichat_showhide');
	obj2 = document.getElementById('status_chat_header');
	obj3 = document.getElementById('status_chat_content');
	
	obj2.style.display = 'block';
	obj3.style.display = 'block';
	
	obj.innerHTML = '<a class="status_bar_mini_txt" href="javascript:top.hide_minichat();">skjul</a>';
	
	change_mini_chat_status('on');
	start_minichat();
}

// Slår minichatten til eller fra
function change_mini_chat_status(status) {
	url = '/xml/set_mini_chat_status.php?status='+status;
	xmlhttpchatmini = XMLhttp();
	if (xmlhttpchatmini) {
		xmlhttpchatmini.open("GET",url,true);
		xmlhttpchatmini.send(null);
	}
}

function pageWidth() {
	return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
}

function pageHeight() {
	return window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;
}

function posLeft() {
	return typeof window.pageXOffset != 'undefined' ? window.pageXOffset :document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;
}

function posTop() {
	return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;} function posRight() {return posLeft()+pageWidth();} function posBottom() {return posTop()+pageHeight();
}

function hide_miniinfo() {
	obj = document.getElementById('miniinfo_showhide');
	obj2 = document.getElementById('status_info_content');
	
	clearInterval(miniinfo_runner);
	
	obj2.style.display = 'none';
	
	obj.innerHTML = '<a class="status_bar_mini_txt" href="javascript:top.show_miniinfo();">vis</a>';
	change_mini_info_status('off');
}

function show_miniinfo() {
	obj = document.getElementById('miniinfo_showhide');
	obj2 = document.getElementById('status_info_content');
	
	obj2.style.display = 'block';
	
	obj.innerHTML = '<a class="status_bar_mini_txt" href="javascript:top.hide_miniinfo();">skjul</a>';
	
	change_mini_info_status('on');
	start_miniinfo();
}

// Slår miniinfo til eller fra
function change_mini_info_status(status) {
	url = '/xml/set_mini_info_status.php?status='+status;
	xmlhttpinfomini = XMLhttp();
	if (xmlhttpinfomini) {
		xmlhttpinfomini.open("GET",url,true);
		xmlhttpinfomini.send(null);
	}
}

// Infoticker
var miniinfo = null;

function start_miniinfo() {
	load_miniinfo();
	miniinfo_runner = setInterval('displayminiticker(miniinfo, minitickerid)', 15000);
}

function load_miniinfo() {
	url = '/xml/infoticker.php';
	xmlhttpinfo = XMLhttp();
	if (xmlhttpinfo) {
		xmlhttpinfo.onreadystatechange = fetch_miniinfo;
		xmlhttpinfo.open("GET",url,true);
		xmlhttpinfo.send(null);
	}
}

function fetch_miniinfo() {
	if (xmlhttpinfo.readyState != 4) return;

	if (xmlhttpinfo.status != 200) {
	  return;
  }

	miniinfo = xmlhttpinfo.responseXML.documentElement.getElementsByTagName("item");
	
	displayminiticker(miniinfo, minitickerid);
}

var minitickerid = 0;
function displayminiticker(miniinfo, minitickerid) {
	if (miniinfo.length >= 1) {
	  xx = top.miniinfo[minitickerid].getElementsByTagName("link");
		miniinfolink = xx[0].firstChild.nodeValue;

	  xx = top.miniinfo[minitickerid].getElementsByTagName("description");
		txt  = '<a href="'+miniinfolink+'" target="bf_content" style="text-decoration: none; color: '+newsticker+'; font-weight: bold">...'+xx[0].firstChild.nodeValue+'</a><br >';
		
		txt += '<div style="text-align: right; width: 135px; font-size: xx-small">- <a href="'+miniinfolink+'" target="bf_content" style="text-decoration: none; color: '+newsticker+'">læs mere</a></div>';
		
		document.getElementById('status_info_content').innerHTML = txt;
		
		if (top.minitickerid == top.miniinfo.length-1) {
			top.minitickerid = 0;
		} else {
			top.minitickerid++;
		}
	}
}

function banner_reload(adid) {
	top.frames.bf_ad.location.href = '/s.php?area='+user_area+'&sid='+sid+'&force='+adid;
}


/* Ads */
function hide_ad() {
	obj = document.getElementById('adoverlay');
	if (obj) {
		obj2 = document.getElementById('adframeoverlay');
				obj.style.display = 'none';
		obj2.src = 'about:blank';
	}
}

