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

	$('button_send').addEvent('click', function(ev){
		new Event(ev).stop();
      	var miAjax = new Request.HTML(
      	{
			url:'other/send_contact.php',
      		method: 'post',
      		data:$('contact_form'),
      		update: $('respuesta'),
	  		evalScripts: true
      	});
      	miAjax.send();
	}); 
	  
	var form_items = $$('div.fieldbox');

	//loop through each 'fieldbox' div
	form_items.each(function(element, index) {
		var theLabel = element.getElement('label');
		var theInput = element.getElement('input');
    	

		//handle the textarea
		if(theInput == null){
			theInput = element.getElement('textarea');	    
		}
		
		var field_fx = new Fx.Morph(theInput, {
			duration:250, 
			transition: Fx.Transitions.Quad.easeOut, 
			wait:false
		});
		
		
		theInput.addEvents({
		
			'focus': function(){
				field_fx.start({
					'background-color': '#d8eedf'
				});
			},
			
			'blur': function(){
				field_fx.start({
				'background-color': '#FFCCCC'
				});
			}
		});
						   
		
		
		

		//hide description box (immediately)
	
	});

});
