// COPYRIGHT (C) 2004 SLIM WEB ARCHITECTURE, BREDA, THE NETHERLANDS
// ALL CODE IS COPYRIGHTED MATERIAL
// NOTHING MAY BE COPIED OR USED WITHOUT EXPRESS PERMISSION FROM SLIM WEB ARCHITECTURE
// WWW.SLIMWEB.NL

var row = 0;
var kleur   = new Array("A","B");
var teller  = 0;
var pageStr = "";

var admImg = "forum";
var normImg = "forum";

var ISMOZ = !document.all;
var ISNS  = document.layers;

var currentUser   = "anonymous";
var currentUserId = 0;
var isLoggedIn    = "no";
var currentOnline = "";
var curAnnounces  = "";
var curLastVisit;
var curMaxReplies = 50;
var curBerichten  = "";
var curAdmin      = "";

var lang = navigator.language? navigator.language.substr(0,2) : navigator.userLanguage.substr(0,2);

var preloader = new Image();
preloader.src="images/rlp_on.gif";


function setOn(iobj,onmode) {
var newImg;
 newImg = iobj.src;
 newImg = newImg.replace("_on","");
 newImg = newImg.replace(".gif","");
 if (onmode == 1) {
  iobj.src = newImg+"_on.gif";
 } else {
  iobj.src = newImg+".gif";
 }
}

function userInit(username, userid, loggedin, online, announcement, admin, lastvisit, maxreplies, curbers) {
 currentUser   = username;
 currentUserId = userid;
 isLoggedIn    = (loggedin>0) ? "ok" : "no";
 currentOnline = online;
 curAnnounces  = announcement;
 curLastVisit  = lastvisit;
 curMaxReplies = maxreplies;
 curBerichten  = curbers;
 curAdmin      = admin;
}

function eForumsTable(topten, lastposts, adv) {
 footer= "</tbody>\n<tfoot><tr><td class='helpenstuff' align=right colspan='5'><form name='ganaar'>";
 footer+= "<select name='plast' onchange=\"if (ganaar.plast.selectedIndex!=0) document.location.href='frm_lst.php?plast='+ganaar.plast[ganaar.plast.selectedIndex].value\"><option value=0>"+L_lastposts+"..</option><option value=1>"+L_today+"</option><option value=2>"+L_day+"</option><option value=3>"+L_tday+"</option><option value=4>"+L_week+"</option></select>&nbsp;&nbsp;&nbsp;";
 footer+= "<select name='overig' onchange=\"if (ganaar.overig.selectedIndex!=0) document.location.href=ganaar.overig[ganaar.overig.selectedIndex].value;\"><option value='/'>"+L_other+"..</option><optgroup label='"+L_nonmembers+":'><option value='register.php'>"+L_register+"</option><option value='verify_again.php'>"+L_verifymail+"</option></optgroup><optgroup label='"+L_members+":'>"+((isLoggedIn == "ok") ? "<option value='logout.php'>"+L_logout+"</option>" : "<option value='frm_login.php'>"+L_login+"</option>")+"<option value='frm_search.php'>"+L_search+"</option><option value='profile.php'>"+L_profile+"</option><option value='passwordchange.php'>"+L_changepassword+"</option><option value='password_request_reset.php'>"+L_resetpassword+"</option><option value='berichten.php'>"+L_privatemessaging+"</option><option value='frm_members.php?start=0'>"+L_members+"</option></optgroup>"+((curAdmin == "superuser") ? "<optgroup label='Admins:'><option value='announcement.php'>Announcements</option><option value='blockusers.php'>"+L_blockusers+"</option><option value='uploads.php'>"+L_deleteuploads+"</option></optgroup>" : "")+"</select>&nbsp;&nbsp;&nbsp;";
 footer+= "<select name='helpme' onchange=\"if (ganaar.helpme.selectedIndex!=0) document.location.href=ganaar.helpme[ganaar.helpme.selectedIndex].value;\"><option value='faq.php'>"+L_help+"..</option><option value='faq.php'>"+L_faq+"</option><option value='copyright.php'>"+L_privacy+"</option>"+"</select>&nbsp;</form></td></tr>";
 footer+= "<tr><td class='leftForumsFootCell' colspan='2'><b>"+L_hottopics+":</b><br>"+topten+"</td>";
 footer+= "<td class='rightForumsFootCell' colspan='3'><b>"+L_lastfive+":</b><br>"+lastposts+"</td></tr>";
 if (adv) {
  footer+= "<tr><td colspan='5'>"+adv+"</td></tr>";
 }
 footer+= "</tfoot></table><p>&nbsp;</p>\n";
 document.write(footer);
}

function mForum(fid, forum, forumdesc, topics, posts, lrdatum, lrbyid, lrbyuser, lrid, admin) {
 var maxpages,userLink,rij,statusicon,status,lpby,navigatie,modStr;
 if (row == 0) {
  row++;
 } else {
  row--;
 }
 teller++;
 if (admin == "yes") {
  statusicon = admImg;
  status     = L_restricted+fid;
 } else {
  statusicon = normImg;
  status     = L_forum+" "+fid;
 }
 nday  = lrdatum.substr(0,2);
 nmon  = lrdatum.substr(3,2);
 nyr   = lrdatum.substr(6,4);
 nhr   = lrdatum.substr(11,2);
 nmin  = lrdatum.substr(14,2);
 switch (lang) {
 case "en":
	ntime = nhr>12 ? (nhr-12)+":"+nmin+" PM" : nhr+":"+nmin+" AM";
	ndate = months[Math.abs(nmon-1)]+", "+Math.abs(nday)+" "+nyr+" "+ntime;
	break;
 default:
	ndate = lrdatum;
 }
 ukdate = nyr + "-" + nmon + "-" + nday + " " + nhr + ":" + nmin;
 if (ukdate > curLastVisit) {
  statusicon += "_new";
  status     += " ("+L_newtopsvisit+")";
 }
 if (topics>0) {
  lrbyuser = lrbyuser!="" ? lrbyuser : L_noposts;
  lrbyid   = lrbyid  !="" ? lrbyid   : 0;
  lpby = ndate+"<br><a class='posts_a_Profile' href='javascript:void(0)' title='"+L_viewprofile+" "+lrbyuser+"' onClick='profile("+lrbyid+")'>"+lrbyuser+"</a> <a href=\"frm_psts.php?postid="+lrid+"&admin="+admin+"#P"+lrid+"\"><img src='images/rlp.gif' onMouseOver='setOn(this,1)' onMouseOut='setOn(this,0)' width='8' height='9' border='0' alt='' title='"+L_gotopost+"'></a>";
 } else {
  lpby = ndate+"<br>("+L_noposts+")";
 }
 forumref = "<b><a class='forumtitel' href='frm_tpcs.php?forumid="+fid+"&admin="+admin+"' title=\""+L_clicktoopen+" '"+forum+"' "+L_forum+"\">"+forum+"</a></b><br>"+forumdesc;
 rij =  "<tr class='forumsTabel_Row"+kleur[row]+"'><td class='forumsTabel_Cstatus'><img src='images/"+statusicon+".gif' alt='' title='"+status+"'></td><td class='forumsTabel_Cname'>"+forumref+"</td><td class='forumsTabel_Ctopics'>"+topics+"</td><td class='forumsTabel_Cposts'>"+posts+"</td><td class='forumsTabel_Clastpost'>"+lpby+"</td></tr></tr>\n";

 document.write(rij);
}

function maakForumsTabel() {
 document.write("<br><table class='postsTabel' border='0' cellspacing='0' cellpadding='0'>");
}

function maakForumsHeader() {
var s="";
var header = "";
 if (isLoggedIn!="ok") {
  if (currentUser!="" && currentUser!="anonymous") {
   s+=L_welcome+" "+currentUser+".&nbsp;&nbsp;"+L_notloggedin+".&nbsp;&nbsp;"+L_clicklogin+".";
  } else {
   s+=L_welcome+". "+L_notloggedin+".&nbsp;&nbsp;"+L_clicklogin+".&nbsp;"+L_clickregister+".";
  }
 } else {
  s+=L_welcome+" "+currentUser+".&nbsp;&nbsp;"+L_clicklogout+".";
 }
 s+="<br><br>"+currentOnline;

 header+= "<thead>\n";
 header+= "<tr class='postsTabelHeader'>\n<td colspan='5'><img src='images/forumbanner.png' width='790' height='163' border='0' alt='"+L_goback+"' usemap='#Map'><map name=\"Map\"><area shape=\"rect\" coords=\"639,81,780,101\" href=\"frm_login.php\" alt=\""+L_login+"\" title=\""+L_login+"\"><area shape=\"rect\" coords=\"639,64,780,83\" href=\"register.php\" alt=\""+L_register+"\" title=\""+L_register+"\"><area shape=\"rect\" coords=\"639,117,780,138\" href=\"berichten.php\" alt=\""+L_privatemessaging+"\" title=\""+L_privatemessaging+"\"><area shape=\"rect\" coords=\"639,99,780,117\" href=\"profile.php\" alt=\""+L_profile+"\" title=\""+L_profile+"\"><area shape=\"rect\" coords=\"0,0,600,140\" href=\"frm_ndx.php\" target=\"_top\" alt=\""+L_goback+"\" title=\""+L_goback+"\"><area shape=\"rect\" coords=\"124,142,189,158\" href=\"http://www.1ouder.nl/\" alt=\"Ga naar de 1Ouder website\"><area shape=\"rect\" coords=\"203,142,250,159\" href=\"frm_ndx.php\" alt=\""+L_forum+"\" title=\""+L_forum+"\"><area shape=\"rect\" coords=\"261,143,365,158\" href=\"berichten.php\" alt=\""+L_privatemessaging+"\" title=\""+L_privatemessaging+"\"><area shape=\"rect\" coords=\"378,144,428,159\" href=\"frm_search.php\" alt=\""+L_search+"\" title=\""+L_search+"\"><area shape=\"rect\" coords=\"441,143,470,158\" href=\"faq.php\" alt=\""+L_faq+"\" title=\""+L_faq+"\"></map></td></tr>\n";
 header+= "<tr class='postsTabelOnline'>\n<td colspan='5'>"+s+"</td></tr>\n";
 header+= "<tr class='postsTabelAnnoucement'>\n<td colspan='5'><br>"+curAnnounces+"<br clear='ALL'>&nbsp;</td></tr>\n";
 header+= "<tr class='postsTabelStarter'><td colspan='5'>"+curBerichten+" "+L_privatemsg+"</td></tr>\n";
 header+= "</thead>\n";
 header+= "<tbody>";
 document.write(header);
}

function maakForumsCat(catid, catnaam) {
 document.write("<tr>\n<td colspan='5'>&nbsp;</td></tr>\n<tr>\n<td colspan='5' class='category'>:: <a name='cat"+catid+"'>"+catnaam+"</a> ::</td></tr>\n<tr class='postsTabelLegend'><td class='noLegend'>&nbsp;</td><td>"+L_C_forum+"</td><td>"+L_C_topics+"</td><td>"+L_C_posts+"</td><td>"+L_C_lastpost+"</a></td></tr>\n");
}
