$(function()
{
    $("#search").click(function()
    {
        var searchString = "";
        var splitter = "";
        $(".search").each(function()
        {
            var field = $(this).attr("id");
            var value = $(this).val();
            var elementType = $(this).attr("type").toLowerCase();
            
            if (elementType == "checkbox")
            {
                value = 0;
                if ( $(this).attr("checked"))
                    value = 1;
            }

            searchString += splitter + field + value;
            splitter = "_"
        });
        var mode = $("#m").val();
        
        document.location = "/search/0/" + mode + "/" + searchString;
    });
});
