function updateSub() {      

	if(document.getElementById('sub_field').value != "stop") {
		var city = "";
		var val = "";
		var sub = "";

		var formblock;
    	var forminputs;
    
		formblock= document.getElementById('searchForm');
    	forminputs = formblock.getElementsByTagName('input');
    	
		for (i = 0; i < forminputs.length; i++) {
			// regex here to check name attribute
			var regex = new RegExp("search_city", "i");
			if (regex.test(forminputs[i].getAttribute('name'))) {
				if (forminputs[i].checked == true) {
					city+="&search_city%5B%5D="+forminputs[i].value;
				}
			}
			var regex2 = new RegExp("idx", "i");
			if (regex2.test(forminputs[i].getAttribute('name'))) {
				if (forminputs[i].checked == true) {
					val+=forminputs[i].value;
				}
			}
			var regex3 = new RegExp("search_subdivision", "i");
			if (regex3.test(forminputs[i].getAttribute('name'))) {
				if (forminputs[i].checked == true) {
					sub+="&subdivision%5B%5D="+forminputs[i].value;
				}
			}
			var regex4 = new RegExp("hide_sub", "i");
			if (regex4.test(forminputs[i].getAttribute('name'))) {
				sub+="&subdivision%5B%5D="+forminputs[i].value;
			}
		}
		
		city = city.replace(/ /g,"+");
		sub = sub.replace(/ /g,"+");
		val = val.replace(/ /g,"+");
	 
//	    alert('/idx/sub_updator.php?type=' + val + sub);
	    
		if(document.getElementById('sub_field').value == "false") {
			$('#sub-list').load('/idx/updator.php?type=' + val + city + sub);
		} else {
			$('#subdivision-list').load('/idx/sub_updator.php?type=' + val + sub);
		}

	}
}