// ##########################################
// ##                                      ##
// ##         Copyright © 2001 by          ##
// ##        Order amid Chaos, Inc.        ##
// ##      http://www.oac-hosting.com      ##
// ##         All Rights Reserved.         ##
// ##                                      ##
// ##########################################

// preload blank.gif
var blank = new Image(); blank.src = "/images/blank.gif";

// variables
var s1 = 1; 	var p1 = 0.99;
var s2 = 1000; 	var p2 = 60.0;

var d = -2;		var b = -0.65;

var a = (p2/s2 - p1/s1) / (Math.pow(s2-d,b) - Math.pow(s1-d,b));
var c = p1/s1 - a * Math.pow(s1-d,b);

// return the price given the space in megs
function calculate_price()
{
	// get input from form
	var megs = document.rates.megs.value;

	// limit accounts to 1 gig
	if (megs > 1000) {megs = 1000;}

	// compute rate
	var rate = a * Math.pow(megs-d, b) + c;

	// compute the price
	var price = rate * megs;

	// round off to two decimal places
	price = Math.round(price*100)/100;
	rate = Math.round(rate*100)/100;

	// output results to the form
	document.rates.megs.value = megs;
	document.rates.price.value = price;
	// document.rates.rate.value = rate;
}