function webRates ()
{

	//----------------------//
	//!    RATE VARIBLES    //
	//----------------------//

	//! TAX RATES
	this.salestax = 8.7;
	this.excisetax = 1.78;
	this.excisetaxaff = 5;
	this.titledate = "Feb 1, 2010";
	this.escrowdate = "Dec 15, 2009";


	//! RATE DEFFINITIONS
	this.Tblank = [0];
	this.Tblank.dept = 'title';
	this.Trange = [50000,100000,150000,200000,250000,300000,350000,400000,450000,500000,550000,600000,650000,700000,750000,800000,850000,900000,950000,1000000,1050000,1100000,1150000,1200000,1250000,1300000,1350000,1400000,1450000,1500000,1550000,1600000,1650000,1700000,1750000,1800000,1850000,1900000,1950000,2000000];
	this.Trange.dept = 'title';
	this.T1 = [400,560,660,760,860,960,1060,1160,1260,1360,1460,1560,1660,1760,1860,1960,2060,2160,2260,2360,2460,2560,2660,2760,2860,2960,3060,3160,3260,3360,3460,3560,3660,3760,3860,3960,4060,4160,4260,4360];
	this.T1.dept = 'title';
	this.T2 = [400,560,660,760,860,960,1060,1160,1260,1360,1460,1560,1660,1760,1860,1960,2060,2160,2260,2360,2460,2560,2660,2760,2860,2960,3060,3160,3260,3360,3460,3560,3660,3760,3860,3960,4060,4160,4260,4360];
	this.T2.dept = 'title';
	this.T3 = [440,615,725,835,945,1055,1165,1275,1385,1495,1605,1715,1825,1935,2045,2155,2265,2375,2485,2595,2705,2815,2925,3035,3145,3255,3365,3475,3585,3695,3805,3915,4025,4135,4245,4355,4465,4575,4685,4795];
	this.T3.dept = 'title';
	this.T4 = [520,725,855,985,1115,1245,1375,1505,1635,1765,1895,2025,2155,2285,2415,2545,2675,2805,2935,3065,3195,3325,3455,3585,3715,3845,3975,4105,4235,4365,4495,4625,4755,4885,5015,5145,5275,5405,5535,5665];
	this.T4.dept = 'title';
	this.T5 = [400,560,660,760,860,960,1060,1160,1260,1360,1460,1560,1660,1760,1860,1960,2060,2160,2260,2360,2460,2560,2660,2760,2860,2960,3060,3160,3260,3360,3460,3560,3660,3760,3860,3960,4060,4160,4260,4360];
	this.T5.dept = 'title';
	this.T6 = [520,725,855,985,1115,1245,1375,1505,1635,1765,1895,2025,2155,2285,2415,2545,2675,2805,2935,3065,3195,3325,3455,3585,3715,3845,3975,4105,4235,4365,4495,4625,4755,4885,5015,5145,5275,5405,5535,5665];
	this.T6.dept = 'title';
	this.T7 = [250,270,320,370,420,470,520,570,620,670,720,770,820,870,920,970,1020,1070,1120,1170,1220,1270,1320,1370,1420,1470,1520,1570,1620,1670,1720,1770,1820,1870,1920,1970,2020,2070,2120,2170];
	this.T7.dept = 'title';
	this.T8 = [75,135,175,200,250];
	this.T8.dept = 'title';
	this.T9 = [250,290,320,350,380,410,440,470,500,530,560,590,620,650,680,710,740,770,800,830,860,890,920,950,980,1010,1040,1070,1100,1130,1160,1190,1220,1250,1280,1310,1340,1370,1400,1430];
	this.T9.dept = 'title';
	this.T10 = [150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150];
	this.T10.dept = 'title';
	this.T11 = [];
	this.T11.dept = 'title';
	this.T12 = [];
	this.T12.dept = 'title';
	this.Esale = [60000,325,100000,350,125000,400,150000,425,175000,450,225000,475,250000,500,275000,525,300000,550,1000000,575];
	this.Esale.dept = 'escrow';
	this.Erefi = [500000,475,1000000,575];
	this.Erefi.dept = 'escrow';

	//! TITLE PRODUCT RATE INFORMATION
	this.product = {};
	this.product.own_std = {'column':this.T2, percent:'100', 'minimum':'0'};
	this.product.own_ext = {'column':this.T4, percent:'100', 'minimum':'0'};
	this.product.own_home = {'column':this.T3, percent:'100', 'minimum':'0'};
	this.product.loan_std = {'column':this.T5, percent:'100', 'minimum':'0'};
	this.product.loan_ext = {'column':this.T6, percent:'100', 'minimum':'0'};
	this.product.loan_exp = {'column':this.T5, percent:'110', 'minimum':'0'};
	this.product.loan_heloc = {'column':this.T8, percent:'100', 'minimum':'0'};
	this.product.loan_refi = {'column':this.T7, percent:'100', 'minimum':'0'};
	this.product.siml_addl = {'column':this.T9, percent:'100', 'minimum':'0'};
	this.product.siml_same = {'column':this.T10, percent:'100', 'minimum':'0'};
	this.product.subdiv_std = {'column':this.T2, percent:'40', 'minimum':'200'};
	this.product.subdiv_ext = {'column':this.T4, percent:'50', 'minimum':'200'};
	this.product.lot_std = {'column':this.T2, percent:'40', 'minimum':'200'};
	this.product.lot_ext = {'column':this.T4, percent:'50', 'minimum':'200'};
	this.product.constr_std = {'column':this.T6, percent:'27', 'minimum':'200'};
	this.product.constr_ext = {'column':this.T6, percent:'27', 'minimum':'200'};
	this.product.newhome_std = {'column':this.T2, percent:'35', 'minimum':'200'};
	this.product.newhome_ext = {'column':this.T4, percent:'50', 'minimum':'200'};
	this.product.newhome_home = {'column':this.T3, percent:'41', 'minimum':'200'};
	this.product.Esale = {'column':this.Esale, percent:100, 'minimum':0};
	this.product.Erefi = {'column':this.Erefi, percent:100, 'minimum':0};
	this.deedFirstPage = 62;
	this.deedAddlPages = 1;
	this.loanFirstPage = 63;
	this.loanAddlPages = 1;

	
	//------------------//
	//!    FUNCTIONS    //
	//------------------//

	this.getRate = function (amount, col, percent, min)
	{
		// allow passing of product object instead of col/percent/min
		if (!(col instanceof Object)) return false;
		if (!(col instanceof Array))
		{	if 
			(	typeof(col.column) !== 'undefined' &&
				typeof(col.percent) !== 'undefined' &&
				typeof(col.minimum) !== 'undefined'
			)
			{	var product = col;
				col = product.column;
				percent = product.percent;
				min = product.minimum;
			}
			else return false;
		}

		// verify proper parameters
		amount = this.getNum(amount);
		if (!(col instanceof Array)) return false;
		percent = this.getNum(percent);
		min = this.getNum(min);
		
		if (col.dept == 'title')
		{
			if (amount > this.Trange[this.Trange.length - 1]) return false;

			var i = 0;
			while (amount > this.Trange[i]) {i++;}
			return Math.max(this.getPercent(col[i], percent), min);
		}
		else if (col.dept == 'escrow')
		{
			if (amount > col[col.length - 2]) return false;

			var i = 0;
			while (amount > col[i]) {i += 2;}
			return Math.max(this.getPercent(col[i+1], percent), min);
		}
		else return false;
	}

	this.getRecFee = function (doctype, pages)
	{
		pages = Math.max(this.getNum(pages), 1); pages--;
		switch (doctype)
		{	case 'loan':
			case 'dt':
			case 'mtg':
				var x = this.loanFirstPage;
				x += this.loanAddlPages * pages;
				return x;

			case 'deed':
			case 'wd':
			case 'title':
				var x = this.deedFirstPage;
				x += this.deedAddlPages * pages;
				return x;
			
			default:
				return 0;
	}	}

	this.getPercent = function (x, percentage)
	{
		if (typeof(x+percentage) !== 'number')
		{	x = this.getNum(x);
			percentage = this.getNum(percentage);
		}

		//n.b. extra steps below added to avoid floating point rounding errors
		return Math.round((x * (percentage * 1000))/1000)/100;
	}

	this.getNum = function (x)
	{	
		if (typeof(x) === 'undefined') x = 0;
		x = String(x);
		x = x.replace(/[^0-9\.-]/g, '');
		x = parseFloat(x);
		if (isNaN(x)) x = 0;
		return x;
	}
	
	
	//  getDollar
	//  For any input 'x', getDollar tries to return a currency value in the form "$1,234.56".
	//  Inputs that cannot be converted to a numeric value will be returned as "$0.00".
	//  Negatives values will place minus sign before the dollar sign (Ex. "-$10.00").
	this.getDollar = function (x)
	{
		x = this.getNum(x);

		var y;
		var z;
		var c;
		var neg = false;
		var stack = new Array();

		if (x < 0) {x = -x; neg = true;}

												// EXAMPLE USE OF FUNCTION
		var y = Math.round(x * 100);			// y = 123456789	(ie 1,234,567.89)
		var z = Math.floor(y / 100);			// z = 1234567		(ie 1,234,567.00)
		var c = (y - (z * 100));				// c = 89			(ie         0.89)

		if (c < 10) c = "0" + c; // 4 => 04

		while (z >= 1000)
		{										// |   *Loop 1*   |  *Loop 2*   |
			y = z / 1000;						// | y = 1234.567 | Y = 1.234   |
			z = Math.floor(y);					// | z = 1234     | z = 1       |
			stack.push(Math.round((y-z)*1000));	// | s = 567      | s = 567:234 |
			// Math.round must be used above to correct errors in float-number computations.
		}

		while (stack.length > 0)
		{										// |      *Loop 1*      |       *Loop 2*       |
			y = stack.pop();					// | y = 234 && s = 567 | y = 567 && s = empty |

			if (y < 10) y = "00" + y; // 1 => 001
			else if (y < 100) y = "0" + y; // 13 => 013

			z += "," + y;						// | z = 1,234          | z = 1,234,567        |
		}

		z = "$" + z + "." + c;					// z = $1,234,567.89
		if (neg) z = "-" + z;

		return z;
	}
}
