// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function bSyntaxeEmail(sMail)
{
  var re=/^[a-z\d]+((\.|-|_)[a-z\d]+)*@((?![-\d])[a-z\d-]{0,62}[a-z\d]\.){1,4}[a-z]{2,6}$/gi;
  return (sMail.match(re)==sMail)&&(sMail.substr(sMail.lastIndexOf("@")).length<=256);
}

document.observe("dom:loaded", function() {
  // the element in which we will observe all clicks and capture
  // ones originating from pagination links
  var container = $(document.body)

  if (container) {

    container.observe('click', function(e) {
      var el = e.element()
      if (el.match('.pagination a')) {


        Element.show('spinner');
        //document.getElementById("spinner").style.display = 'block';
        new Ajax.Request(el.href, { method: 'get', onSuccess: function (transport) { Element.hide('spinner');} })
        e.stop()
        //document.getElementById("spinner").style.display = 'none';
      }
    })
  }
})

