$(function() {
    $("#ctl00_fmSearch").autocomplete({
        source: "/expo.ashx",
        minLength: 3,
        select: function(event, ui) {
            $("#ctl00_expoId").val(ui.item.id);
        }
    });
});
$(function() {
    $("#ctl00_fmStartDate").datepicker();
    $("#ctl00_fmStopDate").datepicker();

});

$(function() {
    $.datepicker.setDefaults(
	        $.extend($.datepicker.regional["ru"])
	  );


    var d = new Date;

    d.setDate(d.getDate() + 3);
    $("#ctl00_fmStartDate").datepicker("option", "minDate", '0');
    $("#ctl00_fmStartDate").datepicker("option", "maxDate", '+1y');
    $("#ctl00_fmStartDate").datepicker("option", "defaultDate", '+3d');
    $("#ctl00_fmStartDate").datepicker("option", "firstDay", 1);
    //$("#ctl00_fmStartDate").val($.datepicker.formatDate("dd.mm.yy", d));
    

    d.setDate(d.getDate() + 7);
    $("#ctl00_fmStopDate").datepicker("option", "minDate", '0');
    $("#ctl00_fmStopDate").datepicker("option", "maxDate", '+1y');
    $("#ctl00_fmStopDate").datepicker("option", "defaultDate", '+10d');
    $("#ctl00_fmStopDate").datepicker("option", "firstDay", 1);
    //$("#ctl00_fmStopDate").val($.datepicker.formatDate("dd.mm.yy", d));
});

$(function() {

    if ($('#ctl00_state').val() != 1) {
        $('.toggle').hide();
        $('.state').val('0');
    }

    $('a#toggleLink').click(function() {


        if (this.className == 'plus') {
            $(this).removeClass('plus').addClass('minus');
        } else {
            $(this).removeClass('minus').addClass('plus');
        }

        if ($('#ctl00_state').val() == 0) {
            $('#ctl00_state').val('1');
        } else {
            $('#ctl00_state').val('0');
        }


        $('.toggle').toggle('slow');


        return false;
    });


});

