var defaultEmail    = 'Username';
var defaultPassword = 'Password';

jQuery(document).ready(function($){
  $('.false').bind('click', function(){
    return false;
  });

  $('#loginUser').val(defaultEmail);
  $('#loginPassword').val(defaultPassword);

  $('#loginUser').bind('focus blur', function(){
    if ( this.value == defaultEmail ) {
      this.value = '';
    } else if ( this.value == '' ) {
      this.value = defaultEmail;
    }
  });
  $('#loginPassword').bind('focus blur', function(){
    if ( this.value == '' ) {
      this.type = 'text';
      this.value = defaultPassword;
    } else if ( this.value == defaultPassword && this.type == 'text' ) {
      this.type = 'password';
      this.value = '';
    }
  });
  $('#districtDirectory').mailto();
  /*
  $('.resources-cats a').each(function(i){
    this.href="#";
  });
  */
  $('a.false').bind('click', function(){
    return false;
  });

  //$('.entry tr td:nth-child(2)').addClass('tdAlignRight');
});

jQuery.fn.mailto = function () {
  return this.each( function() {
    var re = /(([a-z0-9*._+]){1,}\@(([a-z0-9]+[-]?){1,}[a-z0-9]+\.){1,}([a-z]{2,4}|museum)(?![\w\s?&.\/;#~%"=-]*>))/g
    jQuery(this).html( jQuery(this).html().replace( re, '<a href="mailto:$1";>$1</a>') );
  });
}
