adopt-a-hydrant/public/assets/application-79937e309a481d5...

19 lines
23 KiB
JavaScript

/* ==========================================================
* bootstrap-alerts.js v1.4.0
* http://twitter.github.com/bootstrap/javascript.html#alerts
* ==========================================================
* Copyright 2011 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================== */
!function(a){"use strict";var b;a(document).ready(function(){a.support.transition=function(){var a=document.body||document.documentElement,b=a.style,c=b.transition!==undefined||b.WebkitTransition!==undefined||b.MozTransition!==undefined||b.MsTransition!==undefined||b.OTransition!==undefined;return c}(),a.support.transition&&(b="TransitionEnd",a.browser.webkit?b="webkitTransitionEnd":a.browser.mozilla?b="transitionend":a.browser.opera&&(b="oTransitionEnd"))});var c=function(b,c){this.settings=a.extend({},a.fn.alert.defaults,c),this.$element=a(b).delegate(this.settings.selector,"click",this.close)};c.prototype={close:function(c){function e(){d.remove()}var d=a(this).parent(".alert-message");c&&c.preventDefault(),d.removeClass("in"),a.support.transition&&d.hasClass("fade")?d.bind(b,e):e()}},a.fn.alert=function(b){return b===!0?this.data("alert"):this.each(function(){var d=a(this);if(typeof b=="string")return d.data("alert")[b]();a(this).data("alert",new c(this,b))})},a.fn.alert.defaults={selector:".close"},a(document).ready(function(){new c(a("body"),{selector:".alert-message[data-alert] .close"})})}(window.jQuery||window.ender),!function(a){function d(){var a=this,c=setTimeout(function(){a.$element.unbind(b),e.call(a)},500);this.$element.one(b,function(){clearTimeout(c),e.call(a)})}function e(a){this.$element.hide().trigger("hidden"),f.call(this)}function f(c){var d=this,e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.settings.backdrop){var f=a.support.transition&&e;this.$backdrop=a('<div class="modal-backdrop '+e+'" />').appendTo(document.body),this.settings.backdrop!="static"&&this.$backdrop.click(a.proxy(this.hide,this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),f?this.$backdrop.one(b,c):c()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(b,a.proxy(g,this)):g.call(this)):c&&c()}function g(){this.$backdrop.remove(),this.$backdrop=null}function h(){var b=this;this.isShown&&this.settings.keyboard?a(document).bind("keyup.modal",function(a){a.which==27&&b.hide()}):this.isShown||a(document).unbind("keyup.modal")}"use strict";var b;a(document).ready(function(){a.support.transition=function(){var a=document.body||document.documentElement,b=a.style,c=b.transition!==undefined||b.WebkitTransition!==undefined||b.MozTransition!==undefined||b.MsTransition!==undefined||b.OTransition!==undefined;return c}(),a.support.transition&&(b="TransitionEnd",a.browser.webkit?b="webkitTransitionEnd":a.browser.mozilla?b="transitionend":a.browser.opera&&(b="oTransitionEnd"))});var c=function(b,c){return this.settings=a.extend({},a.fn.modal.defaults,c),this.$element=a(b).delegate(".close","click.modal",a.proxy(this.hide,this)),this.settings.show&&this.show(),this};c.prototype={toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var c=this;return this.isShown=!0,this.$element.trigger("show"),h.call(this),f.call(this,function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.appendTo(document.body).show(),d&&c.$element[0].offsetWidth,c.$element.addClass("in"),d?c.$element.one(b,function(){c.$element.trigger("shown")}):c.$element.trigger("shown")}),this},hide:function(b){b&&b.preventDefault();if(!this.isShown)return this;var c=this;return this.isShown=!1,h.call(this),this.$element.trigger("hide").removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?d.call(this):e.call(this),this}},a.fn.modal=function(b){var d=this.data("modal");return d?b===!0?d:(typeof b=="string"?d[b]():d&&d.toggle(),this):(typeof b=="string"&&(b={show:/show|toggle/.test(b)}),this.each(function(){a(this).data("modal",new c(this,b))}))},a.fn.modal.Modal=c,a.fn.modal.defaults={backdrop:!1,keyboard:!1,show:!1},a(document).ready(function(){a("body").delegate("[data-controls-modal]","click",function(b){b.preventDefault();var c=a(this).data("show",!0);a("#"+c.attr("data-controls-modal")).modal(c.data())})})}(window.jQuery||window.ender),!function(a){function d(a,b,c){return typeof a=="function"?a.apply(b,c):a}"use strict";var b;a(document).ready(function(){a.support.transition=function(){var a=document.body||document.documentElement,b=a.style,c=b.transition!==undefined||b.WebkitTransition!==undefined||b.MozTransition!==undefined||b.MsTransition!==undefined||b.OTransition!==undefined;return c}(),a.support.transition&&(b="TransitionEnd",a.browser.webkit?b="webkitTransitionEnd":a.browser.mozilla?b="transitionend":a.browser.opera&&(b="oTransitionEnd"))});var c=function(b,c){this.$element=a(b),this.options=c,this.enabled=!0,this.fixTitle()};c.prototype={show:function(){var b,c,e,f,g,h;if(this.hasContent()&&this.enabled){g=this.tip(),this.setContent(),this.options.animate&&g.addClass("fade"),g.remove().css({top:0,left:0,display:"block"}).prependTo(document.body),b=a.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight}),c=g[0].offsetWidth,e=g[0].offsetHeight,f=d(this.options.placement,this,[g[0],this.$element[0]]);switch(f){case"below":h={top:b.top+b.height+this.options.offset,left:b.left+b.width/2-c/2};break;case"above":h={top:b.top-e-this.options.offset,left:b.left+b.width/2-c/2};break;case"left":h={top:b.top+b.height/2-e/2,left:b.left-c-this.options.offset};break;case"right":h={top:b.top+b.height/2-e/2,left:b.left+b.width+this.options.offset}}g.css(h).addClass(f).addClass("in")}},setContent:function(){var a=this.tip();a.find(".twipsy-inner")[this.options.html?"html":"text"](this.getTitle()),a[0].className="twipsy"},hide:function(){function e(){d.remove()}var c=this,d=this.tip();d.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d.bind(b,e):e()},fixTitle:function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getTitle:function(){var a,b=this.$element,c=this.options;return this.fixTitle(),typeof c.title=="string"?a=b.attr(c.title=="title"?"data-original-title":c.title):typeof c.title=="function"&&(a=c.title.call(b[0])),a=(""+a).replace(/(^\s*|\s*$)/,""),a||c.fallback},tip:function(){return this.$tip=this.$tip||a('<div class="twipsy" />').html(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(){this[this.tip().hasClass("in")?"hide":"show"]()}},a.fn.twipsy=function(b){return a.fn.twipsy.initWith.call(this,b,c,"twipsy"),this},a.fn.twipsy.initWith=function(b,c,d){function i(e){var f=a.data(e,d);return f||(f=new c(e,a.fn.twipsy.elementOptions(e,b)),a.data(e,d,f)),f}function j(){var a=i(this);a.hoverState="in",b.delayIn==0?a.show():(a.fixTitle(),setTimeout(function(){a.hoverState=="in"&&a.show()},b.delayIn))}function k(){var a=i(this);a.hoverState="out",b.delayOut==0?a.hide():setTimeout(function(){a.hoverState=="out"&&a.hide()},b.delayOut)}var e,f,g,h;return b===!0?this.data(d):typeof b=="string"?(e=this.data(d),e&&e[b](),this):(b=a.extend({},a.fn[d].defaults,b),b.live||this.each(function(){i(this)}),b.trigger!="manual"&&(f=b.live?"live":"bind",g=b.trigger=="hover"?"mouseenter":"focus",h=b.trigger=="hover"?"mouseleave":"blur",this[f](g,j)[f](h,k)),this)},a.fn.twipsy.Twipsy=c,a.fn.twipsy.defaults={animate:!0,delayIn:0,delayOut:0,fallback:"",placement:"above",html:!1,live:!1,offset:0,title:"title",trigger:"hover",template:'<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>'},a.fn.twipsy.rejectAttrOptions=["title"],a.fn.twipsy.elementOptions=function(b,c){var d=a(b).data(),e=a.fn.twipsy.rejectAttrOptions,f=e.length;while(f--)delete d[e[f]];return a.extend({},c,d)}}(window.jQuery||window.ender),$(function(){function j(a,b,c){var j=new google.maps.MarkerImage(c,new google.maps.Size(27,37),new google.maps.Point(0,0),new google.maps.Point(13,18)),k=new google.maps.MarkerImage("/assets/markers/shadow-8e05a2a893ca0812e770d88aed15e961.png",new google.maps.Size(46,37),new google.maps.Point(0,0),new google.maps.Point(13,18)),l=new google.maps.Marker({animation:google.maps.Animation.DROP,icon:j,map:d,position:b,shadow:k});google.maps.event.addListener(l,"click",function(){g&&g.close();var b=new google.maps.InfoWindow({maxWidth:230});google.maps.event.addListener(b,"closeclick",function(){h=!1}),g=b,e=a,f=l,$.ajax({type:"GET",url:"/info_window",data:{thing_id:a},success:function(a){b==g&&(b.setContent(a),b.open(d,l),h=!0)}})}),i.push(a)}function k(b,c){$.ajax({type:"GET",url:"/things.json",data:{utf8:"✓",authenticity_token:$('#address_form input[name="authenticity_token"]').val(),lat:b,lng:c,limit:$('#address_form input[name="limit"]').val()},success:function(e){if(e.errors)$("#address_label").addClass("error",500),$("#address").addClass("error",500),$("#address").focus();else{$("#address_label").removeClass("error",500),$("#address").removeClass("error",500);var f=-1;$(e).each(function(a,b){if($.inArray(b.id,i)==-1)f+=1;else return!0;setTimeout(function(){point=new google.maps.LatLng(b.lat,b.lng),b.user_id?image_path="/assets/markers/green-5583a65ce5266b274e9389fce98ea41a.png":image_path="/assets/markers/red-8f727186ba094dfb33c72aadd204cd5d.png",j(b.id,point,image_path)},f*100)}),a=new google.maps.LatLng(b,c),d.setCenter(a),d.setZoom(18)}}})}function l(){$('#combo-form input[type="text"]:visible, #combo-form input[type="password"]:visible, #combo-form input[type="submit"]:visible, #combo-form button:visible').each(function(a){if($(this).val()===""||$(this).attr("type")==="submit"||this.tagName.toLowerCase()==="button")return $(this).focus(),!1})}var a=new google.maps.LatLng(42.358431,-71.059773),b=15,c={center:a,mapTypeControl:!1,zoomControl:!1,mapTypeId:google.maps.MapTypeId.ROADMAP,panControl:!1,scrollwheel:!1,zoom:b},d=new google.maps.Map(document.getElementById("map"),c),e,f,g,h=!1,i=[];google.maps.event.addListener(d,"dragend",function(){if(h==1)return;a=d.getCenter(),k(a.lat(),a.lng())}),$("#address_form").live("submit",function(){var a=$("#address_form input[type='submit']");$(a).attr("disabled",!0);var b=$(a).attr("value");return $(a).attr("value","Please Wait..."),$("#address").val()===""?($(a).attr("disabled",!1),$(a).attr("value",b),$("#address_label").addClass("error",500),$("#address").addClass("error",500),$("#address").focus()):$.ajax({type:"GET",url:"/address.json",data:{utf8:"✓",authenticity_token:$('#address_form input[name="authenticity_token"]').val(),city_state:$("#city_state").val(),address:$("#address").val()},success:function(c){$(a).attr("disabled",!1),$(a).attr("value",b),c.errors?($("#address_label").addClass("error",500),$("#address").addClass("error",500),$("#address").focus()):k(c[0],c[1])}}),!1}),$('#combo-form input[type="radio"]').live("click",function(){var a=$(this);"new"==a.val()?($("#combo-form").data("state","user_sign_up"),$("#user_forgot_password_fields").slideUp(),$("#user_sign_in_fields").slideUp(),$("#user_sign_up_fields").slideDown(function(){l()})):"existing"==a.val()&&($("#user_sign_up_fields").slideUp(),$("#user_sign_in_fields").slideDown(function(){$("#combo-form").data("state","user_sign_in"),l(),$("#user_forgot_password_link").click(function(){$("#combo-form").data("state","user_forgot_password"),$("#user_sign_in_fields").slideUp(),$("#user_forgot_password_fields").slideDown(function(){l(),$("#user_remembered_password_link").click(function(){$("#combo-form").data("state","user_sign_in"),$("#user_forgot_password_fields").slideUp(),$("#user_sign_in_fields").slideDown(function(){l()})})})})}))}),$("#combo-form").live("submit",function(){var a=$("#combo-form input[type='submit']");$(a).attr("disabled",!0);var b=[];return/[\w\.%\+\]+@[\w\]+\.+[\w]{2,}/.test($("#user_email").val())?($("#user_email_label").removeClass("error"),$("#user_email").removeClass("error")):(b.push($("#user_email")),$("#user_email_label").addClass("error",500),$("#user_email").addClass("error",500)),!$(this).data("state")||$(this).data("state")==="user_sign_up"?($("#user_name").val()===""?(b.push($("#user_name")),$("#user_name_label").addClass("error",500),$("#user_name").addClass("error",500)):($("#user_name_label").removeClass("error"),$("#user_name").removeClass("error")),$("#user_password_confirmation").val().length<6||$("#user_password_confirmation").val().length>20?(b.push($("#user_password_confirmation")),$("#user_password_confirmation_label").addClass("error",500),$("#user_password_confirmation").addClass("error",500)):($("#user_password_confirmation_label").removeClass("error"),$("#user_password_confirmation").removeClass("error")),b.length>0?($(a).attr("disabled",!1),b[0].focus()):$.ajax({type:"POST",url:"/users.json",data:{utf8:"✓",authenticity_token:$('#combo-form input[name="authenticity_token"]').val(),user:{email:$("#user_email").val(),name:$("#user_name").val(),organization:$("#user_organization").val(),voice_number:$("#user_voice_number").val(),sms_number:$("#user_sms_number").val(),password:$("#user_password_confirmation").val(),password_confirmation:$("#user_password_confirmation").val()}},error:function(c){data=$.parseJSON(c.responseText),$(a).attr("disabled",!1),data.errors.email&&(b.push($("#user_email")),$("#user_email_label").addClass("error",500),$("#user_email").addClass("error",500)),data.errors.name&&(b.push($("#user_name")),$("#user_name_label").addClass("error",500),$("#user_name").addClass("error",500)),data.errors.organization&&(b.push($("#user_organization")),$("#user_organization_label").addClass("error",500),$("#user_organization").addClass("error",500)),data.errors.voice_number&&(b.push($("#user_voice_number")),$("#user_voice_number_label").addClass("error",500),$("#user_voice_number").addClass("error",500)),data.errors.sms_number&&(b.push($("#user_sms_number")),$("#user_sms_number_label").addClass("error",500),$("#user_sms_number").addClass("error",500)),data.errors.password&&(b.push($("#user_password_confirmation")),$("#user_password_confirmation_label").addClass("error",500),$("#user_password_confirmation").addClass("error",500)),b[0].focus()},success:function(a){$.ajax({type:"GET",url:"/sidebar/search",data:{flash:{notice:"Thanks for signing up!"}},success:function(a){$("#content").html(a)}})}})):$(this).data("state")==="user_sign_in"?($("#user_password").val().length<6||$("#user_password").val().length>20?(b.push($("#user_password")),$("#user_password_label").addClass("error",500),$("#user_password").addClass("error",500)):($("#user_password_label").removeClass("error"),$("#user_password").removeClass("error")),b.length>0?($(a).attr("disabled",!1),b[0].focus()):$.ajax({type:"POST",url:"/users/sign_in.json",data:{utf8:"✓",authenticity_token:$('#combo-form input[name="authenticity_token"]').val(),user:{email:$("#user_email").val(),password:$("#user_password").val(),remember_me:$("#user_remember_me").val()}},error:function(b){$(a).attr("disabled",!1),$("#user_password_label").addClass("error",500),$("#user_password").addClass("error",500),$("#user_password").focus()},success:function(a){$.ajax({type:"GET",url:"/sidebar/search",data:{flash:{notice:"Signed in!"}},success:function(a){$("#content").html(a)}})}})):$(this).data("state")==="user_forgot_password"&&(b.length>0?($(a).attr("disabled",!1),b[0].focus()):$.ajax({type:"POST",url:"/users/password.json",data:{utf8:"✓",authenticity_token:$('#combo-form input[name="authenticity_token"]').val(),user:{email:$("#user_email").val()}},error:function(b){$(a).attr("disabled",!1),$("#user_email_label").addClass("error",500),$("#user_email").addClass("error",500),$("#user_email").focus()},success:function(){$(a).attr("disabled",!1),$("#user_remembered_password_link").click(),$("#user_password").focus()}})),!1}),$("#adoption_form").live("submit",function(){var a=$("#adoption_form input[type='submit']");return $(a).attr("disabled",!0),$.ajax({type:"POST",url:"/things.json",data:{id:$("#thing_id").val(),utf8:"✓",authenticity_token:$('#adoption_form input[name="authenticity_token"]').val(),_method:"put",thing:{user_id:$("#thing_user_id").val(),name:$("#thing_name").val()}},beforeSend:function(){$("#info_window").hide(),$("#loader").show()},error:function(b){$("#loader").hide(),$("#info_window").show(),$(a).attr("disabled",!1)},success:function(a){$.ajax({type:"GET",url:"/info_window",data:{thing_id:e,flash:{notice:"You just adopted a hydrant!"}},success:function(a){g.setContent(a),image=new google.maps.MarkerImage("/assets/markers/green-5583a65ce5266b274e9389fce98ea41a.png",new google.maps.Size(27,37),new google.maps.Point(0,0),new google.maps.Point(13,18)),f.setIcon(image),f.setAnimation(google.maps.Animation.BOUNCE)}})}}),!1}),$("#abandon_form").live("submit",function(){var a=window.confirm("Are you sure you want to abandon this hydrant?");if(a){var b=$("#abandon_form input[type='submit']");$(b).attr("disabled",!0),$.ajax({type:"POST",url:"/things.json",data:{id:$("#thing_id").val(),utf8:"✓",authenticity_token:$('#abandon_form input[name="authenticity_token"]').val(),_method:"put",thing:{user_id:$("#thing_user_id").val(),name:$("#thing_name").val()}},beforeSend:function(){$("#info_window").hide(),$("#loader").show()},error:function(a){$("#loader").hide(),$("#info_window").show(),$(b).attr("disabled",!1)},success:function(a){$.ajax({type:"GET",url:"/info_window",data:{thing_id:e,flash:{warning:"Hydrant abandoned!"}},success:function(a){g.setContent(a),image=new google.maps.MarkerImage("/assets/markers/red-8f727186ba094dfb33c72aadd204cd5d.png",new google.maps.Size(27,37),new google.maps.Point(0,0),new google.maps.Point(13,18)),f.setIcon(image),f.setAnimation(null)}})}})}return!1}),$("#edit_profile_form").live("submit",function(){var a=$("#edit_profile_form input[type='submit']");return $(a).attr("disabled",!0),$.ajax({type:"GET",url:"/users/edit",data:{utf8:"✓",authenticity_token:$('#edit_profile_form input[name="authenticity_token"]').val()},error:function(b){$(a).attr("disabled",!1)},success:function(a){$("#content").html(a)}}),!1}),$("#edit_form").live("submit",function(){var a=$("#edit_form input[type='submit']");$(a).attr("disabled",!0);var b=[];return/[\w\.%\+\]+@[\w\]+\.+[\w]{2,}/.test($("#user_email").val())?($("#user_email_label").removeClass("error"),$("#user_email").removeClass("error")):(b.push($("#user_email")),$("#user_email_label").addClass("error",500),$("#user_email").addClass("error",500)),$("#user_name").val()===""?(b.push($("#user_name")),$("#user_name_label").addClass("error",500),$("#user_name").addClass("error",500)):($("#user_name_label").removeClass("error"),$("#user_name").removeClass("error")),$("#user_password").val()&&($("#user_password").val().length<6||$("#user_password").val().length>20)?(b.push($("#user_password")),$("#user_password_label").addClass("error",500),$("#user_password").addClass("error",500)):($("#user_password_label").removeClass("error"),$("#user_password").removeClass("error")),$("#user_current_password").val().length<6||$("#user_current_password").val().length>20?(b.push($("#user_current_password")),$("#user_current_password_label").addClass("error",500),$("#user_current_password").addClass("error",500)):($("#user_current_password_label").removeClass("error"),$("#user_current_password").removeClass("error")),b.length>0?($(a).attr("disabled",!1),b[0].focus()):$.ajax({type:"POST",url:"/users.json",data:{id:$("#id").val(),thing_id:e,utf8:"✓",authenticity_token:$('#edit_form input[name="authenticity_token"]').val(),_method:"put",user:{email:$("#user_email").val(),name:$("#user_name").val(),organization:$("#user_organization").val(),voice_number:$("#user_voice_number").val(),sms_number:$("#user_sms_number").val(),password:$("#user_password").val(),password_confirmation:$("#user_password").val(),current_password:$("#user_current_password").val()}},error:function(c){data=$.parseJSON(c.responseText),$(a).attr("disabled",!1),data.errors.email&&(b.push($("#user_email")),$("#user_email_label").addClass("error",500),$("#user_email").addClass("error",500)),data.errors.name&&(b.push($("#user_name")),$("#user_name_label").addClass("error",500),$("#user_name").addClass("error",500)),data.errors.organization&&(b.push($("#user_organization")),$("#user_organization_label").addClass("error",500),$("#user_organization").addClass("error",500)),data.errors.voice_number&&(b.push($("#user_voice_number")),$("#user_voice_number_label").addClass("error",500),$("#user_voice_number").addClass("error",500)),data.errors.sms_number&&(b.push($("#user_sms_number")),$("#user_sms_number_label").addClass("error",500),$("#user_sms_number").addClass("error",500)),data.errors.password&&(b.push($("#user_password")),$("#user_password_label").addClass("error",500),$("#user_password").addClass("error",500)),data.errors.current_password&&(b.push($("#user_current_password")),$("#user_current_password_label").addClass("error",500),$("#user_current_password").addClass("error",500)),b[0].focus()},success:function(a){$("#content").html(a)}}),!1}),$("#sign_out_form").live("submit",function(){var a=$("#sign_out_form input[type='submit']");return $(a).attr("disabled",!0),$.ajax({type:"GET",url:"/users/sign_out.json",data:{utf8:"✓",authenticity_token:$('#sign_out_form input[name="authenticity_token"]').val()},error:function(b){$(a).attr("disabled",!1)},success:function(a){$.ajax({type:"GET",url:"/sidebar/combo_form",data:{flash:{warning:"Signed out."}},success:function(a){$("#content").html(a)}})}}),!1}),$("#sign_in_form").live("submit",function(){var a=$("#sign_in_form input[type='submit']");return $(a).attr("disabled",!0),$.ajax({type:"GET",url:"/users/sign_in",data:{utf8:"✓",authenticity_token:$('#sign_in_form input[name="authenticity_token"]').val()},beforeSend:function(){$("#info_window").hide(),$("#loader").show()},error:function(b){$("#loader").hide(),$("#info_window").show(),$(a).attr("disabled",!1)},success:function(a){g.setContent(a)}}),!1}),$("#back_form").live("submit",function(){var a=$("#back_form input[type='submit']");return $(a).attr("disabled",!0),$.ajax({type:"GET",url:"/sidebar/search",error:function(b){$(a).attr("disabled",!1)},success:function(a){$("#content").html(a)}}),!1}),$("#reminder_form").live("submit",function(){var a=$("#reminder_form input[type='submit']");return $(a).attr("disabled",!0),$.ajax({type:"POST",url:"/reminders.json",data:{utf8:"✓",authenticity_token:$('#reminder_form input[name="authenticity_token"]').val(),reminder:{from_user_id:$("#reminder_from_user_id").val(),to_user_id:$("#reminder_to_user_id").val(),thing_id:e}},beforeSend:function(){$("#info_window").hide(),$("#loader").show()},error:function(b){$("#loader").hide(),$("#info_window").show(),$(a).attr("disabled",!1)},success:function(a){$.ajax({type:"GET",url:"/info_window",data:{thing_id:e,flash:{notice:"Reminder sent!"}},success:function(a){g.setContent(a)}})}}),!1}),$(".alert-message").alert(),$("#tos").modal({backdrop:!0,keyboard:!0})})