var questions = new Array();
var answers = new Array();
function define_question(text) {
questions[questions.length] = text;
}
function define_answer(text) {
answers[answers.length] = text;
}
function initialise() {
define_question("Who is allowed to use flatAccount.com?");
define_answer("Any person of the age 18 years or older.");
define_question("Does flatAccount.com connect to my bank account?");
define_answer("No.  This service is not a form of online banking and does not link to your bank account.  It simply accounts for expenses that you enter on the website.");
define_question("Does flatAccount.com prevent cheating or fraud?");
define_answer("No.  While it makes it more difficult for flatmates to be dishonest, it cannot prevent this from happening.  All flats should be based around a certain level of trust and honesty, and those using flatAccount.com are no different in that respect.");
define_question("Does it account for personal expenses?");
define_answer("Yes.  If, as part of a flat expense, you have some personal expenses included, these can be specified when you enter the transaction.  That way the other flatmates will only be debited for the communal expenses.");
define_question("Can it be used to account for loans between flatmates?");
define_answer("Yes.  When a flatmate gives money to another, this is accounted for by entering this transaction as a transfer.");
define_question("Can some flatmates be excluded from some expenses?");
define_answer("Yes.  For example, if one flatmate buys and cooks their own food, they can be exluded from the grocery expenses.  You can specify who to exclude when you enter the transaction.");
define_question("We each pay our own rent directly to the landlord, should this go on flatAccount.com?");
define_answer("No.  If a flatmate pays for an expense which covers only themselves, or only their portion of the expense, it does not need to go on flatAccount.com.  Unless a payment covers flatmates other than the one paying, it does not need to be entered on flatAccount.com.");
define_question("Which transactions should go on flatAccount.com?");
define_answer("All transactions should be entered on flatAccount.com except those where each flatmate pays for their own share of the expense.  For example, if each flatmate pays for their own rent directly to the landlord, this does not need to go on flatAccount.com.  On the other hand, if one flatmate pays for the entire flat's rent, then this should go on flatAccount.com.");
define_question("How much does it cost to use flatAccount.com?");
define_answer("The fees are explained on the <a href=\"fees.php\">fees page</a>.");
define_question("What happens when a flatmate leaves the flat?");
define_answer("You are able to record the fact that a flatmate has left.  This ensures that this flatmate is not automatically included in expenses from that date onwards.  This flatmate may have an outstanding balance.  It is recommended that one of the other flatmates collects or pays the outstanding balance.  This should be recorded as a transfer.");
define_question("What happens when a new flatmate joins the flat?");
define_answer("You are able to record the fact that a new flatmate has joined.  The new flatmate will begin with a zero balance and by default they will be included in future communal expenses.");
define_question("What about transactions that involve flatmates after they've left?");
define_answer("You are able to include previous flatmates in an expense.  When you enter the transaction you must click on the Show All Flatmates link to show previous flatmates.  Then you need to specify that they should be included by ticking the box beside their name.");
define_question("How do I deal with an outstanding debt from a flatmate who has left?");
define_answer("If a previous flatmate has left an unrecoverable debt, you must write it off.  To do this, enter a transaction with them as the spender and include all other flatmates except for them.");
define_question("How do we settle up when our flat ends?");
define_answer("Each flatmate with a negative balance (debit) puts a sum of money equal to their balance on the table.  Then, each flatmate with a positive balance (credit) takes from the table a sum of money equal to their balance.");
displayanswer(-1);
}
function displayanswer(n) {
section = document.getElementById('faq');
var text = '';
for (var i = 0 ; i < questions.length ; i++) {
  if (n == i) {
    text = text + '<div onClick=\"displayanswer(-1)"><p class=\"faq\"><img width=9 height=14 alt=\"\" src=\"faq-down.gif\"><b>' + questions[i] + '</b></p></div><div class=\"indent\"><p>' + answers[i] + '</p></div>';
    }
  else {
    text = text + '<div onClick=\"displayanswer(' + i + ')\"><p class=\"faq\"><img width=9 height=14 alt=\"\" src=\"faq-up.gif\"><b>' + questions[i] + '</b></p></div>';
    }
  }
section.innerHTML = text;
}

