/*
 * IMOA CONTROLLER - Javascript controller for the IMOA site.
 */

/* Initialize the global IMOA namespace. */
window.IMOA = window.IMOA || {};

IMOA = (function() {
  /* Private members */
  
  /* Private methods */
  
  // What runs on document.ready
  function _init() {
    var calloutCount = $(".callout-item").length;
    
    // Replace all of the mailto hrefs (avoid spam)
    var at = / at /;
    var dot = / dot /g;
    $('span.mailme').each(function() {
      var addr = $(this).text().replace(at,"@").replace(dot,".");
      $(this).after('<a href="mailto:'+addr+'" title="Send an email">'+ addr +'</a>')
            .hover(function(){window.status="Send a letter!";}, function(){window.status="";})
            .remove();
    });
    
    // Example text
    if($("#q").length > 0) {
      $('#q').example("Enter a member name");
    }
    
  };
  $(document).ready(_init);
  
  /* Public methods */
  return {}
  
})();

/* Run these immediately. No need to wait for document.ready */