function redirect(formname, domain) {
	//initialize variables
	var docform = document.getElementById(formname);
	var msg = "";
	
	//fetch variable values from form
	var zip = docform.zipCode.value;
	var sid = docform.sid.value;
	var curl = docform.curl.value;
	var from = docform.from.value;
	var psv = docform.psv.value;
	
	//validate zip code using checkZip() function
	//set alert message if returned false
	if (!checkZip(zip)) {
		msg = "Please enter a valid zipcode. \n";
	}
	
	//pass or fail the form		
	if (msg != "") { //if msg is set then validation has failed. Pop msg and retun false.
		alert(msg);			
		return false;				
	} else { //if msg is blank, then validation has passed. Open LRS window and return true.
		var url = "/auto/quotes";
		if (domain) {
			var url = "https://" + domain;
		}
		docform.action = (url);
		return true;
	}	
		
}

function checkZip(strString) {
	var strValidChars = "0123456789";
	var strChar;
	var blnResult = true;

	if (strString.length < 5) return false;
	for (i = 0; i < strString.length && blnResult == true; i++) {
		strChar = strString.charAt(i);
		if (strValidChars.indexOf(strChar) == -1) {
			blnResult = false;
		}
	}
	return blnResult;
}
