function clearError(field) {
	if (field == "mt_label") {
		//document.getElementById('mt_label').style.padding = "0";
		document.getElementById('mt_label').style.backgroundColor = "#dddddd";
	} else {
		field.style.backgroundColor = "#ffffff";
	}
}

//

var rra_fields = new Array("b_name","b_email","b_phone","b_fax","l_amount","l_value","l_debt","l_city","l_types","l_description");

function formCheck(theForm) {
	var isValid = true;
	
	if ( !(document.gs_contact.l_types[0].checked) && !(document.gs_contact.l_types[1].checked) ) {
		document.getElementById('mt_label').style.backgroundColor = "#e5b635";
		document.getElementById('mt_label').style.padding = "4px";
		document.getElementById('errors').innerHTML = "Sorry... please choose a Mortgage Type!";
		document.getElementById('errors').style.display = "block";
		window.location = "#left";
		isValid = false;
	}
	
	for (var i=0; i<rra_fields.length; i++) {
		if ((i!=3) && (i!=8) && (i!=9)) {
			if (document.getElementById(rra_fields[i]).value == '') {
				document.getElementById(rra_fields[i]).style.backgroundColor = "#e5b635";
				document.getElementById('errors').innerHTML = "Sorry... please fill in all required fields!";
				document.getElementById('errors').style.display = "block";
				window.location = "#left";
				isValid = false;
			}
		}
	}
	
	if (document.getElementById(rra_fields[1]).value != '') {
		var str = document.getElementById(rra_fields[1]).value;
		var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
		if (!filter.test(str)) {
			document.getElementById('errors').innerHTML = "Sorry... please use a valid email address!";
			document.getElementById('errors').style.display = "block";
			isValid = false;
		}
	}
	
	if (isValid) {
		theForm.submit();
	}
}

//

function submitForm() {
	// document.gs_contact.b_state.options[document.gs_contact.b_state.selectedIndex].value);
	// document.gs_contact.l_state.options[document.gs_contact.l_state.selectedIndex].value);
}
