window.addEvent('domready', function() {
    
    // formcheck    
    new FormCheck('contact_form');

    var form_items = $$('div.fieldbox');
        
    //loop through each 'fieldbox' div
    form_items.each(function(element, index) {

          //----------REMOVED LINE BELOW, The desc was too much  
          //var theDesc = element.getElement('.field_desc');
          var theLabel = element.getElement('label');
          var theInput = element.getElement('input');
          
          //handle the textarea
          if(theInput == null){
                var theInput = element.getElement('textarea');  
                if(theInput == null){
                    var theInput = element.getElement('select');  
                }
          }
          
          //set up animation for description box
          // Mootools 1.11
          //var desc_fx = new Fx.Style(theDesc, {duration:250, transition: Fx.Transitions.Quad.easeOut, wait:false});
          //----------REMOVED LINE BELOW, The desc was too much
          //var desc_fx = new Fx.Tween(theDesc, {duration: 250, transition: Fx.Transitions.Quad.easeOut, wait: 'false'});

          
          //set up animation for input/textarea
          // Mootools 1.11
          //var field_fx = new Fx.Style(theInput, {duration:250, transition: Fx.Transitions.Quad.easeOut, wait:false});
          var field_fx = new Fx.Tween(theInput, {duration: 250, transition: Fx.Transitions.Quad.easeOut, wait: 'false'});
          
          //hide description box (immediately)
          //----------REMOVED LINE BELOW, The desc was too much
          //theDesc.set('opacity', 0)  
          
          theInput.addEvents({
                'focus': function(){
                      // Mootools 1.11
                      /*desc_fx.start({
                        'opacity': 1
                      });
                      
                      field_fx.start({
                          'background-color': '#999999',
                          'color': '#000000'
                      });*/  
                      //----------REMOVED LINE BELOW, The desc was too much
                      //desc_fx.start('opacity', 0, 1);                    
                      field_fx.start('background-color', '#BBBBBB');
                      field_fx.start('color', '#000000');
                },
                
                'blur': function(){
                      // Mootools 1.11
                      /*desc_fx.start({
                        'opacity': 0
                      });
                      
                      field_fx.start({
                          'background-color': '#CCCCCC',
                          'color': '#666666'
                      });*/
                      //----------REMOVED LINE BELOW, The desc was too much
                      //desc_fx.start('opacity', 1, 0);                    
                      field_fx.start('background-color', '#DDDDDD');
                      field_fx.start('color', '#666666');
                }
                
          });        

    }); 
    
}); // end domready event