var lastClicked = "none";
var lastCat = "iva";

function setBackground(type){
	colorFade(type,"background","FFFFFF","FFFFE0",25,10);
	if (lastClicked != "none" || lastClicked == type) {
			colorFade(lastClicked,"background","FFFFE0","FFFFFF",25,10);
		}
	lastClicked = type;
}

function setBackgroundCat(type){
	colorFade(type,"background","FFFFFF","FFFFE0",25,10);
	if (lastCat != "none" || lastCat == type) {
			colorFade(lastCat,"background","FFFFE0","FFFFFF",25,10);
		}
	lastCat= type;
}

function setText(text) {
	document.getElementById('question-box').innerHTML = text;	
}

function selectQuestion(type) {
	//iva questions
	var ivaWhatis = "An IVA (also known as an Individual Voluntary Arrangement) is a legally binding debt repayment agreement between an individual in debt (debtor) and the people he or she owes money to (creditors). It was introduced by the government as part of the Insolvency Act 1986 as an alternative to bankruptcy. <p> An IVA offers an affordable monthly payment, normally over a five year period. The amount that is repaid via an IVA is usually less than the total debt but is accepted by creditors as a final settlement.";
	var ivaDuration = "An IVA would normally last for five years, however it is possible to complete it in a shorter period e.g. were a lump sum is introduced into the arrangement. It is also possible for an IVA to last for more than five years, although we would not normally recommend this unless your circumstances required it."
	var ivaWho = "Anyone in England, Wales and Northern Ireland having a disposable income, and debts of over ?15,000 to 3 or more creditors that they cannot pay, could benefit from an IVA. The equivalent of an IVA for those living in Scotland is a Protected Trust Deed.";
	var ivaCost = "Fees are payable but unless your circumstances are exceptional your creditors will normally agree that they be deducted from your agreed payments as an allowable cost of the arrangement. For your protection, the law provides that the fees that are to be paid to us for assisting you with the preparation of your proposal and subsequently supervising the IVA will be disclosed in the proposal itself. Your creditors will generally be happy to allow us to take our fees out of your payments as we are also acting on behalf of them as well as you.";
	var ivaFinish = "When you have successfully completed your IVA i.e when you have satisfied all your obligations under it, a 'Certificate of Full Compliance' will be sent to you and your creditors to formally conclude your IVA. The legal effect of this is that all creditors that were included in the IVA are obliged to accept the dividends they received in full and final settlement of the debt owed to them.";
	var ivaCircChange = "If you default on your obligations you break the terms of the IVA and the Supervisor may ultimately have to terminate the IVA. No-one benefits from this. Should your circumstances change during the term of the arrangement, creditors may agree to a variation of its terms if alternative proposals are considered viable. It will therefore be in your interests to keep the Supervisor informed of any problems that are likely to arise. If there is the possibility of viable alternative proposals, generally the sooner they are explored, the better.";
	var brProperty = "Generally you will have to sell your home if it contains equity regardless if you own it jointly with your partner, although it may be possible for your partner or a third party to buy your share of the equity.";
	var ivaBr = "If a Bankruptcy Petition has been presented, but a Bankruptcy Order has not yet been made then we can apply for a court order (known as an Interim Order) on your behalf to suspend the proceedings to allow time for preparing your proposal. Even if a bankruptcy order has already been made, it is still possible for you to propose an IVA. If the creditors accept the proposal the petition will be deemed to be dismissed, or if a Bankruptcy Order has already been made, application can be made to annul it. Where Bankruptcy Proceedings are replaced by an IVA, costs are bound to increase because the Bankruptcy Expenses will almost inevitably become expenses of the IVA, and the process of proposing the IVA is more complex and long-winded.";
	var ivaHouse = "In Bankruptcy, a Trustee has to deal with the bankrupt's equity in his/her home, which may well involve its sale. There are no corresponding legal requirements in an IVA, although if there is equity in your home then your creditors most likely will expect you to release much of it to pay into the arrangement. This will normally be by remortgage as an exit route from the IVA.";
	var ivaBusiness = "In principle, as long as you adhere to the terms of your IVA you can carry on operating your business. However, an IVA proposal for a self-employed person is likely to be rather more complex than one for someone who is employed. It may be that you owe significant sums to HM Revenue & Customs, who have their own established acceptance criteria. For example, you will need to regularly prepare proper accounts and forecasts, and to be able to demonstrate that any business problems which contributed to your financial difficulties have been rectified. Also, it will be necessary for proper provision to be made for your ongoing compliance with all your taxation obligations, so as to prevent the accrual of further unpaid Tax liabilities, which would almost certainly mean failure of the arrangement and, most probably, bankruptcy.";
	var ivaCredit = "Whilst the IVA is in place you are not allowed under the terms of the arrangement to take out any further unsecured credit such as credit cards, store cards, personal loans, etc. A note will be put on your credit file alerting potential lenders to the fact that you have entered the agreement. This note will remain on your credit file for a total period of six years (i.e. normally one year longer than the duration of the IVA).";
	
	//bankruptcy questions
	var brProperty = "Generally you will have to sell your home if it contains equity regardless if you own it jointly with your partner, although it may be possible for your partner or a third party to buy your share of the equity.";
	var brLandlord = "The Official Receiver has a duty to notify your landlord and some tenancy agreements contain a clause stating that an un-discharged bankrupt cannot be a tenant, so you may have to leave your rented home.";
	var brJob = "Bankruptcy can stop you from practicing certain professions such as accountancy and law. You will also be prevented from acting as a company director. <p> Also a bankrupt cannot hold certain positions of public office e.g. MP, Magistrate or local councilor.";
	var brDuration = "You would normally be discharged within 12 months, however if found to be blameworthy, culpable or dishonest, you may be subject to a Bankruptcy Restrictions Order which can extend the bankruptcy up to 15 years.";
	var brBusiness = "If you own a business, it is normally closed down and your employees are dismissed. Any business assets will be auctioned and sold by your trustee.";
	var brCost = "You will need to pay &pound;485 cash to court to make yourself bankrupt, this covers the court fee of &pound;150 and an administration fee of &pound;335.";
	var brPayments = "The Official Receiver will review your income and expenditure and could apply to court for an income payments order which requires you to make contributions to your bankruptcy debts for up to three years.";
	var brCredit = "You are unlikely to be able to obtain credit whilst an un-discharged bankrupt, once discharged it is likely you will find it difficult for up to 6 years.";
	var brAdvert = "Your name will be published in the London Gazette, a local newspaper and on the Insolvency register which can be accessed through the internet.";
	var brWrite = "Once discharged (usually within 12 months), most debts are written off and creditors cannot pursue them, although there are some non provable debts such as court fines that you will still have to pay.";
	
	//debt management
	var dmWhat = "Debt Management is an informal arrangement with your creditors that we negotiate on your behalf to reduce your monthly repayments to an amount you can afford to pay every month. We will write to your creditors asking them to accept reduced payments on your account and to stop further interest and charges from being applied.";
	var dmPay = "We will discuss you income and expenditure with you making sure that you have enough money to cover your day to day living expenses. What's left over will be paid towards your Debt Management Programme. This will be an amount we both agree you can afford to pay and maintain every month.";
	var dmCost = "We will discuss you income and expenditure with you making sure that you have enough money to cover your day to day living expenses. What's left over will be paid towards your Debt Management Programme. This will be an amount we both agree you can afford to pay and maintain every month.";
	var dmWork = "As soon as we receive your first payment, we will write to your creditors to let them know we are looking after your finances. We will negotiate with them to accept reduced payments on your account and to freeze any further interest and charges from being applied. We can't guarantee that they'll agree straight away but we are experienced in negotiating with them and will work hard to get the arrangements in place as quickly as possible.";
	var dmCreditors = "We will pay your creditors on your behalf every month and we will send you a statement showing the payments we have made on your behalf.";
	var dmDuration = "We will pay your creditors on your behalf every month and we will send you a statement showing the payments we have made on your behalf.";
	var dmCircumstances = "If your circumstances change at any point during the plan, please let us know immediately. Depending on your circumstances a revised repayment plan will be negotiated with your creditors. As a matter of course, we will annually review your plan with you and amend your monthly payment if necessary.";
	var dmAlldebts = "We can only deal with your unsecured debts, so that's things like credit cards, personal loans, store cards, catalogues etc. We'll make sure that you have enough money to cover your day-to-day living expenses and mortgage or rent, as well as any HP agreements or secured loans you have. ";
	var dmCcjs = "No matter what your credit history is like or if you have CCJ's we will still be able to help you. All we ask is that you provide us with honest and full details of your current financial situation.";
	var dmPartner = "You don't have to tell your partner and we will not discuss your account with anyone else unless you give us written authorisation to do so. However, it sometimes helps to talk to your partner about your debts and it can help to ease the burden. ";
	var dmCancel = "If you decide to cancel we will return any monies we hold for you that have not yet been distributed to your creditors. There are no penalties for leaving. ";
	
	switch(type) {

	case "iva-whatis":	
		setText(ivaWhatis);
		setBackground(type);
		break;
	case "iva-duration":
		setText(ivaDuration);
		setBackground(type);
		break;
	case "iva-who":
		setText(ivaWho);
		setBackground(type);
		break;
	case "iva-cost":
		setText(ivaCost);
		setBackground(type);
		break;
	case "iva-finish":
		document.getElementById('question-box').innerHTML = ivaFinish;
		setBackground(type);
		break;
	case "iva-circ-change":
		document.getElementById('question-box').innerHTML = ivaCircChange;
		setBackground(type);
		break;
	case "br-property":
		document.getElementById('question-box').innerHTML = brProperty;
		setBackground(type);
		break;
	case "iva-br":
		document.getElementById('question-box').innerHTML = ivaBr;
		setBackground(type);
		break;
	case "iva-house":
		document.getElementById('question-box').innerHTML = ivaHouse;
		setBackground(type);
		break;
	case "iva-business":
		document.getElementById('question-box').innerHTML = ivaBusiness;
		setBackground(type);
		break;
	case "iva-credit":
		document.getElementById('question-box').innerHTML = ivaCredit;
		setBackground(type);
		break;
	case "br-property":
		document.getElementById('question-box').innerHTML = brProperty;
		setBackground(type);
		break;
	case "br-landlord":
		document.getElementById('question-box').innerHTML = brLandlord;
		setBackground(type);
		break;
	case "br-job":
		document.getElementById('question-box').innerHTML = brJob;
		setBackground(type);
		break;
	case "br-duration":
		document.getElementById('question-box').innerHTML = brDuration;
		setBackground(type);
		break;
	case "br-business":
		document.getElementById('question-box').innerHTML = brBusiness;
		setBackground(type);
		break;
	case "br-cost":
		document.getElementById('question-box').innerHTML = brCost;
		setBackground(type);
		break;
	case "br-payments":
		document.getElementById('question-box').innerHTML = brPayments;
		setBackground(type);
		break;
	case "br-credit":
		document.getElementById('question-box').innerHTML = brCredit;
		setBackground(type);
		break;
	case "br-advert":
		document.getElementById('question-box').innerHTML = brAdvert;
		setBackground(type);
		break;
	case "br-write":
		document.getElementById('question-box').innerHTML = brWrite;
		setBackground(type);
		break;
	case "dm-what":
		document.getElementById('question-box').innerHTML = dmWhat;
		setBackground(type);
		break;
	case "dm-pay":
		document.getElementById('question-box').innerHTML = dmPay;
		setBackground(type);
		break;
	case "dm-cost":
		document.getElementById('question-box').innerHTML = dmCost;
		setBackground(type);
		break;
	case "dm-work":
		document.getElementById('question-box').innerHTML = dmWork;
		setBackground(type);
		break;
	case "dm-creditors":
		document.getElementById('question-box').innerHTML = dmCreditors;
		setBackground(type);
		break;
	case "dm-duration":
		document.getElementById('question-box').innerHTML = dmDuration;
		setBackground(type);
		break;
	case "dm-circumstances":
		document.getElementById('question-box').innerHTML = dmCircumstances;
		setBackground(type);
		break;
	case "dm-alldebts":
		document.getElementById('question-box').innerHTML = dmAlldebts;
		setBackground(type);
		break;
	case "dm-ccjs":
		document.getElementById('question-box').innerHTML = dmCcjs;
		setBackground(type);
		break;
	case "dm-partner": 
		document.getElementById('question-box').innerHTML = dmPartner;
		setBackground(type);
		break;
	case "dm-cancel":
		document.getElementById('question-box').innerHTML = dmCancel;
		setBackground(type);
		

	}
}

function setCategory(type) {
	switch (type) {
	
	case 'iva':
		document.getElementById('iva-faq').style.display = "block";
		document.getElementById('debt-faq').style.display = "none";
		document.getElementById('bankrupt-faq').style.display = "none";
		document.getElementById('question-box').innerHTML = "Please Select a question";
		setBackgroundCat(type);
		break;
		
	case 'debt':
		document.getElementById('debt-faq').style.display = "block";
		document.getElementById('iva-faq').style.display = "none";
		document.getElementById('bankrupt-faq').style.display = "none";
		document.getElementById('question-box').innerHTML = "Please Select a question";
		setBackgroundCat(type);
		break;
	
	case 'bankrupt':
		document.getElementById('bankrupt-faq').style.display = "block";
		document.getElementById('debt-faq').style.display = "none";
		document.getElementById('iva-faq').style.display = "none";
		document.getElementById('question-box').innerHTML = "Please Select a question";
		setBackgroundCat(type);
		break;
		
	case 'glossery':
		break;
	
	}
	
}
