function hideDiv(div){

$(div).empty();

$(div).style.display = 'none';
}

window.addEvent('domready', function(){
if($('sendEmailForm')){
 $('sendEmailForm').addEvent('submit', function(e) {
                                           /**
                                            * Prevent the submit event
                                            */

                                           new Event(e).stop();
                                           var log = $('loadingScreen');
                                  
                                       $('loadingScreen').style.display = 'block';
                                           /**
                                            * This empties the log and shows the spinning indicator
                                            */
                                          if($('txtName').value == '' || $('txtEmail').value == '' || $('txtEnquiry').value == ''){
                                          $('loadingScreen').innerHTML = "<font color='#ff0000'>Error: Please fill name, email address and enquiry fields</font>";
                                         
                                       setTimeout("hideDiv('loadingScreen')",2000);
                                 

                                          } else {
                                           /**
                                            * send takes care of encoding and returns the Ajax instance.
                                            * onComplete removes the spinner from the log.
                                            */

                                          this.set('send', {
                                            onComplete: function(response) {
              							    $('loadingScreen').innerHTML = response;
                                            setTimeout("hideDiv('loadingScreen')",2000);
											if(response != 'There has been an Error. Please Try Again'){
												 $('sendEmailForm').reset();
												
												}
											
											
                                            }});

                                            this.send();

                                          }



                                   });
}									 
								

});

