 <!--
/****************************************************
     Author: Eric King
     Url: http://redrival.com/eak/index.shtml
     This script is free to use as long as this info is left in
     Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){
LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
}
if(pos=="center"){
LeftPosition=(screen.width)?(screen.width-w)/2:100;
TopPosition=(screen.height)?(screen.height-h)/2:100;
}
else if((pos!="center" && pos!="random") || pos==null){
LeftPosition=0;
TopPosition=0
}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);
}
// -->
<!--
	function popup(imgname, thewidth, theheight)
	{
		window.open(imgname, 'ImgWin','scrollbars,width='+thewidth+',height='+theheight+'');
	}
//-->
/*
Form field Limiter script- By Dynamic Drive
For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
This credit MUST stay intact for use
*/

var ns6=document.getElementById&&!document.all

function restrictinput(maxlength,e,placeholder){
if (window.event&&event.srcElement.value.length>=maxlength)
return false
else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys
if (pressedkey.test(String.fromCharCode(e.which)))
e.stopPropagation()
}
}

function countlimit(maxlength,e,placeholder){
var theform=eval(placeholder)
var lengthleft=maxlength-theform.value.length
var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
if (window.event||e.target&&e.target==eval(placeholder)){
if (lengthleft<0)
theform.value=theform.value.substring(0,maxlength)
placeholderobj.innerHTML=lengthleft
}
}


function displaylimit(theform,thelimit){
var limit_text='<b><span id="'+theform.toString()+'">'+thelimit+'</span></b> characters remaining.'
if (document.all||ns6)
document.write(limit_text)
if (document.all){
eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
}
else if (ns6){
document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true); 
document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true); 
}
}


	function getAmortization(a,n,p,d) {
		var i=0;
		var sATline="";
		var oAmortizationTable=document.getElementById("amortizationtable");
		oAmortizationTable.style.visibility="visible";
		var sCR=String.fromCharCode(13);
		var sTab=String.fromCharCode(27);

		/* Calculate amortization and write table to text area **/
		var payment = getPayment(a,n,p,d);
		oAmortizationTable.value = sCR + (Math.round(payment*100)/100) + sCR + sCR;
		//oAmortizationTable.value += "Month  Balance    Principal  Interest  Payment    Total Interest" + sCR;
		var balance=a - d;
		var interest = 0.0;
		var principal=0.0;
		var totalinterest=0.0;
		for (i=1;i<=n;i++) {
			interest = balance*p/1200;
			totalinterest += interest;
			principal = payment-interest;
			balance -= principal;
			sATline = i.toString()+getSpaces(7-i.toString().length);
			sATline += Math.round(balance*100)/100;
			sATline += getSpaces(18-sATline.length);
			sATline += (Math.round(principal*100)/100);
			sATline += getSpaces(29-sATline.length);
			sATline += (Math.round(interest*100)/100);
			sATline += getSpaces(39-sATline.length);
			sATline += (Math.round(i*payment*100)/100);
			sATline += getSpaces(50-sATline.length);
			sATline += (Math.round(totalinterest*100)/100) + sCR;
			//oAmortizationTable.value += sATline;
		}
	}

	function getSpaces(n) {
		var i=0; 
		var sSpaces="";
		for (i=0;i<n;i++) {sSpaces += " ";}
		return sSpaces;
	}

	function getPayment(a,n,p,d) {
		/* Calculates the monthly payment from annual percentage
		   rate, term of loan in months and loan amount. **/
		var acc=0;
		var base = 1 + p/1200;
		for (i=1;i<=n;i++) 
			{ acc += Math.pow(base,-i); }
		return (a-d)/acc;
	}
	
// Confirm on delete.
function Confirm(msgtext){
  return confirm(msgtext);
}
// Init focus
function Init(){
	document.forms[0].elements[0].focus();
}