            $(document).ready(function(){
            
                wireUpDisplayTextboxes();

                $('#contact').ajaxForm({
                    target: '#forklift_batteries_contact', 
                    beforeSubmit:  validateForm,
                    success: function() {
                                
                             }			
                     
                });
             
                 function validateForm() {
                    $('#contact').validate({
                        rules: {
                            email: {
                            required: true,
                            email: true
                            }
                            },
            
                    invalidHandler: function(e, validator) {
                        var errors = validator.numberOfInvalids();
                        if (errors) {
                            var message = errors == 1
                                ? 'Highlighted field below are required'
                                : 'Highlighted fields below are required';
                            $('div.error span').html(message);
                            $('div.error').show();
                        } else {
                            $('div.error').hide();
                        }
                    }
                    });
                    
                    if (!$('#contact').valid()) {
                        return false;
                    }
                 
                 } 
     
           

            });

            function clearText(field){
                if (field.defaultValue == field.value) field.value = '';
                else if (field.value == '') field.value = field.defaultValue;
            
            }

            // displays hint text on any input element with the 'title' attribute set
            function wireUpDisplayTextboxes() {
            var el = $('input[hint]');
            
            // show the display text
            el.each(function(i) {
                $(this).attr('value', $(this).attr('hint'));
            });
            
            // hook up the blur & focus
            el.focus(function() {
                if ($(this).attr('value') == $(this).attr('hint'))
                    $(this).attr('value', '');
            }).blur(function() {
                if ($(this).attr('value') == '')
                    $(this).attr('value', $(this).attr('hint'));
            });
            }            



