$(document).ready(function () {

    if ($("#txtKeyWords").val() == "") {
        $("#txtKeyWords").val(watermark);
    }

    $("#txtKeyWords").focus(function () {
        if (this.value == watermark) {
            this.value = "";
        }
    }).blur(function () {
        if (this.value == "") {
            this.value = watermark;
        }
    });

    $("#ddlSector").change(function () {
        $("#ddlFunction").html('<option value="-1">All Functions</option>');
        var id = $("#ddlSector option:selected").val();
        if (id > 0) {
            $.ajax({
                type: "POST",
                data: '{"id": ' + id + '}',
                contentType: "application/json; charset=utf-8",
                url: urlJobSearch + "ipsgroupservice.svc/GetHtmlFunctionsByIndustryID",
                dataType: "json",
                success: function (data) {
                    $("#ddlFunction").append(
                            data.d
                        );
                },
                error: function (xhr, ajaxOptions, thrownError) {
                    alert(xhr.status);
                    alert(thrownError);
                }
            });
        }
    });
});
