// JavaScript Document
var totalDebt;
var presentMonthlyPayment;
var affordableMonthlyPayment;
var homeOwner;
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function popitup(){
  cuteLittleWindow = window.open("linked_pages/debt_assessor.html", "littleWindow", "location=no,width=215,height=302");
}
function popupdebthelp()
{
  cuteLittleWindow = window.open("linked_pages/instant_debt_help.html", "littleWindow", "location=no,width=303,height=353");
}
function calculateTotalIVA(debtamount)
{
	    var IVA = (((debtamount / 100) * 25) + 5800);
	    return IVA.toFixed(0);
}
			
function calculateMonthlyIVA(debtamount)
{
	    var IVAmonthly = calculateTotalIVA(debtamount) / 60;
	    return IVAmonthly.toFixed(0);
}
	  	
function calculateQuickDebt(form)
{
       totalDebt = form.debt.value;
       var ivaValue = calculateTotalIVA(totalDebt);
       var ivaMonthly = calculateMonthlyIVA(totalDebt);
       var wipedOff = (totalDebt - ivaValue);
       document.getElementById('quickdebtform').style.display = 'none';
	   if(totalDebt >= 16000)
		{
         document.getElementById('quickdebtresult').innerHTML = 'If you made 60 monthly payments of £' + ivaMonthly + ', the total amount you would repay is £' + ivaValue + '. <strong>The total debt you would wipe off is £' + wipedOff + '</strong>.<br /><a href="#" onclick="resetquickdebtform();">Assess Again</a> ';
		}
		  else
		  {
			document.getElementById('quickdebtresult').innerHTML = 'For IVA, your minimum debt should be £16000. However, other options like debt management and remortgage etc can be used for any loan over an amount of £ 100. Please try instant debt help our step by step guide to have more detailed options; or apply now and we shall give you the best option as per your situation. Or fill in Call me back and an experienced financial advisor will call you shortly.</strong>.<br /> <a href="#" onclick="resetquickdebtform();">Assess Again</a>';  
		  }
		  
		  //var iframeName='contentFrame';
		 // var url='linked_pages/app_form.htm';
		  //alert("found the page request "+url);
		  //window.frames[iframeName].location = url;
		  //return false;
      }
      //var formName;
      function resetquickdebtform()
      {
      	  document.getElementById('quickdebtform').debt.value = '';
		  document.getElementById('quickdebtform').style.display = 'inline';
      	  document.getElementById('quickdebtresult').innerHTML = 'Use the debt assessor to instantly work out your estimated IVA Payments.';      	        	  
      	  document.getElementById('instanthelpform').debt_size.focus();
      }
	  function resetinstanthelpform()
      {
      	  document.getElementById('instanthelpform').debt_size.value = '';
		  document.getElementById('instanthelpform').pay_towards_debts.value = '';
      	  document.getElementById('instanthelpform').surplus_income.value = '';
      	  document.getElementById('instantdebtresult').innerHTML = '<p class="style52">Please complete the details in the instant help tool on the top right with approximate values and press submit to get the Best Option to your financial situation.</p> ';      	        	  
      	  document.getElementById('instanthelpform').debt_size.focus();
      }
	function SetCookie(form)
	{
  		  totalDebt = form.debt_size.value;
		  presentMonthlyPayment= form.pay_towards_debts.value;
		  affordableMonthlyPayment= form.surplus_income.value;
		  homeOwner=(form.Are_you_a_home_owner[0].checked ? 1 : 0);
		  createCookie("totalDebtCooky", totalDebt, 3);
		  createCookie("presentMonthlyPaymentCooky", presentMonthlyPayment, 2);
		  createCookie("affordableMonthlyPaymentCooky", affordableMonthlyPayment, 2);
		  createCookie("homeOwnerCooky", homeOwner, 2);
		  //alert("created cookies "+readCookie("totalDebtCooky")+ ' ' +readCookie("presentMonthlyPaymentCooky")+' '+ readCookie("affordableMonthlyPaymentCooky")+' '+readCookie("homeOwnerCooky"));
	}
		
	  function calculateBestOption()
	{
		  //alert("inside calculate best help function");
		  totalDebt = parseInt(readCookie("totalDebtCooky"));
		  presentMonthlyPayment=parseInt(readCookie("presentMonthlyPaymentCooky"));
		  affordableMonthlyPayment= parseInt(readCookie("affordableMonthlyPaymentCooky"));
		  homeOwner=parseInt(readCookie("homeOwnerCooky"));
          var ivaValue = calculateTotalIVA(totalDebt);
          var ivaMonthly = calculateMonthlyIVA(totalDebt);
          var wipedOff = (totalDebt - ivaValue);
		  document.getElementById('instanthelpform').style.display = 'none';
		  //alert("values found from cookies are"+ivaValue+ivaMonthly+wipedOff);
				//return false;
		 //SetCookie(tDebt, totalDebt);
		 //SetCookie(pMP, presentMonthlyPayment);
		 //SetCookie(aMP, affordableMonthlyPayment);
		 //SetCookie(hO, homeOwner);
		 
		 // document.getElementById('contentFrame').location = 'linked_pages/app_form.html';*/
		  if(totalDebt >= 16000)
		  {
			  
		  	if(homeOwner)
			{
				//alert("inside totalDebt >= 16000 and homeowner");
		  		document.getElementById('instantdebtresult').innerHTML = '<TABLE id="table4050" width="100%"> <TR> <TD height="45" bgColor="#cc6633" align="center" style="font-family:Arial, Helvetica, sans-serif; font-size:18px; color:#FFFFFF">Instant Help Results</TD> </TR> <TR> <TD vAlign="top"><p class="style55"><strong><u>Option 1 </strong></u></p><p class="style52">The best option for you is to have an IVA. If you make 60 monthly payments of <u><strong>&pound;' + ivaMonthly + '</strong></u>, the total amount you would repay is <u><strong>&pound;' + ivaValue +  '</strong></u>. The total debt you would wipe off is <u><strong>&pound;' + wipedOff + '</strong></u>.</p> <p class="style6"><span class="style55"><u><strong>Option 2 </strong></u></span></p><p class="style52">Your second  option can be to have a Full and Final IVA, where we can settle all of your debts by releasing equity from your property.</p> <p class="style52">Please click on the Full and Final IVA&rsquo;s link in the menu to read more on IVA&rsquo;s, or request a call back, one of our experienced consultants will call you back for a consultation.</p> <p class="style52">Or,</p> <p class="style52">Please fill in the Application Form below to help us give you the best solution to your situation.</p> <p><a href="#" onclick="resetinstanthelpform();">Assess Again</a></p></TD></TR></TABLE>';
								
			}
		  	else
			{
				//alert("inside totalDebt >= 16000 and not a homeowner");
				document.getElementById('instantdebtresult').innerHTML  = '<TABLE id="table4050" width="100%"> <TR> <TD height="45" bgColor="#cc6633" align="center" style="font-family:Arial, Helvetica, sans-serif; font-size:18px; color:#FFFFFF">Instant Help Results</TD> </TR> <TR> <TD vAlign="top"> <p>The best option for you is to have an <strong>IVA</strong>. If you make 60 monthly payments of <u><strong>&pound;' + ivaMonthly + '</strong></u>, the total amount you would repay is <u><strong>&pound;' + ivaValue + '</strong></u>. The total debt you would wipe off is <u><strong>&pound;' + wipedOff + '</u></strong>.</p> <p>Please click on the<em>IVA Criteria</em>link in the left hand side menu to read more on IVA, or request a call back, one of our experienced consultants will call you back to advise you.</p> <p>Or,</p><p> Please fill in the Application Form below to   help us give you the best solution to your situation.</p><p><a href="#" onclick="resetinstanthelpform();">Assess Again</a></p></TD></TR></TABLE>';
				
			}
		  }
		  else if(totalDebt < 16000 && totalDebt > 100)
		  {
			  //alert("inside totalDebt < 16000 && totalDebt > 100");
		      document.getElementById('instantdebtresult').innerHTML  = '<TABLE id="table4050" width="100%"> <TR> <TD height="45" bgColor="#cc6633" align="center" style="font-family:Arial, Helvetica, sans-serif; font-size:18px; color:#FFFFFF">Instant Help Results</TD> </TR> <TR> <TD vAlign="top"><p>The minimum debt amount for an IVA   is &pound;16000 <em>(please   click on the IVA Criteria link on the left hand side menu to read more about   IVA&rsquo;s)</em> </p> <p >The best option for you is to apply for <strong>Debt Management</strong></p> <p >Please click on the <em>Debt   Management</em> link on the menu to read more on debt   management plans, or request a call back, one of our experienced debt management   consultants will call you back for <strong>a consultation</strong>. </p> <p>Or,</p><p> Please fill in the Application Form below to help us give you the best solution to your situation.</p> <p><a href="#" onclick="resetinstanthelpform();">Assess Again</a></p></TD></TR></TABLE>';
			 
		  }
		  else 
		  {
			  //alert("inside totalDebt < = 100");
		  	  document.getElementById('instantdebtresult').innerHTML = '<TABLE id="table4050" width="100%"> <TR> <TD height="45" bgColor="#cc6633" align="center" style="font-family:Arial, Helvetica, sans-serif; font-size:18px; color:#FFFFFF">Instant Help Results</TD> </TR> <TR> <TD vAlign="top"><p> Invalid value, please enter a value over £100 to instantly get the best advice.<br/><br/>Or <br/><br/>Please fill in the Application Form below to help us give you the exact solution to your situation.</p> <p><a href="#" onclick = "resetinstanthelpform();" >Assess Again</a></p></TD></TR></TABLE>'
			  
			  
			  
				
		  }
		 
	}
	
	function loadIframe(iframeName, url, form) 
	{
	  if ( window.frames[iframeName] ) {
		 
		if(url == 'linked_pages/app_form.htm')
		{
			//alert("found the page request"+url);
			calculateBestOption(form);
		}
		else if(url == 'step_two.html')
		{
			//alert("found the page "+url+" "+iframeName);
			takeIncomeExpenditure(form);
		}
		else if(url == 'step_three.html')
		{
			takeCreditorsDetails(form);
		}
		else if(url == 'step_four.html')
		{
			takeAssetsDetails(form);
		}
		else if(url == 'result_page.html')
		{
			takePersonalDetails(form);			
		}
		else
		{
			alert("invalid page request");
			return true;
		}
		window.frames[iframeName].location = url;
		return false;
	  }
	  else return true;
	}
	//global variables
	var Wages;
	var WagesPartner;
	var RentMortgage;
	var SecondCharge;
	var Pension;
	var MortgageProtection;
	var IncomeSupport;
	var Endowment;
	var HousingBenefits;
	var LifeAssurance;
	var Unemployment;
	var CouncilTax;
	var MaternityBenifits;
	var HomeContents;
	var InvalidityBenefits;
	var Electricity;
	var ChildBenefits;
	var Gas;
	var OtherBenefits;
	var Water;
	var FamilyCredit;
	var HouseMaintenance;
	var ChildTaxCredit;
	var Telephone;
	var DLA;
	var MobilePhone;
	var Maintenance;
	var TVLicence;
	var Lodger;
	var TVVideoRental;
	var OthersIncome;
	var CarPetrol;
	var CarInsurance;
	var Food;
	var MealsatWork;
	var HP;
	var SecuredLoans;
	var Travel;
	var PublicTransport;
	var NurseryFees;
	var ChildMinding;
	var ChildMaintenance;
	var Medical;
	var SchoolMealsFee;
	var OthersExp;
	var TotalIncome;
	var TotalExpenditure;
	var MonthlyDisposible;
	function takeIncomeExpenditure(form)
	{
		Wages=parseInt(form.Wages.value =='' ? 0 : form.Wages.value);
		WagesPartner=parseInt(form.WagesPartner.value =='' ? 0 : form.WagesPartner.value);
		RentMortgage=parseInt(form.RentMortgage.value =='' ? 0 : form.RentMortgage.value);
		SecondCharge=parseInt(form.SecondCharge.value =='' ? 0 : form.SecondCharge.value);
		Pension=parseInt(form.Pension.value =='' ? 0 : form.Pension.value);
		MortgageProtection=parseInt(form.MortgageProtection.value =='' ? 0 : form.MortgageProtection.value);
		IncomeSupport=parseInt(form.IncomeSupport.value =='' ? 0 : form.IncomeSupport.value);
		Endowment=parseInt(form.Endowment.value =='' ? 0 : form.Endowment.value);
		HousingBenefits=parseInt(form.HousingBenefits.value =='' ? 0 : form.HousingBenefits.value);
		LifeAssurance=parseInt(form.LifeAssurance.value =='' ? 0 : form.LifeAssurance.value);
		Unemployment=parseInt(form.Unemployment.value =='' ? 0 : form.Unemployment.value);
		CouncilTax=parseInt(form.CouncilTax.value =='' ? 0 : form.CouncilTax.value);
		MaternityBenifits=parseInt(form.MaternityBenifits.value =='' ? 0 : form.MaternityBenifits.value);
		HomeContents=parseInt(form.HomeContents.value =='' ? 0 : form.HomeContents.value);
		InvalidityBenefits=parseInt(form.InvalidityBenefits.value =='' ? 0 : form.InvalidityBenefits.value);
		Electricity=parseInt(form.Electricity.value =='' ? 0 : form.Electricity.value);
		ChildBenefits=parseInt(form.ChildBenefits.value =='' ? 0 : form.ChildBenefits.value);
		Gas=parseInt(form.Gas.value =='' ? 0 : form.Gas.value);
		OtherBenefits=parseInt(form.OtherBenefits.value =='' ? 0 : form.OtherBenefits.value);
		Water=parseInt(form.Water.value =='' ? 0 : form.Water.value);
		FamilyCredit=parseInt(form.FamilyCredit.value =='' ? 0 : form.FamilyCredit.value);
		HouseMaintenance=parseInt(form.HouseMaintenance.value =='' ? 0 : form.HouseMaintenance.value);
		ChildTaxCredit=parseInt(form.ChildTaxCredit.value =='' ? 0 : form.ChildTaxCredit.value);
		Telephone=parseInt(form.Telephone.value =='' ? 0 : form.Telephone.value);
		DLA=parseInt(form.DLA.value =='' ? 0 : form.DLA.value);
		MobilePhone=parseInt(form.MobilePhone.value =='' ? 0 : form.MobilePhone.value);
		Maintenance=parseInt(form.Maintenance.value =='' ? 0 : form.Maintenance.value);
		TVLicence=parseInt(form.TVLicence.value =='' ? 0 : form.TVLicence.value);
		Lodger=parseInt(form.Lodger.value =='' ? 0 : form.Lodger.value);
		TVVideoRental=parseInt(form.TVVideoRental.value =='' ? 0 : form.TVVideoRental.value);
		OthersIncome=parseInt(form.OthersIncome.value =='' ? 0 : form.OthersIncome.value);
		CarPetrol=parseInt(form.CarPetrol.value =='' ? 0 : form.CarPetrol.value);
		CarInsurance=parseInt(form.CarInsurance.value =='' ? 0 : form.CarInsurance.value);
		Food=parseInt(form.Food.value =='' ? 0 : form.Food.value);
		MealsatWork=parseInt(form.MealsatWork.value =='' ? 0 : form.MealsatWork.value);
		HP=parseInt(form.HP.value =='' ? 0 : form.HP.value);
		SecuredLoans=parseInt(form.SecuredLoans.value =='' ? 0 : form.SecuredLoans.value);
		Travel=parseInt(form.Travel.value =='' ? 0 : form.Travel.value);
		PublicTransport=parseInt(form.PublicTransport.value =='' ? 0 : form.PublicTransport.value);
		NurseryFees=parseInt(form.NurseryFees.value =='' ? 0 : form.NurseryFees.value);
		ChildMinding=parseInt(form.ChildMinding.value =='' ? 0 : form.ChildMinding.value);
		ChildMaintenance=parseInt(form.ChildMaintenance.value =='' ? 0 : form.ChildMaintenance.value);
		Medical=parseInt(form.Medical.value =='' ? 0 : form.Medical.value);
		SchoolMealsFee=parseInt(form.SchoolMealsFee.value =='' ? 0 : form.SchoolMealsFee.value);
		OthersExp=parseInt(form.OthersExp.value =='' ? 0 : form.OthersExp.value);
		//parent.document.getElementById('quickdebtresult').innerHTML  = 'Welcome to Step Two to find the best solution to your financial worries. ';
		//parent.document.getElementById('contentFrame').src="linked_pages/step_two.html";
		//iframeName="contentFrame";
		//url="linked_pages/step_two.html";
		//window.frames[iframeName].location = url; 
		//alert("this is the home page");
	}
	
	
	
	var CreditorType1;
	var CreditorName1;
	var EstmatedBalance1;
	var PaymentperMonth1;
	var debtOwner1;
	var CreditorType2;
	var CreditorName2;
	var EstmatedBalance2;
	var PaymentperMonth2;
	var debtOwner2;
	var CreditorType3;
	var CreditorName3;
	var EstmatedBalance3;
	var PaymentperMonth3;
	var debtOwner3;
	var CreditorType4;
	var CreditorName4;
	var EstmatedBalance4;
	var PaymentperMonth4;
	var debtOwner4;
	var CreditorType5;
	var CreditorName5;
	var EstmatedBalance5;
	var PaymentperMonth5;
	var debtOwner5;
	var CreditorType6;
	var CreditorName6;
	var EstmatedBalance6;
	var PaymentperMonth6;
	var debtOwner6;
	var CreditorType7;
	var CreditorName7;
	var EstmatedBalance7;
	var PaymentperMonth7;
	var debtOwner7;
	var CreditorType8;
	var CreditorName8;
	var EstmatedBalance8;
	var PaymentperMonth8;
	var debtOwner8;
	var CreditorType9;
	var CreditorName9;
	var EstmatedBalance9;
	var PaymentperMonth9;
	var debtOwner9;
	var CreditorType10;
	var CreditorName10;
	var EstmatedBalance10;
	var PaymentperMonth10;
	var debtOwner10;
	var CreditorType11;
	var CreditorName11;
	var EstmatedBalance11;
	var PaymentperMonth11;
	var debtOwner11;
	var CreditorType12;
	var CreditorName12;
	var EstmatedBalance12;
	var PaymentperMonth12;
	var debtOwner12;
	var CreditorType13;
	var CreditorName13;
	var EstmatedBalance13;
	var PaymentperMonth13;
	var debtOwner13;
	var CreditorType14;
	var CreditorName14;
	var EstmatedBalance14;
	var PaymentperMonth14;
	var debtOwner14;
	var CreditorType15;
	var CreditorName15;
	var EstmatedBalance15;
	var PaymentperMonth15;
	var debtOwner15;
	var CreditorType16;
	var CreditorName16;
	var EstmatedBalance16;
	var PaymentperMonth16;
	var debtOwner16;
	var CreditorType17;
	var CreditorName17;
	var EstmatedBalance17;
	var PaymentperMonth17;
	var debtOwner17;
	
	function takeCreditorsDetails(form)
	{
		CreditorType1=form.CreditorType1.options[form.CreditorType1.selectedIndex].value;
		CraditorName1=form.CraditorName1.value;
		EstimatedBalance1=parseInt(form.EstimatedBalance1.value =='' ? 0 : form.EstimatedBalance1.value);
		PaymentperMonth1=parseInt(form.PaymentperMonth1.value =='' ? 0 : form.PaymentperMonth1.value);
		DebtOwner1=form.DebtOwner1.options[form.DebtOwner1.selectedIndex].value;
		CreditorType2=form.CreditorType2.options[form.CreditorType2.selectedIndex].value;
		CraditorName2=form.CraditorName2.value;
		EstimatedBalance2=parseInt(form.EstimatedBalance2.value =='' ? 0 : form.EstimatedBalance2.value);
		PaymentperMonth2=parseInt(form.PaymentperMonth2.value =='' ? 0 : form.PaymentperMonth2.value);
		DebtOwner2=form.DebtOwner2.options[form.DebtOwner2.selectedIndex].value;
		CreditorType3=form.CreditorType3.options[form.CreditorType3.selectedIndex].value;
		CraditorName3=form.CraditorName3.value;
		EstimatedBalance3=parseInt(form.EstimatedBalance3.value =='' ? 0 : form.EstimatedBalance3.value);
		PaymentperMonth3=parseInt(form.PaymentperMonth3.value =='' ? 0 : form.PaymentperMonth3.value);
		DebtOwner3=form.DebtOwner3.options[form.DebtOwner3.selectedIndex].value;
		CreditorType4=form.CreditorType4.options[form.CreditorType4.selectedIndex].value;
		CraditorName4=form.CraditorName4.value;
		EstimatedBalance4=parseInt(form.EstimatedBalance4.value =='' ? 0 : form.EstimatedBalance4.value);
		PaymentperMonth4=parseInt(form.PaymentperMonth4.value =='' ? 0 : form.PaymentperMonth4.value);
		DebtOwner4=form.DebtOwner4.options[form.DebtOwner4.selectedIndex].value;
		CreditorType5=form.CreditorType5.options[form.CreditorType5.selectedIndex].value;
		CraditorName5=form.CraditorName5.value;
		EstimatedBalance5=parseInt(form.EstimatedBalance5.value =='' ? 0 : form.EstimatedBalance5.value);
		PaymentperMonth5=parseInt(form.PaymentperMonth5.value =='' ? 0 : form.PaymentperMonth5.value);
		DebtOwner5=form.DebtOwner5.options[form.DebtOwner5.selectedIndex].value;
		CreditorType6=form.CreditorType6.options[form.CreditorType6.selectedIndex].value;
		CraditorName6=form.CraditorName6.value;
		EstimatedBalance6=parseInt(form.EstimatedBalance6.value =='' ? 0 : form.EstimatedBalance6.value);
		PaymentperMonth6=parseInt(form.PaymentperMonth6.value =='' ? 0 : form.PaymentperMonth6.value);
		DebtOwner6=form.DebtOwner6.options[form.DebtOwner6.selectedIndex].value;
		CreditorType7=form.CreditorType7.options[form.CreditorType7.selectedIndex].value;
		CraditorName7=form.CraditorName7.value;
		EstimatedBalance7=parseInt(form.EstimatedBalance7.value =='' ? 0 : form.EstimatedBalance7.value);
		PaymentperMonth7=parseInt(form.PaymentperMonth7.value =='' ? 0 : form.PaymentperMonth7.value);
		DebtOwner7=form.DebtOwner7.options[form.DebtOwner7.selectedIndex].value;
		CreditorType8=form.CreditorType8.options[form.CreditorType8.selectedIndex].value;
		CraditorName8=form.CraditorName8.value;
		EstimatedBalance8=parseInt(form.EstimatedBalance8.value =='' ? 0 : form.EstimatedBalance8.value);
		PaymentperMonth8=parseInt(form.PaymentperMonth8.value =='' ? 0 : form.PaymentperMonth8.value);
		DebtOwner8=form.DebtOwner8.options[form.DebtOwner8.selectedIndex].value;
		CreditorType9=form.CreditorType9.options[form.CreditorType9.selectedIndex].value;
		CraditorName9=form.CraditorName9.value;
		EstimatedBalance9=parseInt(form.EstimatedBalance9.value =='' ? 0 : form.EstimatedBalance9.value);
		PaymentperMonth9=parseInt(form.PaymentperMonth9.value =='' ? 0 : form.PaymentperMonth9.value);
		DebtOwner9=form.DebtOwner9.options[form.DebtOwner9.selectedIndex].value;
		CreditorType10=form.CreditorType10.options[form.CreditorType10.selectedIndex].value;
		CraditorName10=form.CraditorName10.value ;
		EstimatedBalance10=parseInt(form.EstimatedBalance10.value =='' ? 0 : form.EstimatedBalance10.value);
		PaymentperMonth10=parseInt(form.PaymentperMonth10.value =='' ? 0 : form.PaymentperMonth10.value);
		DebtOwner10=form.DebtOwner10.options[form.DebtOwner10.selectedIndex].value;
		CreditorType11=form.CreditorType11.options[form.CreditorType11.selectedIndex].value;
		CraditorName11=form.CraditorName11.value;
		EstimatedBalance11=parseInt(form.EstimatedBalance11.value =='' ? 0 : form.EstimatedBalance11.value);
		PaymentperMonth11=parseInt(form.PaymentperMonth11.value =='' ? 0 : form.PaymentperMonth11.value);
		DebtOwner11=form.DebtOwner11.options[form.DebtOwner11.selectedIndex].value;
		CreditorType12=form.CreditorType12.options[form.CreditorType12.selectedIndex].value;
		CraditorName12=form.CraditorName12.value;
		EstimatedBalance12=parseInt(form.EstimatedBalance12.value =='' ? 0 : form.EstimatedBalance12.value);
		PaymentperMonth12=parseInt(form.PaymentperMonth12.value =='' ? 0 : form.PaymentperMonth12.value);
		DebtOwner12=form.DebtOwner12.options[form.DebtOwner12.selectedIndex].value;
		CreditorType13=form.CreditorType13.options[form.CreditorType13.selectedIndex].value;
		CraditorName13=form.CraditorName13.value;
		EstimatedBalance13=parseInt(form.EstimatedBalance13.value =='' ? 0 : form.EstimatedBalance13.value);
		PaymentperMonth13=parseInt(form.PaymentperMonth13.value =='' ? 0 : form.PaymentperMonth13.value);
		DebtOwner13=form.DebtOwner13.options[form.DebtOwner13.selectedIndex].value;
		CreditorType14=form.CreditorType14.options[form.CreditorType14.selectedIndex].value;
		CraditorName14=form.CraditorName14.value;
		EstimatedBalance14=parseInt(form.EstimatedBalance14.value =='' ? 0 : form.EstimatedBalance14.value);
		PaymentperMonth14=parseInt(form.PaymentperMonth14.value =='' ? 0 : form.PaymentperMonth14.value);
		DebtOwner14=form.DebtOwner14.options[form.DebtOwner14.selectedIndex].value;
		CreditorType15=form.CreditorType15.options[form.CreditorType15.selectedIndex].value;
		CraditorName15=form.CraditorName15.value;
		EstimatedBalance15=parseInt(form.EstimatedBalance15.value =='' ? 0 : form.EstimatedBalance15.value);
		PaymentperMonth15=parseInt(form.PaymentperMonth15.value =='' ? 0 : form.PaymentperMonth15.value);
		DebtOwner15=form.DebtOwner15.options[form.DebtOwner15.selectedIndex].value;
		CreditorType16=form.CreditorType16.options[form.CreditorType16.selectedIndex].value;
		CraditorName16=form.CraditorName16.value;
		EstimatedBalance16=parseInt(form.EstimatedBalance16.value =='' ? 0 : form.EstimatedBalance16.value);
		PaymentperMonth16=parseInt(form.PaymentperMonth16.value =='' ? 0 : form.PaymentperMonth16.value);
		DebtOwner16=form.DebtOwner16.options[form.DebtOwner16.selectedIndex].value;
		CreditorType17=form.CreditorType17.options[form.CreditorType17.selectedIndex].value;
		CraditorName17=form.CraditorName17.value;
		EstimatedBalance17=parseInt(form.EstimatedBalance17.value =='' ? 0 : form.EstimatedBalance17.value);
		PaymentperMonth17=parseInt(form.PaymentperMonth17.value =='' ? 0 : form.PaymentperMonth17.value);
		DebtOwner17=form.DebtOwner17.options[form.DebtOwner17.selectedIndex].value;
		
		//parent.document.getElementById('quickdebtresult').innerHTML = 'Welcome to Step Three to find the best solution to your financial worries.' ;
		//parent.ContentFrame.location.href="linked_pages/step_three.html";
	
		
	}
	var ClientTitle;
	var PartnerTitle;
	var ClientFirstName;
	var PartnerFirstName;
	var ClientSurname;
	var PartnerSurname;
	var ClientHomePhone;
	var PartnerHomePhone;
	var ClientMobile;
	var PartnerMobile;
	var ClientWorkPhone;
	var PartnerWorkPhone;
	var ClientDateofBirth;
	var PartnerDateofBirth;
	var ClientGender;
	var PartnerGender;
	var Clientemail;
	var Partneremail;
	var ClientMaritalStatus;
	var ClientDependents;
	var ClientEmployed;
	var ClientHomeOwner;
	var ClientAccomodation;
	var ClientHouseValue;
	var ClientBalanceOnMortgage;
	var ClientSecuredLoanBalance;
	var ClientCarFinance;
	var ClientBalanceOnCarFinance;
	var ClientStreet1;
	var ClientStreet2;
	var ClientTown;
	var ClientCounty;
	var ClientPostCode;
	
	function takeAssetsDetails(form)
	{
		ClientHomeOwner=(form.ClientHomeOwner.checked ? true : false );
		ClientAccomodation=form.ClientAccomodation.options[form.ClientAccomodation.selectedIndex].value;
		ClientHouseValue=parseInt(form.ClientHouseValue.value =='' ? 0 : form.ClientHouseValue.value);
		ClientBalanceOnMortgage=parseInt(form.ClientBalanceOnMortgage.value =='' ? 0 : form.ClientBalanceOnMortgage.value);
		ClientSecuredLoanBalance=parseInt(form.ClientSecuredLoanBalance.value =='' ? 0 : form.ClientSecuredLoanBalance.value);
		ClientCarFinance=(form.ClientCarFinance.checked ? true : false );
		ClientBalanceOnCarFinance=parseInt(form.ClientBalanceOnCarFinance.value =='' ? 0 : form.ClientBalanceOnCarFinance.value);
		//parent.document.getElementById('quickdebtresult').innerHTML = 'Welcome to Step Four to get the best solution to your financial problems'; 
	
	}
	
	function takePersonalDetails(form)
	{
		
		ClientTitle=form.ClientTitle.options[form.ClientTitle.selectedIndex].value;
		PartnerTitle=form.PartnerTitle.options[form.PartnerTitle.selectedIndex].value;
		ClientFirstName=form.ClientFirstName.value;
		PartnerFirstName=form.PartnerFirstName.value;
		ClientSurname=form.ClientSurname.value;
		PartnerSurname=form.PartnerSurname.value;
		ClientHomePhone=form.ClientHomePhone.value;
		PartnerHomePhone=form.PartnerHomePhone.value;
		ClientMobile=form.ClientMobile.value;
		PartnerMobile=form.PartnerMobile.value;
		ClientWorkPhone=form.ClientWorkPhone.value;
		PartnerWorkPhone=form.PartnerWorkPhone.value;
		ClientDateofBirth=form.ClientDateofBirth.value;
		PartnerDateofBirth=form.PartnerDateofBirth.value;
		ClientGender=(form.ClientGender[0].checked ? 'M' : 'F');
		PartnerGender=(form.PartnerGender[0].checked ? 'M' : 'F');
		Clientemail=form.Clientemail.value;
		Partneremail=form.Partneremail.value;
		ClientMaritalStatus=form.ClientMaritalStatus.options[form.ClientMaritalStatus.selectedIndex].value;
		ClientDependents=form.ClientDependents.options[form.ClientDependents.selectedIndex].value;
		ClientEmployed=form.ClientEmployed.value;
		
		ClientStreet1=form.ClientStreet1.value;
		ClientStreet2=form.ClientStreet2.value;
		ClientTown=form.ClientTown.value;
		ClientCounty=form.ClientCounty.value;
		ClientPostCode=form.ClientPostCode.value;
			
		//parent.document.getElementById('quickdebtresult').innerHTML = 'Here is the best solution to your financial worries'; 
		//contentFrame.location.href="linked_pages/result_page.html";
	}
	var totalMonthlyPayment;
	var MonthlyDisposible;
	var aquity;
	function giveResult()
	{
		totalDebt= EstimatedBalance1 + EstimatedBalance2 + EstimatedBalance3 + EstimatedBalance4 + EstimatedBalance5 + EstimatedBalance6 + EstimatedBalance7 + EstimatedBalance8 + EstimatedBalance9 + EstimatedBalance10 + EstimatedBalance11 + EstimatedBalance12 + EstimatedBalance13 + EstimatedBalance14 +EstimatedBalance15 + EstimatedBalance16 + EstimatedBalance17; 
		
		totalMonthlyPayment= PaymentperMonth1 + PaymentperMonth2 + PaymentperMonth3 + PaymentperMonth4 + PaymentperMonth5 + PaymentperMonth6 + PaymentperMonth7 + PaymentperMonth8 + PaymentperMonth9 + PaymentperMonth10 + PaymentperMonth11 + PaymentperMonth12 + PaymentperMonth13 + PaymentperMonth14 + PaymentperMonth15 + PaymentperMonth16 + PaymentperMonth17;
		
		 
		
		TotalIncome= Wages + WagesPartner + Pension + IncomeSupport + HousingBenefits + Unemployment + MaternityBenifits + InvalidityBenefits + ChildBenefits + OtherBenefits + FamilyCredit + ChildTaxCredit + DLA + Maintenance  + Lodger + OthersIncome;
		
		TotalExpenditure= RentMortgage + SecondCharge  + MortgageProtection + Endowment  + LifeAssurance  + CouncilTax  + HomeContents  + Electricity + Gas + Water + HouseMaintenance  + Telephone + MobilePhone + TVLicence + TVVideoRental  + CarPetrol + CarInsurance + Food + MealsatWork + HP + SecuredLoans + Travel + PublicTransport + NurseryFees + ChildMinding + ChildMaintenance + Medical + SchoolMealsFee + OthersExp;
		
		MonthlyDisposible = TotalIncome - TotalExpenditure;
		
		aquity=((ClientHouseValue * 0.85) - (ClientBalanceOnMortgage + ClientSecuredLoanBalance));
		var minMonPayment=(totalMonthlyPayment >=200 ? (totalMonthlyPayment/2) : 100);
		var minReqPayment=minMonPayment*60;
		var saving=totalDebt - minReqPayment;
		
		if(ClientHomeOwner)
		{
			if(aquity <= (totalDebt/2))
			{
		   parent.contentFrame.document.getElementById('solution').innerHTML='Dear <strong> '  + ClientTitle + ' ' + ClientFirstName + ' ' + ClientSurname + '</strong> <br/><br/>Thank you for using our Step by Step Guide. On the basis of the information you have provided we have put together the best option for dealing with your financial worries. Please bear in mind, however, that this can only be the rough outline of a solution to your debt problems. We strongly recommend that you contact one of our experienced financial advisors in order to discuss your situation in more detail. The consultation will be completely free of charge. <br/> As per the details provided by you to this point: <br/> You owe approximately :  £'  + totalDebt +   '<br/> You are currently paying : £' + totalMonthlyPayment + ' per month <br/> <br/> In your circumstances, the best solution for you is Full and Final IVA (Individual Voluntary Arrangement). You will be out of all of your loan without getting any other resources.<br/><br/> You will be required to pay a minimum amount of: £'  + minMonPayment + ' per month over 5 years. <br/> The total amount you will pay is: £' + minReqPayment  +  '. <br/> The remainder of your debt will be wiped off. <br/> You will save: £' + saving + '. <br/> You will be completely debt-free at the end of the 5 year period. <br/> <br/> In addition: <br/><br/> <ul type="disc"> <li>Interest on your debts will  be stopped straight away, along with any other charges.</li> <li>No creditor will legally be  able to contact you within the 5 years period</li> <li>All administration will be  handled for you. All you have to do is to make a single payment every month.</li> <li>You will still be able to obtain a  mortgage.</li> <li>Your credit rating will be  repaired at the end of the 5 years.</li> </ul>   <hr /> OOther options (subject to knowing your exact circumstances) may be: <br/><br/><strong>Option 1: </strong> Debt Management ("contact us to find out more").<br/><br/><strong>Option 2: </strong> Debt Management ("contact us to find out more").<br/>';


	
			/*parent.contentFrame.document.getElementById('solution').innerHTML='Hi <strong> ' + ClientTitle + ' ' + ClientFirstName + ' ' + ClientSurname + '</strong>Thank you for using our Step by Step Guide to give you the best option to your financial wories. We try to workout the best option for your circumstances. However, please bear in mind that the options presented here are the rough guidelines to solve your problems. We strongly recommend that you should contact one of our experienced financial advisor to discuss your situation in detail. This you can do by dialing a no given on our website or sending a request to call back. We do not charge any fee for this financial consultation and shall try to give you the best possible options to solve your problem, ensuring full customer satisfaction. <br/> As per the details provided by you during last steps: <br/> You owe approximatly : ' + totalDebt + '<br/> You are currently paying : ' + totalMonthlyPayment + ' per month<br/>  <br/> <br/> <strong>Following are the Options available for you: <br/> Option1: </strong> Full and Final IVA (You will be out of all of your loan without paying any of these). IVA is a government approved debt solution that can get you debt free in 60 months without any hassle from your creditors. Contact us to find out more on IVA. <br/><strong>Option2: </strong> Debt Management ("contact us to find out more").<br/> In case of IVA and Debt Management you will be required to pay a minimum amount of ' + minMonPayment + ' per month. <br/> In 5 years the total amount you will pay is' + minReqPayment  + '<br/>Remaining of your debt will be wiped off. <br/> Saving you ' + saving + '<br/> Besides this:';*/
			}
			else
			{
				
			parent.contentFrame.document.getElementById('solution').innerHTML='Dear <strong> '  + ClientTitle + ' ' + ClientFirstName + ' ' + ClientSurname + '</strong> <br/><br/>Thank you for using our Step by Step Guide. On the basis of the information you have provided we have put together the best option for dealing with your financial worries. Please bear in mind, however, that this can only be the rough outline of a solution to your debt problems. We strongly recommend that you contact one of our experienced financial advisors in order to discuss your situation in more detail. The consultation will be completely free of charge. <br/> As per the details provided by you to this point: <br/> You owe approximately :  £'  + totalDebt +   '<br/> You are currently paying :  £' + totalMonthlyPayment + ' per month <br/> <br/> In your circumstances, the best solution for you is Debt Management ("contact us to find out more") <br/><br/> You will be required to pay a minimum amount of £100 per month. All administration will be  handled for you. All you have to do is to make a single payment every month. You will still be able to obtain a  mortgage. <hr /> Other options (subject to knowing your exact circumstances) may be: <br/><br/><strong> Option1: </strong>Full and Final IVA ("You will be out of all of your loan without paying any of these"). IVA is a government approved debt solution that can get you debt free in 60 months without any hassle from your creditors (Contact us to find more on IVA). <br/> <br/><strong>Option 2: </strong> Remortgage. We will help you generate more resources from your capital to payoff your debts, no extra burdon on you (Contact us to find out more). <br/> In case of IVA you will be required to pay a minimum amount of:  £' + minMonPayment + ' per month. <br/> In 5 years the total amount you will pay is: £' + minReqPayment  + '<br/>Remaining of your debt will be wiped off. <br/> Saving you: £' + saving + '<br/> <br/> <br/> In addition: <br/><br/> <ul type="disc"> <li>Interest on your debts will  be stopped straight away, along with any other charges.</li> <li>No creditor will legally be  able to contact you within the 5 years period</li> <li>All administration will be  handled for you. All you have to do is to make a single payment every month.</li> <li>You will still be able to obtain a  mortgage.</li> <li>Your credit rating will be  repaired at the end of the 5 years.</li> </ul>  ';	
				/*parent.contentFrame.document.getElementById('solution').innerHTML='Hi <strong> ' + ClientTitle +' ' + ClientFirstName + ' ' + ClientSurname + '</strong> <br/>Thank you for using our Step by Step Guide to give you the best option to your financial wories. We try to workout the best option for your circumstances. However, please bear in mind that the options presented here are rough guidelines to solve your problems. We strongly recommend that you should contact one of our experienced financial advisor to discuss your situation in detail. We do not charge any fee for this financial consultation and shall try to give you the best possible options to solve your problem, ensuring full customer satisfaction. <br/> As per the details provided by you during last steps: <br/> You owe approximatly : ' + totalDebt + '<br/> You are currently paying : ' + totalMonthlyPayment + ' per month<br/>  <br/> <br/> <strong>Following are the Options available for you: <br/> Option1: </strong> Debt Management ("contact us to find out more") <br/> <strong> Option2: </strong>Full and Final IVA ("You will be out of all of your loan without paying any of these"). IVA is a government approved debt solution that can get you debt free in 60 months without any hassle from your creditors. Contact us to find more on IVA. <br/> <strong>Option 3: </strong> Remortgage. ("we will help you generate more resources from your capital to payoff your debts, no extra burdon on you"). Contact us to find out more. <br/> In case of IVA and Debt Management you will be required to pay a minimum amount of ' + minMonPayment + ' per month. <br/> In 5 years the total amount you will pay is' + minReqPayment  + '<br/>Remaining of your debt will be wiped off. <br/> Saving you ' + saving + '<br/> Besides this:';*/
			
			}
		}
		else 
		{
			
parent.contentFrame.document.getElementById('solution').innerHTML='Dear <strong> '  + ClientTitle + ' ' + ClientFirstName + ' ' + ClientSurname + '</strong> <br/><br/>Thank you for using our Step by Step Guide. On the basis of the information you have provided we have put together the best option for dealing with your financial worries. Please bear in mind, however, that this can only be the rough outline of a solution to your debt problems. We strongly recommend that you contact one of our experienced financial advisors in order to discuss your situation in more detail. The consultation will be completely free of charge. <br/> As per the details provided by you to this point: <br/> You owe approximately :  £'  + totalDebt +   '<br/> You are currently paying : £' + totalMonthlyPayment + ' per month <br/> <br/> In your circumstances, the best solution for you is Debt Management ("contact us to find out more") <br/><br/> You will be required to pay a minimum amount of £100 per month. All administration will be  handled for you. All you have to do is to make a single payment every month. You will still be able to obtain a  mortgage. <hr /> Other options (subject to knowing your exact circumstances) may be: <br/><br/><strong> Option1: </strong>Full and Final IVA ("You will be out of all of your loan without paying any of these"). IVA is a government approved debt solution that can get you debt free in 60 months without any hassle from your creditors (Contact us to find more on IVA). <br/><br/><strong>Option 2: </strong> Remortgage. We will help you generate more resources from your capital to payoff your debts, no extra burdon on you (Contact us to find out more). <br/> In case of IVA you will be required to pay a minimum amount of: £' + minMonPayment + ' per month. <br/> In 5 years the total amount you will pay is: £' + minReqPayment  + '<br/>Remaining of your debt will be wiped off. <br/> Saving you: £' + saving + '<br/> <br/> <br/> In addition: <br/><br/> <ul type="disc"> <li>Interest on your debts will  be stopped straight away, along with any other charges.</li> <li>No creditor will legally be  able to contact you within the 5 years period</li> <li>All administration will be  handled for you. All you have to do is to make a single payment every month.</li> <li>You will still be able to obtain a  mortgage.</li> <li>Your credit rating will be  repaired at the end of the 5 years.</li> </ul>  ';	
							/*parent.contentFrame.document.getElementById('solution').innerHTML='Hi <strong> ' + ClientTitle + ' ' + ClientFirstName + ' ' + ClientSurname + '</strong>Thank you for using our Step by Step Guide to give you the best option to your financial wories. We try to workout the best option for your circumstances. However, please bear in mind that the options presented here are the rough guidelines to solve your problems. We strongly recommend that you should contact one of our experienced financial advisor to discuss your situation in detail. This you can do by dialing a no given on our website or sending a request to call back. We do not charge any fee for this financial consultation and shall try to give you the best possible options to solve your problem, ensuring full customer satisfaction. <br/> As per the details provided by you during last steps: <br/> You owe approximatly : ' + totalDebt + '<br/> You are currently paying : ' + totalMonthlyPayment + ' per month<br/> Debt manatgement would be the best solution for you<br/> we can give you the best option for your debt mangement. <br/> In case of IVA and Debt Management you will be required to pay a minimum amount of ' + minMonPayment + ' per month. <br/> In 5 years the total amount you will pay is' + minReqPayment  + '<br/>Remaining of your debt will be wiped off. <br/> Saving you ' + saving + '<br/> Besides this:';*/
		}
		
		//parent.document.getElementById('quickdebtresult').innerHTML = 'Here is the best solution to your financial worries'; 
	
	}
	