// JavaScript Document
function sendform() {
	var ans = false;
	var type = 0;
	if (document.getElementById('behind').value == 0) {
		if (document.getElementById('creditrating').selectedIndex == 1 || document.getElementById('creditrating').selectedIndex == 2) {
			if (document.getElementById('owed').value / document.getElementById('homevalue').value < 1.05) {
				ans = confirm('Based on your information, we can match you with Mortgage companies that help you Refinance your existing mortgage.  Click OK to be matched with mortgage companies.');
				if (ans)
					type = 1;
			}
		}		
	}
	document.getElementById('changetype').value = type;
}
function open_zipcode() {
	if (document.getElementById('behind').selectedIndex == 5 || document.getElementById('owed').selectedIndex == 1) {
		document.getElementById('creditrow').style.display = '';
	}
}
function show_surehits() {
	mywindow = window.open('refinance.php?zip=' + document.getElementById('zip').value + '&mediatag=' + document.getElementById('mediatag').value,'refinance_opt','width=1024,height=768');	
	mywindow.blur();
	window.focus();
}
function check_zip() {
	var zip = document.getElementById('zip').value;
	var error_msg = '';
	var error = 0;
	if (zip == "") {
		error++;
		error_msg += 'Please enter a zip code\n';
	}
	else if (zip.length < 5) {
		error++;
		error_msg += 'Please enter a valid zip code\n';
	}
	if (error > 0) {
		
		alert(error_msg);
		
		return false;
	}
	else
		return true;
}
var canpop = true;
function gonext() {
	canpop = false;
	var chk = check_zip();
	if (!chk)
		return false;
	else {
		window.location.href = 'refinance.php?zip=' + document.getElementById('zip').value;
		return true;
	}
}
