var VerbouwingFrontEnd = new Class({
  initialize: function ()
  {
    if( $('login-form') ) {
      // Init username
      var login = $('login-form').getElement('input[name=login]');
      login.addEvent('focus', function ( event ) {
        if( login.get('value') == 'E-mailadres' ) {
          login.set('value', '');
          login.removeClass('inactive');
        }
      });
      // Init password
      var password = $('login-form').getElement('input[name=password]');
      password.addEvent('focus', function ( event ) {
        if( password.get('type') == 'text' ) {
          var newPassword = new Element('input', { 'type': 'password', 'name': 'password', 'class': 'text password' } );
          newPassword.replaces( password );
          setTimeout( function() { newPassword.focus(); }, 10); // Stupid IE..
        }
      });
    }

    // Init search bar
    if( $('search-top') ) {
      $('search-top').getElement('input').addEvent('click', function() {
        if( this.get('value') == 'Uw postcode' ) {
          this.set('value', '');
          this.removeClass('inactive');
        }
      });
      $('search-top').getElement('button').addEvent('click', function() {
        if( !$('search-top').getElement('input').get('value') || $('search-top').getElement('input').get('value') == 'Uw postcode' ) return false;
      });
    }

    // Init search block
    if( $('search-home') ) {
      $('search-home').getElement('button').addEvent('click', function() {
        if( !$('search-home').getElement('input').get('value') ) return false;
      });
    }
  }
});

