function doProcessing() {	
    document.getElementById('submitButton').className = 'thide';
	document.getElementById('processing').className = 'tshow';
}
function info(obj){
      window.open(obj.href,'',obj.rel+',directories=0,menubar=0,location=0,screenX=100,screenY=75,left=100,top=75,copyhistory=0,resizeable=0',false);
      return false;
}
function showDownpayment()
{
	var propvalue = document.getElementById("PropertyValue").value;	
	var arr = new Array (0.0,0.03,0.05,0.1,0.15,0.2);
	var per= new Array(0,3,5,10,15,20);
	var index = document.getElementById("DownPayment_Front").selectedIndex;
	
	if(propvalue>0)
	{
		for (i=0;i<arr.length;i=i+1){
			
			var downpayment = propvalue * arr[i];
			downpayment = parseInt(downpayment);
			downpayment = addCommas(downpayment);
			
			if(i == 0){
				downpayment = per[i]+'% ($'+ downpayment + ')';
			}else if (i > 0 && i < 5){
				downpayment = per[i]+'% (Approx. $'+ downpayment + ')';
			}else{
				downpayment = per[i]+'%+ (Approx. $'+ downpayment + '+)';
			}
			
			if(document.getElementById("DownPayment_Front").options[0].value == 0){
				document.getElementById("DownPayment_Front").options[i].innerHTML = downpayment;
			}else{
				document.getElementById("DownPayment_Front").options[i+1].innerHTML = downpayment;
			}
			
			
		}
		document.getElementById("DownPayment_Front").selectedIndex=(index);
		
	}else{
	
		for (i=0;i<arr.length;i=i+1){
			var downpayment = per[i]+'% down';
			if(document.getElementById("DownPayment_Front").options[0].value == 0){
				document.getElementById("DownPayment_Front").options[i].innerHTML = downpayment;
			}else{
				document.getElementById("DownPayment_Front").options[i+1].innerHTML = downpayment;
			}
		}
		document.getElementById("DownPayment_Front").selectedIndex = index;
	}
}

function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

