

/*
document.write("<style>");
document.write("td { background-color: #f4f7f9; border-bottom: 1px solid #fff; font-size: .75em; } \n ");
document.write("form { margin: 0; padding: 0; }  \n");
document.write("input { border: 1px solid #000; background-color: #fff; padding-left: 5px; } \n " );
document.write("#btn { background-color: #155776; color: #fff; }  \n");
document.write(".hot { font-weight: bold; color: #155776; }  \n");
document.write(".key { font-weight: bold; color: #339900; }  \n");
document.write("</style>  \n");
*/



function principal_calc(){
	
	var principal = document.principal.p.value;
	var interest  = document.principal.i.value;
	var noy 	  = document.principal.noy.value;
	
	if (principal == '') { principal = '0'; }
	if (interest == '')  { interest = '0'; }
	if (noy == '') 		 { noy = '0'; }
	
	if (principal == "0"){ 
		var display = 'Please fill "Loan Amount" field.'; 
		document.getElementById("status").innerHTML = display; 
		}
		
	if (interest == "0"){ 
		var display = 'Please fill "Interest Rate" field.'; 
		document.getElementById("status").innerHTML = display; 
		}
	
	if (noy == "0"){ 
		var display = 'Please fill "Length of Loan" field.'; 
		document.getElementById("status").innerHTML = display; 
		}
		
	if (principal != "0" && interest != "0" && noy != "0" ){ 
		var str = principal 
		var a = (str.replace(/,/, "")) 
		var t_years = eval(noy*12) 
		var t_interest = eval(interest/1200); 
		var t = eval(1.0 /(Math.pow((1+t_interest),t_years))); 
			
			if(t < 1){ 
				var payment = eval((a*t_interest)/(1-t)); 
			} else { 
				var payment = eval(amt/$t_years); 
			} 
			
		var total = payment.toFixed(2); 
		var display ="Your <span  style='font-weight: bold; color: #339900;'>Monthly Payment</span> for <span style='font-weight: bold; color: #155776;'>"+noy+"</span> <span style='font-weight: bold; color: #339900;'>Years</span> at an <span style='font-weight: bold; color: #339900;'>Interest Rate</span> of <span style='font-weight: bold; color: #155776;'>"+interest+"%</span> for a <span style='font-weight: bold; color: #339900;'>Loan Amount</span> of <span style='font-weight: bold; color: #155776;'>$"+principal+"</span> is <span style='font-weight: bold; color: #155776;'>$"+total+"</span> a <span style='font-weight: bold; color: #339900;'>Month</span>.<p>Now that you calculated you car payments. Enter you <strong>Name </strong>and <strong>Email Address</strong> below to start your Car Loan Application.</p><p><form name='email' action='https://48hourcarloans.com/lib/php/process1.php'  method='post' accept-charset='UTF-8'><div id=''><p>Sign up to Start your Application today it is safe, free, and secure!</p><label><strong>Name</strong></label></div><div class=''><input class='type' title='text' name='fname' style='width: 260px;' /></div><label><strong>Email Address</strong></label><div class='sign-up-input'><input class='type'  title='text' name='email'  style='width: 260px;' /></div><input type='hidden' name='seed' value='<?php echo $seed; ?>' /><input type='hidden' name='sjid' value='<?php echo $sjid; ?>'/></div> <div id='submit-application'><input type='submit' value='Start My Application'/></div></form></p>"; 
		
		document.getElementById("status").innerHTML = display; 
	
	}
		
}
document.write("</script>  \n");

 //document.write("</head>");
 //document.write("<body>");

 document.write("<form id=\"principal\" name=\"principal\" method=\"post\" action=\"\"> \n ");
 document.write("<table border=\"0\" cellpadding=\"15\" cellspacing=\"0\" width=\"100%\" style=\" background-color: #ffffff; border-bottom: 1px solid #fff; \"> \n ");
 document.write("<tr> \n ");
 document.write("<td align=\"center\" id=\"header\"><img src=\"http://www.onlineloancalculator.org/images/loan-calculator-mini.gif\" alt=\"Auto Loan Calculator\" width=\"160\" height=\"68\" border=\"0\" /></a></td> \n ");
 document.write("</tr><tr><td align=\"center\" style=\"background-color: #000; border-bottom: 1px solid #fff; font-weight: 600; color: #fff;\">Your Auto Loan Information</td> \n ");
 document.write("</tr><tr> \n ");
 document.write("<td width=\"40%\"><div align=\"center\"><strong>Loan Amount ($)<br /><br /> \n ");
 document.write("</strong> \n ");
 document.write("<input name=\"p\" type=\"text\" id=\"p\" value=\"25,000\" size=\20\" onchange=\"javascript:principal_calc();\" /> \n ");
 document.write("</div></td> \n ");
 document.write("</tr> \n ");
 document.write("<tr> \n ");
 document.write("<td width=\"40%\"><div align=\"center\"><strong>Interest Rate (%)<br /><br /> \n ");
 document.write("</strong> \n ");
 document.write("<input name=\"i\" type=\"text\" id=\"i\" value=\"7.5\" size=\"20\" onchange=\"javascript:principal_calc();\" /> \n ");
 document.write("</div></td> \n ");
 document.write("</tr> \n ");
 document.write("<tr> \n ");
 document.write("<td width=\"40%\"><div align=\"center\"><strong>Length of Loan (Yrs)<br /><br /> \n ");
 document.write("</strong> \n ");
 document.write("<input name=\"noy\" type=\"text\" id=\"noy\" value=\"6\" size=\"3\" maxlength=\"3\" onchange=\"javascript:principal_calc();\" /> \n ");
 document.write("</div></td> \n ");
 document.write("</tr> \n ");
 document.write("<tr> \n ");
 document.write("<td> \n ");
 document.write("<div align=\"center\"> \n ");
 document.write("<input type=\"button\" name=\"button\" id=\"btn\" value=\"Calculate\" onclick=\"javascript:principal_calc();\" /> \n ");
 document.write("</div></td></tr> \n ");
 document.write("<tr> \n ");
 document.write("<td><div id=\"status\"></div></td> \n ");
 document.write("</tr> </table></form> \n ");












