function load_efx () {
  $('input[type="submit"]').click(function() {
    if (!$(this).attr('title') == "") {
      $(this).attr('disabled', true); 
      $(this).val($(this).attr('title'));
      $(id_from_rel(this)).submit();
    };
  });
  
  // agree terms submit link activator
  $("#agree-terms").click(function() {
    $('input#signup').attr('disabled',!this.checked);
  });

  // add the img class to all anchored images
  $('a img').each(function(index) {
    $(this).parent().addClass('img');
  });
  
  $('.revealer').click(function() {
    $(id_from_href(this)).show();
    $(id_from_rel(this)).focus();
    return false;
  });
  
  $('input#message_to').blur(function() {
    if ($.trim($(this).val()) == "") {
      $.jGrowl("Please enter in who you want to send the message to!",{sticky: true});
    };
  });

  // single toggle links
  $('.toggler').click(function(){
    $(id_from_href(this)).toggle();
    return false;
  });
  
  // multiple show/hide togglers
  $('.multi-toggle').click(function() {
    $(id_from_href(this)).show();
    $(id_from_rel(this)).hide();
    return false;
  });
  
  $('.hider').click(function() {
    $(id_from_href(this)).hide();
  });
  
  $('ul.data-output li').hover(function() {
    if (!$.browser.msie) {
      $(this).addClass('over');
    };
  }, function() {
    $(this).removeClass('over');
  });
  

  $('a.remote').livequery('click', function(event){
    link = $(this).attr('href');
    
    $.ajax({
      type: "GET",
      url: link,
      dataType: "script"
    });
    
    return false;
  });
  
  $('input.user-auto-complete').autocomplete(
    '/landlords/auto_complete_for_landlord_first_name_last_name');
    
}

function id_from_href (elem) {
  return $(elem).attr('href');
}

function id_from_rel (elem) {
  return $(elem).attr('rel');
}

$(document).ready(function() {
  load_efx();
});

jQuery.ajaxSetup({ 
  'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")} 
})