function loadinc(myUrl,myField,options) 
{

num =   Math.ceil(Math.random()*1000000);
strurl = 'showincludes.cfm?include=' + myUrl + '&n=' + num + '&' + options;

var Field = document.getElementById(myField); // selects the given element
	Field.innerHTML = '<h1>Performing action...</h1><br>';
		
	if(window.XMLHttpRequest) {
		xmlhttp = new XMLHttpRequest(); 
	} else if(window.ActiveXObject) {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		return false;
	}	
	
	num =   Math.ceil(Math.random()*1000000);
	xmlhttp.open("GET", strurl,true);

	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState == 4) { 
			Field.innerHTML = xmlhttp.responseText; // puts the result into the element
		}
	
	}
	xmlhttp.send(null); 
}

function popup(url,width,height) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(url, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=' + width + ',height=' + height + ',left = 275,top = 275');");
}

function calculate(frmField) {
    // Get the user's input from the form. Assume it is all valid.
    // Convert interest from a percentage to a decimal, and convert from
    // an annual rate to a monthly rate. Convert payment period in years
    // to the number of monthly payments.
    
  	var principal = document.getElementById(frmField + "_principal").value;
    var interest = document.getElementById(frmField + "_interest").value / 100 / 12;
    var payments = document.getElementById(frmField + "_years").value * 12;

    // Now compute the monthly payment figure, using esoteric math.
    var x = Math.pow(1 + interest, payments);
    var monthly = (principal*x*interest)/(x-1);

    // Check that the result is a finite number. If so, display the results
    if (!isNaN(monthly) && 
        (monthly != Number.POSITIVE_INFINITY) &&
        (monthly != Number.NEGATIVE_INFINITY)) {

        document.getElementById(frmField + "_payment").value = round(monthly);
    }
    // Otherwise, the user's input was probably invalid, so don't
    // display anything.
    else {
        document.getElementById(frmField + "_payment").value = "";
    }
}

// This simple method rounds a number to two decimal places.
function round(x) {
  return Math.round(x*100)/100;
}


