function submit_filter () {
	$('#txtSearch').val($('select[name=me] option:selected').val()+' '+$('select[name=ka] option:selected').val()+' '+$('select[name=iz] option:selected').val()+' '+$('select[name=ra] option:selected').val()+' ');
	$('#txtSearch').parent('form').submit();
}

$(document).ready( function() {
	if ($('#txtSearch').val()) {
		words = $('#txtSearch').val().split(' ');

		for (var key in words) {
			var word = TrimStr(words [key]);
			if (word=='') continue;
//			alert (key+' = '+word);
			
			$("select option[value='"+word+"']").attr("selected", true);
			
			
		}
		
	}
});

function TrimStr(s) {
  s = s.replace( /^\s+/g, '');
  return s.replace( /\s+$/g, '');
}
