
var allArticles = new Array();
allArticles.selectedIndex = 0;

function Article(id,category,author,title,text,date,haspicture,uid,selected){
  this.id = id;
  this.category = category;
  this.author = author;
  this.title = title;
  this.text = text;
  this.date = date;
  this.haspicture = haspicture;
  this.uid = uid;
  if (selected) allArticles.selectedIndex = allArticles.length;
  allArticles[allArticles.length] = this;
}

var allPrivateArticles = new Array();

function privateArticle(id,category,title){
  this.id = id;
  this.category = category;
  this.title = title;
  allPrivateArticles[allPrivateArticles.length] = this;
}

var allCategories = new Array();
allCategories.selectedIndex = 0;

function Category(id,href,name,selected){
  this.id = id;
  this.href = href;
  this.name = name;
  this.selected = selected;
  if (selected) allCategories.selectedIndex = allCategories.length;
  allCategories[allCategories.length] = this;
}

var allEvents = null; 

function addEvent(evnt){
  if (!allEvents) allEvents = new Object();
  if (!allEvents[evnt.date]){
    allEvents[evnt.date] = new Array();
  }
  allEvents[evnt.date][allEvents[evnt.date].length] = evnt;
}

function Event(id,title,text,date,time){
  this.id = id;
  this.title = title;
  this.text = text;
  this.date = date;
  this.time = time;
  addEvent(this);
}

var allMessages = new Array();
allMessages.selectedIndex = 0;

function Message(id,author,title,text,date,uid,selected,haspicture,picture,nrmessages,deleteurl){
  this.id = id;
  this.author = author;
  this.title = title;
  this.text = text;
  this.date = date;
  this.uid = uid;
  if (haspicture) this.haspicture = haspicture;
  if (picture) this.picture = picture;
  if (deleteurl) this.deleteurl = deleteurl;
  this.nrmessages = (nrmessages)?nrmessages:0;
  if (selected) allMessages.selectedIndex = allMessages.length;
  allMessages[allMessages.length] = this;
}

var allGuestbookarticle = new Array();
allGuestbookarticle.selectedIndex = 0;

function guestbookArticle(id,date,title,author){
  this.id = id;
  this.author = author;
  this.title = title;
  this.date = date;
  allGuestbookarticle[allGuestbookarticle.length] = this;
}

var allTools = new Array();
allTools.currentuser = '';

function toollink(name,url){
  this.name = name;
  this.url = url;
  allTools[allTools.length] = this;
}

function ToolsToList()
{
  if (allTools.length == 0) return;
  document.write('<table border="0">');
  for (var i=0;i<allTools.length;i++){
    document.write('<tr><td><a href="' + allTools[i].url + '">' + allTools[i].name + '</a></td><tr>');
  }
  document.write('</table>');
}

function ToolsToMenu(name,classname)
{
  if (allTools.length == 0) return;
  document.write('<table border="0" cellpadding="2" cellspacing="2"><tr>');
  if (allTools.currentuser) {
    document.write('<td class="' + classname + '" align="left">Ingelogd als ' 
                   + allTools.currentuser + '</td>');
  }
  for (var i=0;i<allTools.length;i++){
    if (allTools[i].name != name){
      document.write('<td class="' + classname + '"> <a class="' + classname + '" href="' + allTools[i].url + '">' + allTools[i].name + '</a> </td>');
    } else {
      document.write('<td class="' + classname + '"> ' + allTools[i].name + ' </td>');
    }
  }
  document.write('</tr></table>');
}

function shortenText(sText,iSize,sLink){
  if (sText && sText.length > iSize){
    sText = sText.substr(0,iSize);
    sText = sText.substr(0,sText.lastIndexOf(' '));
    if (sLink) sText += ' <a href="' + sLink + '" class="bericht">&gt;&gt;</a>';
  }
  return sText;
}

function cutoffText(sText,iSize){
  if (sText && sText.length > iSize){
    sText = sText.substr(0,iSize) + '...';
  }
  return sText;
}

function openWindow(sUrl){
      window.open(sUrl,'nieuwwindow','width=360,height=430,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes');
}

