	window.addEvent('domready', function() {

		
		$('submit').addEvent('click', function(e){
		
		$('submit').disabled = true;
    $('submit').value = "Processing...";
		e.stop();
		
		//var morph = new Fx.Morph('contactResults');
		
		
		var senderName = document.getElementById('sender_name').value;
		var senderEmail = document.getElementById('sender_email').value;
		var message = document.getElementById('message').value;
		var code = document.getElementById('captcha_code').value;
		
		//alert('name '+senderName+' email '+senderEmail+' message ' +message+' code '+code);
		
			new Request({
    method: 'get',
    url: 'contact/process.php?sender_name='+senderName+'&sender_email='+senderEmail+'&message='+message+'&captcha_code='+code+'&jsDisable=0',
	data: { 'do' : '1' }, 
}).addEvents({
    'onRequest': function() {
      //alert('request started!');
    },
    'onComplete': function(response) {
		if (response == 170488) {
		
		document.getElementById('contactResults').innerHTML = "<img src='style/images/bg/success.jpg' style='float:left;height:20px;width:20px;border:none;padding-right:3px;padding-top:3px;' /> Success! Your message has been sent and will be answered shortly.";
		
		$('submit').value = 'Send Another Message';
        $('submit').disabled = false;
		$('contact_form').reset();
		
		var anotherEl = $('contactResults');

		e.stop();
		// Changes the element's style to .myClass defined in the CSS
		anotherEl.morph('.successFormBox');

		
		/*
		morph.start({
			height: '100%',
			backgroundColor: '#daf8d4',
			border: '1px solid #2f8743',
			margin: '10px 0',			
		});		
		*/
		


		}
		else {
		
		document.getElementById('contactResults').innerHTML = response;
		
		var anotherEl = $('contactResults');


		e.stop();
		// Changes the element's style to .myClass defined in the CSS
		anotherEl.morph('.errFormBox');

		/*
		morph.start({
			height: '100%',
			backgroundColor: '#ffe9e9',
			border: '1px solid #ff0000',
			marginTop: '10px 0',
		});
		*/
		
		//alert('no. response was '+response);
		$('submit').value = '^ Errors Above: Send Again';
        $('submit').disabled = false;
		}
		document.getElementById('captcha').src = 'contact/securimage/securimage_show.php?' + Math.random(); return false;
		$('captcha_code').reset();
		
    },
    'onSuccess': function(response) {
		
    },
    'onFailure': function() {
      alert('Request failed!');
	  $('submit').value = 'Send Message';
      $('submit').disabled = false;
    }
}).send();

	});		
	
	
	});
	
	
