/**
 * forum.js - functielib voor Replique template
 */

function announce(topicid,title,posticon,starter,user,posts,lastpost) {document.write('<br style="font-size:4px;"><table width=763 cellspacing=0 cellpadding=0 border=0><tbody><tr><td width=25 valign="top"><img src="i/spacer.gif" width=3 height=1><img src="templates/foksilver/i/p/' + posticon + '" alt=""></td><td bgcolor="#EAEAE4" width=371 align="left" valign="top" class="forumtitel"><a href="topic/' + topicid + '" class="forumtitel">' + title + '</a></span></td><td bgcolor="#D2D1CA" width=50 class="smalltext" align="center" valign="top"></td><td bgcolor="#EAEAE4" width=57 class="smalltext" align="center" valign="top">' + posts + '</td><td bgcolor="#D2D1CA" width=107 class="smalltext" align="center" valign="top">' + lastpost + '</td><td bgcolor="#EAEAE4" class="smalltext" valign="top" width=153>&nbsp;&nbsp;<a target="_blank" href="user/profile/' + user + '" class="smalltext"><b>' + starter + '</b></a></td></tr></tbody></table>');}
function activetopic(topicid,title,typeicon,posticon,starter,user,posts,views,lastpost,lastpost_id,lastpost_time,starttime,maxmsg,pages,afkorting,forum) {
document.write('<br style="font-size:3px;"><table width=760 cellspacing=0 cellpadding=0 border=0><tbody><tr><td width=25 valign="middle" align="center"><a class="afkorting" href="forum/' + forum + '">' + afkorting + '</a></td><td width=23 valign="top"><img src="templates/foksilver/i/spacer.gif" width=3 height=1><img src="templates/foksilver/i/' + typeicon + '" width=14 height=14 border=0 /></td><td bgcolor="#EAEAE4" width=345 align="left" valign="top" class="topictitel"><div><a class="topictitel" href="topic/' + topicid + '">' + title + '</a>');

if (pages>1) {
	var i;
	for (i=2;i<=pages;i=i+1) {
		document.write(' <a class="topictitle_navlinks" href="topic/' + topicid + '/' + i + '/' + maxmsg + '">' + i + '</a>');
	}
}
var jump = (lastpost_time>currentvisit && starttime<currentvisit) ? ' <a class="topictitle_navlinks" href="misc/jumptopic/' + topicid + '/' + currentvisit + '">&raquo;</a>' : '';var lastpostlink = (lastpost_id>0) ? '<a class="smalltext" href="topic/' + topicid + '/' + pages + '/' + maxmsg + '#' + lastpost_id + '">' + lastpost + '</a>' : '<span class="smalltext">' + lastpost + '</span>';document.write(jump,'</a></td><td bgcolor="#D2D1CA" width=107 class="smalltext" align="left"><div style="width:107px;overflow:hidden;">&nbsp;<a target="_blank" href="user/profile/' + user + '" class="smalltext">' + starter + '</a></div></td><td bgcolor="#EAEAE4" width=30 class="smalltext" align="center">' + posts + '</td><td bgcolor="#D2D1CA" width=45 class="smalltext" align="center">' + views + '</td><td bgcolor="#EAEAE4" class="smalltext">&nbsp;&nbsp;' + lastpostlink + '</td></tr></tbody></table>');}

function xmsg(id,msgtime,topicid,posticon,style,user,name,date,body,subtitle,usersignature,icon,title,colour,usertekst,homepage,icq,msn,online,notes,hasfb) {
var username = name.length>19 ? name.slice(0,19) + "..." : name;
var editicon = (((uid == user && (time - msgtime < edittime)) || modpanel>0) && edpos>0) || (uid == 0) ? '<a href="rde/edit_message/' + id + path + '"><img border="0" src="templates/replique/i/edit.gif" title="Wijzig/bekijk dit bericht" alt="edit" /></a>' : '';
var quoteicon = (crpos>0) ? ' <a href="fok/post_reply/' + topicid + path + '/' + id + '"><img border="0" src="templates/replique/i/quote.gif" title="Quote dit bericht in een reactie" alt="quote" /></a>' : '';
var usericon=(icon.length>0) ? '&nbsp;<img class="usericon" src="' + icon + '" height="60" width="60" border="1" style="border:1px black solid;" alt="Usericon van ' + name + '" align="left" />': '';
var sig=(usersignature.length>0) ? '<span style="position:relative;left:-5px;top:8px;"><hr style="height:1px;width:590px;color:#A39E91;"></span>' + usersignature : '';
var home=(homepage.length>0) ? '<a target="_blank" href="' + homepage + '"><img border="0" src="templates/replique/i/home.gif" alt="Bekijk de homepage van ' + name + '" /></a>':'';
var titel=(usertekst.length>0) ? ' (<a target="_blank" href=\"http://frontpage.fok.nl/crew/' + user + '">' + usertekst + '</a>)' : '';
var kleur=(colour.length>0) ? colour : '000000';
kleur = (uid == 11324 && user == '11324') ? 'E83DFF' : kleur;
var bloem = (icq>0) ? '<img src="templates/replique/i/icq.gif" title="' + icq + '" alt="' + icq + '" width="15" height="15" />&nbsp;':'';
var msnicon= (msn.length>0) ? '<img src="templates/replique/i/msn.gif" alt="' + msn + '" title="' + msn + '" width="16" height="15" />&nbsp;':'';
var onlineicon = (online==1) ? '<img border="0" src="templates/replique/i/user_online.gif" width="9" height="9" alt="' + name + ' is momenteel aanwezig op het forum" />':'<img border="0" src="templates/replique/i/user_offline2.gif" width="9" height="9" alt="' + name + ' is momenteel niet aanwezig op het forum" />';
if (modpanel==1) {
	var adminpanel = '';
	adminpanel+= viewip>0 ? '<a target="_blank" title="Bekijk IP van deze post" href="fok/view_ip/' + id + '"><img src="templates/replique/i/viewip.gif" alt="" width="16" height="16" border="0" /></a> ' : '';
	adminpanel+= canuser>0 ? '<a target="_blank" title="Beheer gebruikersgegevens" href="misc/frontend_useradmin/' + user + '"><img src="templates/replique/i/push.gif" width="14" height="16" border="0" /></a> ' : '';
	adminpanel+= candelmsg>0 ? '<input type="checkbox" name="delmsg[]" value="' + id + '" title="Markeer deze post voor verwijderen" /> ' : '';
	adminpanel+= '<br />Notes: '+notes
} else{
	var adminpanel = '';
}
var notestxt =(usertekst.length>0) ? titel + ' <span class="smalltext">(' + notes + ')</span>' : ' <span class="smalltext">(' + notes + ')</span>';
var nametitel = (donotes==1) ? '<a target="_blank" class="smalltext" href="user/notes/' + user + '"><span style="font-weight:bold;color:#' + kleur + ';">' + name + '</span></a>' + notestxt :'<span style="font-weight:bold;color:#' + kleur + ';">' + name + '</span>' + titel;
var fotoboek = (hasfb==1) ? '<a target="_blank" title="Bekijk het fotoboek van ' + name + '" href="http://fotoboek.fok.nl/' + name + '"><img src="templates/replique/i/fotoboek2.gif" alt="Bekijk het fotoboek van ' + name + '" border="0" /></a> ' : '';
var usersub = (subtitle.length>0) ? subtitle + '<br />' : '';
document.write('<table width=768 border=0 cellspacing=0 cellpadding=0 height=30><tbody><tr><td width=145 valign="top" style="max-width:145px;">');
document.write('<span class="bigusername">&nbsp;<a href="user/history/' + user + '"><font color=' + kleur + '>' + username + '</font></a></span></td>');
document.write('<td width=484 background="templates/replique/i/tmbg.png"><span class="postedby" style="position:relative;top:0px;"><a name="' + id + '" href="topic/' + topicid + path + '#' + id + '"><img src="templates/replique/i/p/' + posticon + '.gif" border="0" align="absmiddle" /></a> <a href="user/online">' + onlineicon + '</a>');
document.write('&nbsp;&nbsp;' + nametitel + ' - <a class="smalltext" name="' + id + '" href="topic/' + topicid + path + '#' + id + '">' + date + '</a></span></td><td width=125 align="right" background="templates/replique/i/tmbg.png">');
document.write(fotoboek + ' ' + home + ' <a target="_blank" href="user/profile/' + user + '"><img border="0" src="templates/replique/i/profiel.gif" title="Bekijk het profiel van ' + name + '" alt="profiel" /></a> ' + editicon + quoteicon + '</td></tr>');
document.write('<tr><td valign=top class="ondertitel">&nbsp;' + usersub + usericon + '<br>');
document.write(bloem + msnicon + '<br style="font-size:2px;" />');
document.write(adminpanel+'</td><td valign="top" colspan=2>');
document.write('<br style="font-size:3px;"><center><table border=0 width=592><tbody><tr><td class="messagetxt">' + body);
document.write('</td></tr>');
document.write('<tr><td><span class="postedby" style="position:relative;top:-0px;left:-4px;">' + sig + '</span></td></tr>');
document.write('</tbody></table></center></td></tr></tbody></table>');
document.write('<span style="position:relative;top:1px;"><img src="templates/replique/i/balk.gif" width=768 height=1></span>');
}

function delete_icon(msgid){
	var out;
	out = '<input id="delete_'+msgid+'" type="checkbox" name="delmsg[]" value="' + msgid + '" title="Markeer deze post voor verwijderen" style="display:none;" />';
	out+= '<a href="javascript:;" onclick="javascript:toggle_delete('+msgid+');" onfocus="if(this.blur)this.blur();">';
	out+= '<img id="delete_'+msgid+'_img" border="0" src="templates/replique/i/f/comment_delete.png" title="Verwijder dit bericht" alt="del" /></a>'
	return out;
}
function toggle_delete(msgid){
	if(document.getElementById('delete_'+msgid).checked==true){
		document.getElementById('delete_'+msgid).checked=false;
		document.getElementById('delete_'+msgid+'_img').src='templates/replique/i/f/comment_delete.png';
	}else{
		document.getElementById('delete_'+msgid).checked=true;
		document.getElementById('delete_'+msgid+'_img').src='templates/replique/i/f/delete.png';
	}
}


function msg(msgid,msgtime,topicid,posticon,style,user,name,date,body,subtitle,usersignature,icon,title,colour,usertekst,homepage,icq,msn,online,notes,hasfb) {
	var username = name.length>19 ? name.slice(0,19) + "..." : name;
	var adminipview = viewip>0 ? '<a target="_blank" title="Bekijk IP van deze post" href="rde/view_ip/' + msgid + '"><img src="templates/replique/i/f/computer.png" border="0"/></a>':'';
	var admindelmsg = candelmsg>0 ? delete_icon(msgid) :'';
	var editicon 	= (((uid == user && (time - msgtime < edittime)) || modpanel>0) && edpos>0) || (uid == 0) ? '<a href="rde/edit_message/' + msgid + path + '"><img border="0" src="templates/replique/i/f/comment_edit.png" title="Wijzig/bekijk dit bericht" alt="edit" /></a>' : '';
	var quoteicon 	= (crpos>0) ? '<a href="rde/post_reply/' + topicid + path + '/' + msgid + '"><img border="0" src="templates/replique/i/f/comment_add.png" title="Quote dit bericht in een reactie" alt="quote" /></a>' : '';
	var bloem 		= (icq>0) ? '<img src="templates/replique/i/icq.gif" title="' + icq + '" alt="' + icq + '" width="15" height="15" />&nbsp;':'';
	var usericon	= (icon.length>0) ? '&nbsp;<img class="usericon" src="' + icon + '" height="60" width="60" border="1" style="border:1px black solid;" alt="" />': '';
	var useradmin	= canuser>0 ? '<a target="_blank" title="Beheer gebruikersgegevens" href="rde/frontend_useradmin/' + user + '"><img src="templates/replique/i/push.gif" width="14" height="16" border="0" /></a> ' : '';
	var home		= (homepage.length>0) ? '<a target="_blank" href="' + homepage + '"><img border="0" src="templates/replique/i/f/house.png" alt="Bekijk de homepage van ' + name + '" /></a>':'';
	var msnicon		= (msn.length>0) ? '<img src="templates/replique/i/msn.gif" alt="' + msn + '" title="' + msn + '" width="16" height="15" />&nbsp;':'';
	var usersub 	= (subtitle.length>0) ? subtitle + '<br />' : '';
	var noteicon    = (notes>0) ? '<a href="user/notes/'+ user +'" title="Deze gebruiker heeft '+notes+' notities."><img src="templates/replique/i/f/note_go.png" border="0"/></a>':'<a href="user/notes/'+ user +'" title="Deze gebruiker heeft 0 notities."><img src="templates/replique/i/f/note.png" border="0"/></a>';
	var notepost	= (donotes=='1') ? '<a href="user/notes/'+user+'/'+msgid+'" title="Note deze post"><img src="templates/replique/i/f/note_add.png" border="0"></a>' : '';
	document.write('<div class="msgWrap" id="'+msgid+'" name="message'+msgid+'">');
	document.write('<div class="msgTopbar">');
	document.write('<div class="msgTopleft">');
	document.write('<div class="msgUsername">'+ username +'</div>');
	document.write('<div class="msgUsertitel">'+ title +'</div>');
	document.write('</div><div class="msgTopmiddle"><a href="#'+ msgid +'">'+ date +'</a></div>');
	document.write('<div class="msgTopright">' + adminipview + admindelmsg + editicon + quoteicon + '</div></div>');
	document.write('<div class="msgMain"><div class="msgMainleft">');
	document.write(usericon +'<div>'+ usersub +'</div>');
	document.write('<div><a href="user/profile/'+ user +'"><img src="templates/replique/i/f/vcard.png" border="0" /></a>');
	document.write(home + msnicon + bloem + useradmin + noteicon + notepost + '</div></div>');
	document.write('<div class="msgMainright">'+ body +'</div></div>');
	if(usersignature!=''){
		document.write('<div class="msgBottom"><div class="msgBottomleft"></div><div class="msgBottomright">'+ usersignature +'</div></div></div>');
	}
}

function use_usericon(name) {
location=basehref+"rde/use_usericon/"+name;
}
function deltopicnote(id) {
	if (confirm("Note verwijderen?")){
		location=basehref+"rde/delete_topicnote/"+id+"";
	}
}
function delusernote(id) {
	if (confirm("Note verwijderen?")){
		location=basehref+"rde/delete_usernote/"+id+"";
	}
}
function quickhop(site) {
	self.location=site;
}
function hopforum(URL) {
	self.location=basehref+URL;
}

function bookmark(bookmarkid,topic,message,titel,tekst,starter,user,lastpost,posticon,afkorting,forumid) {
document.write('<br style="font-size:3px;"><table width=760 cellspacing=0 cellpadding=0 border=0><tbody><tr><td width=25 valign="top" align="center"><br style="font-size:2px;" /><a class="afkorting" href="forum/' + forumid + '">' + afkorting + '</a></td><td width=23 valign="top"><img src="templates/foksilver/i/' + posticon + '" border="0" /></td><td bgcolor="#EAEAE4" width=345 align="left" valign="top" class="topictitel"><div><a class="topictitel" href="topic/' + topic + '">' + titel + '</a><br /><span class="smalltext">' + tekst + '</span></div></td><td bgcolor="#D2D1CA" width=107 class="smalltext" align="left">&nbsp;<a target="_blank" href="user/profile/' + user + '" class="smalltext">' + starter + '</a></td><td bgcolor="#EAEAE4" width=30 class="smalltext" align="center"><a href="rde/edit_bookmark/' + bookmarkid + '" class="topiclistlink"><img border="0" src="/templates/foksilver/i/edit.gif" title="Wijzig bookmark" alt="edit" width="16" height="15" /></a></td><td bgcolor="#D2D1CA" width=45 class="smalltext" align="center">wis:<input type="checkbox" name="delete[]" value="' + bookmarkid + '" /></td><td bgcolor="#EAEAE4" class="smalltext">&nbsp;&nbsp;' + lastpost + '</td></tr></tbody></table>');
}