var url ="";
var what = "";
function GetSubcat2(cat_id,PageUrl,type,formName,ctrlName) {
	if (type == 'category') {
		if(document[formName][ctrlName].value!="Select Category") {
			url=PageUrl;
			what = "SetSubcat2(req.responseText,'"+formName+"')";
			DoCallback("cat_id="+cat_id+"&type="+type);
		}
	}
}
function SetSubcat2(States,formName) {
	if (formName == "frmVend") {
		var stateBox = document.getElementById("cboSubCategory2");
	} else if (formName == "frm") {
		var stateBox = document.getElementById("cboSubCategoryA");
	} else {
		var stateBox = document.getElementById("cboSubCategory4");
	}

	stateBox.options.length = 0;
	stateBox.options[stateBox.options.length] = new Option('Select','0')
	if(States != "") {
		var arrStates = States.split(",");
		for(i = 0; i < arrStates.length; i++) {
			if(arrStates[i] != "") {
				var arrStatesnew = arrStates[i].split(":");
				if(arrStatesnew[0] != "") {
					stateBox.options[stateBox.options.length] = new Option(arrStatesnew[1], arrStatesnew[0]);
				}
			}
		}
	}
}
function doVendorSearch(formName) {
	if (formName == "frmVend") {
		var catField = "cboCategory2";
		var zipField = "txtZip";
	} else if (formName == "frm") {
		var catField = "cboCategoryA";
		var zipField = "txtZipA";
	} else {
		var catField = "cboCategory4";
		var zipField = "txtZip2";
	}
	
	if(document[formName][catField].value == "0") {
		alert("Please Select Category.");
		document[formName][catField].focus();
		return false;
	} else if(document[formName][zipField].value == "") {
		alert("Please enter Zip Code");
		document[formName][zipField].focus();
		return false;
	} else {
		return true;
	}	
	
// 	if(document[formName][catField].value == "0") {
// 		document[formName].action = '/vendor_listing.php';
// 		return true;
// 	} else if(document[formName][zipField].value == "") {
// 		document[formName].action = '/vendor_listing.php';
// 		return true;
// 	} else {
// 		return true;
// 	}
}

