/*
Credits: Bit Repository
URL: http://www.bitrepository.com/web-programming/ajax/login-form.html
*/


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

	$('contactownerform').addEvent('submit', function(e) {
		// Prevents the default submit event from loading a new page.
		e.stop();

		// Show the spinning indicator when pressing the submit button...
		//$('ajax_loading3').setStyle('display','block');
		
		


		// Set the options of the form's Request handler.
		// ("this" refers to the $('login') element).
		this.set('send', { onComplete: function(response) {
		//$('ajax_loading3').setStyle('display','none');	

	if(response == 'OK')
			{
		     
            $('login_response').set('html', "<div id='error_notification' style='color:#006600; font-style:italic; font-weight:bold;'>Your request has been sent. The property owner will be in contact shortly.</div>");
	         // $('formbox').set('value','');
			 // $('formbox').setStyle('display','none');
			  //$('login_response').fade('out');
			}
			else
			{
			  
			  $('login_response').set('html', response);
			  // Show the login button
			  $('submit').setStyle('display','block');
			}
		}});

		// Send the form.
		this.send();
	});
});
