function catalogReqCheck() {
	// Validate and submit the page.
	
	var frm = document.forms[0];
	var el;
	var str = "";
	var delim = "";
	
	// Get the form data to send to the validation routine on the server.
	for (var i = 0; i < frm.elements.length; i++) {
		el = frm.elements[i];
		if (el.type.search("select") > -1) {
			str += delim + el.name + "|" + el.options[el.selectedIndex].value;
			delim = "|";
		}else if (el.type == "button" || el.type == "submit" || el.type == "reset"){
			// Don't pass buttons
		}else if (el.type == "radio" || el.type == "checkbox"){
			if (el.checked){
				str += delim + el.name + "|" + el.value;
				delim = "|";
			}				
		}else{
			str += delim + el.name + "|" + el.value;
			delim = "|";
		}
	}
	
	//alert(str);
	var re = /\r/g;
	str = str.replace(re, '<13>');
	var re = /"/g;
	str = str.replace(re, '<34>');
	re = /\n/g;
	str = str.replace(re, '');
	
	RSExecute("catalogreq_rs.asp","RS_PostCatalogReq", str);
}

function rtn_RS_PostCatalogReq(){
	var msg = return_value;
	return_value = "";
	
	var dform = document.forms[0];
	
	if (msg.substring(0, 5) == "CSZ:|") {
		// Server couldn't find the entered US CSZ on file, but found an alternate.
		var raCSZ = msg.split("|");
		var sErrMsg = "The City, State and Zip Code combination you entered was not found, "
		sErrMsg += "but " + raCSZ[1] + ", " + raCSZ[2] + "  " + raCSZ[3] + " was found.\n\n"
		sErrMsg += "Click OK to switch to " + raCSZ[1] + ", " + raCSZ[2] + "  " + raCSZ[3]
		sErrMsg += ", or click Cancel to manually correct the address."
		if (confirm(sErrMsg)){
			dform.City.value = raCSZ[1];
			dform.zip.value = raCSZ[3];
			
			for (i = 0;i < dform.State.options.length;i++){
				if (dform.State.options[i].value == raCSZ[2]){
					dform.State.options.selectedIndex = i;
				}
			}
			catalogReqCheck();
		}
	}else{
		if (msg == "OK") {
			submitInfo();
		}else{
			alert(msg);
		}
	}
}

function submitInfo(){
	EnableUI();
	document.form1.submit();
}

