window['forumcounter']=1;
function forum_insert_row(display) {
 document.getElementById('forum').insertRow(window['forumcounter']).insertCell(0).innerHTML = display;
 window['forumcounter']++;
}

function forum_thread(index, title, desc, creator, created, modified, permissions) {
 temp = '<form method="GET" style="display:inline;">'+
  '<a href="?index='+index+'">'+title+'</a><br>'+
  desc+'<br>'+
  'Creator: '+creator+'<font size="1"> on '+created+' '+
  'Modified:'+modified+'<br>'+
  'Royal Guards:'+permissions+'</font>'
 ;
 forum_insert_row(temp);
}

function forum_post(title, desc, creator, created, modified, creatorid) {
 temp = (title ? title+'<hr>' : '')+
  '<table class="forums" border="2" cellpadding="5" cellspacing="3" width="100%" bordercolor="#CCCCCC" bgcolor="#000000"><tr><td width="175" class="info" valign="top">'+creator+'<hr><img src="avatar.php?id='+creatorid+'"></td><td class="text" valign="top">'+desc+'</td></tr></table>'+
 '<font size="1">Posted:'+created+'<br>Modified:'+modified+'</font>';
 forum_insert_row(temp);
}

function forum_create_post(index) {
 temp = '<form method="POST" action="?index='+index+'">Create Post<br>'+
  '<input type="hidden" name="type" value="post">'+
  'Title: <input type="text" name="title" style="width:600;background-color:#000000;color:white;"><br>'+
  'Post:<br><textarea name="desc" cols="100%" rows="10" style="overflow:auto;background-color:#000000;color:white;"></textarea>'+
 '<br><input type="submit" value="Create Post" onclick="this.disabled=true;submit();"></form>';
 forum_insert_row(temp);
}

function forum_create_thread(index) {
 temp = '<form method="POST" action="?index='+index+'">Create Thread<br>'+
  '<input type="hidden" name="type" value="thread">'+
  'Title: <input type="text" name="title" style="width:600;background-color:#000000;color:white;"><br>'+
  'Description:<br><textarea name="desc" cols="100%" rows="10" style="overflow:auto;background-color:#000000;color:white;"></textarea>'+
 '<br><input type="submit" value="Create Thread" onclick="this.disabled=true;submit();"></form>';
 forum_insert_row(temp);
}
