// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

submitOnEnter = function(e) {
  if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
    document.forms[0].submit();
  }
}

/* Prototype
Event.addBehavior.reassignAfterAjax = true;
Event.addBehavior({
  'div.pagination a.prev-page-link' : Remote.Link
})
Event.addBehavior({
  'div.pagination a.next-page-link' : Remote.Link
})
*/

// jQuery.ajaxSetup({ 
//   'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")} 
// })
// 
// $(window).load(function() {
//   $("input:visible:enabled:first").focus();
// })

function spin_div(div_id) {
  container = $(div_id);
  positioning = 'top: '+container.offsetTop+'px; width: '+container.offsetWidth+'px; height: '+container.offsetHeight+'px; ';
  container.innerHTML += '<div class="spin_div" id=\"' + div_id + '_spinner\" style="position: absolute; ' + positioning + '"></div>';
}

function addAvatarTooltips(){
  avatars = $$("div[class=avatar]");
  avatars.each(function(avatar){
    new Tip(avatar, 'my avatart tooltip',{
      title: 'This tooltip has a title',
      style: 'bigf'
    });
  });
}

