window.addEvent('domready', function(){

$(document.body).getElements('input[type=text],textarea').addEvents({

                                        'focus' : function(){
                                                if (this.get('value') == this.defaultValue)
                                                {
                                                        this.set('value', '');
                                                }
                                        },
                                        'blur' : function(){
                                                if (this.get('value') == '')
                                                {
                                                        this.set('value', (this.defaultValue));
                                                }
                                        }
     }); 

// submit button is clicked , so send the value
$('contactForm').addEvent('submit', function(e) {
var myFx = new Fx.Slide('contact_form').slideOut();
new Event(e).stop();  //stop the form not to submit
var log = $('log_res').empty().addClass('ajax-loading'); //load the loader image div


        // set the form to send
        this.set('send', {
                method: 'post',
                onSuccess: function(responseText, responseXML) {

                    $('log_res').removeClass('ajax-loading'); //remove the ajax loader image class
                      if( responseText == "Success" )
                     {
                          
                         $('log_res').set('html', "<p>Thanks for your email!<br />As soon as its not so cold, we'll take our gloves off to type your reply.</p>"); //set the message      
                     }
                      else 
                     {
                        var myFx = new Fx.Slide('contact_form').show(); 
                        $('response').morph({color: '#000000'}); // show message with color effect                       
                        $('log_res').set('html', responseText); //set the message
                      }
                       
                },
                onFailure: function(headerName, value) {
                        responseT.start('background-color', '#F9F260', '#FFFFFF');
                       $('response').morph({color: '#FF0000'});
                        $('log_res').removeClass('ajax-loading');
                        $('log_res').set('html', responseText);
                }
        });
       this.send(this.action); //send the data
});

});