// JavaScript Document


function stripCommas(numString) {
    var re = /,/g;
    return numString.replace(re,"");
}

function calc(from)
{
	s = 0;
	f = document.quote;
	v = stripCommas(f.home_value.value);
	if (from=='savings')
			{
				s = (v * ((f.commission.value/100)) - ((v * (3.9/100))));
				if (s.toFixed) //if browser supports toFixed() method
				f.savings.value = s.toFixed(2);
			}
}

function calccashback(from)
{
	s = 0;
	f = document.cashback;
	v = stripCommas(f.home_value.value);
	if (from=='savings')
	{
		if (v <= 300000)
		{
			{
				s = (v * 0.03 * .15);
				if (s.toFixed) //if browser supports toFixed() method
					f.savings.value = s.toFixed(2);
			}
		}
		if ((v > 300000) && (v <= 600000))
		{
			{
				s = (v * 0.03 * .25);
				if (s.toFixed) //if browser supports toFixed() method
					f.savings.value = s.toFixed(2);
			}
		}
		if (v > 600000)
		{
			{
				s = (v * 0.03 * .33);
				if (s.toFixed) //if browser supports toFixed() method
					f.savings.value = s.toFixed(2);
			}
		}
	}
}

function submitForm() {
	form = document.getElementById('featured_search');
	url = form.search_url.options[form.search_url.selectedIndex].value;
	form.action = "/plans.php" + url;
	form.submit();
}

function submitFormonClick2(url) {
	form = document.getElementById('featured_search');
	form.action = "/plans.php" + url;
	form.submit();
}

function submitFormonClick(id) {
	form = document.getElementById(id);
	form.submit();
}

function submitFormNext(url) {
	form = document.getElementById('nav');
	form.action = url;
	form.submit();
}