﻿/// <reference path="../jquery-1.4.2-vsdoc.js" />


(function($) {
    Sys.Application.add_load(function() {
        // client side validation to prevent partial postback from firing and losing state of expanded advanced search options
        jQuery("input[name*='btnSearch'], input[name*='Button2'][value*='Search']").click(function() {
            if ((jQuery("input[name*='txtInstitutionId']").val() == 0 || jQuery("input[name*='txtTypeAhead']").val() == "") &&
            jQuery("select[name*='ddlbTargetInstitution']").val() == 0) {
                jQuery("#validationError").show();
                jQuery.Watermark.ShowAll();
                return false;
            }
        });

        function onHideDetails() {
            jQuery(".detailsToggler-closed").text("Show advanced search options");
        }

        function onShowDetails() {
            jQuery(".detailsToggler-opened").text("Hide advanced search options");
        }
        jQuery("#equivSearchRefinements").show(); // clear display: none from style -- prevents popin and preserves watermark
        jQuery('#advancedSearchLink').toggleElements({
            fxAnimation: 'slide', fxSpeed: 'fast', className: 'detailsToggler', showTitle: true,
            onHide: onHideDetails, onShow: onShowDetails
        });


    });
})(jQuery);

if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
