$j(function(){$j("#form_search_refine").submit(cancel_date_overlay);var a=$j("#day_filter_single");if(a.length){a.click(single_day);$j("#day_filter_range").click(day_range);if($j("#day_filter_single:checked").length){single_day()}else{day_range()}}$j("a.friend_add_friend_link").click(add_friend_click)});function show_more(a){$j("#short_description_"+a).hide();$j("#long_description_"+a).show();return false}function show_less(a){$j("#long_description_"+a).hide();$j("#short_description_"+a).show();return false}function show_date_overlay(){$j("#date_overlay").show();return false}function cancel_date_overlay(){hide_date_overlay()}function clear_date_overlay(){$j("#date").val("");$j("#date_overlay input.default_input.radio").attr("checked","checked");$j("#date_from").val("");$j("#date_until").val("")}function cancel_date_filter(){clear_date_overlay();hide_date_overlay();submit_filter_form()}function confirm_date_overlay(){submit_filter_form()}function submit_filter_form(){$j("#form_search_refine").submit()}function hide_date_overlay(){$j("#date_overlay").hide();if(datepopup){datepopup.hideCalendar()}return false}function add_friend_click(f){f.stopPropagation();f.preventDefault();var c=$j(this);var d=c.clone(true);var a=this.href+"&ajx=1";var b=$j("<span />").addClass("ajax_progress").text("Sending Invite...");c.replaceWith(b);$j.get(a,function(e){if(e.indexOf("failed:")==-1){b.removeClass("ajax_progress").addClass("ajax_complete").text("Invite Sent!")}else{b.replaceWith(d);alert(e.replace("failed:",""))}})}function single_day(){if(datepopup){datepopup.hideCalendar()}date_range_disabled(true);single_date_disable(false)}function day_range(){if(datepopup){datepopup.hideCalendar()}single_date_disable(true);date_range_disabled(false)}function single_date_disable(b){var a=$j("#date,#calendar_single_date_popup");if(b){a.attr("disabled","disabled")}else{a.removeAttr("disabled")}a.toggleClass("disabled",b);$j("#date_overlay label.single").toggleClass("disabled",b)}function date_range_disabled(b){var a=$j("#date_from,#date_until,#calendar_from_date_popup_button,#calendar_until_date_popup_button");if(b){a.attr("disabled","disabled")}else{a.removeAttr("disabled")}a.toggleClass("disabled",b);$j("#date_overlay label.range").toggleClass("disabled",b)};