/**
 * @author Guido Rosso
 */
window.onload = function(){
			
		var contactBtn = $('contactBtn');
		var submitBtn = $('submitBtn');
		var checkState = "closed";
		
		var expandForm = new Fx.Elements($$('#contactForm', '#desc'), {duration: 500, transition: Fx.Transitions.quintInOut});
			
		contactBtn.addEvent('click', function(){
			if(checkState == "closed"){
				expandForm.start({
				    '0': {
				        'height': [201],
						'margin-top': [20]
				    },
				    '1': {
				        'margin-top': [29]
				    }
				});
				contactBtn.setStyle('background-image', 'url(images/hideform.gif)');
				checkState = "open";
			} else if (checkState == "open"){
				expandForm.start({
				    '0': {
				        'height': [0],
						'margin-top': [0]
				    },
				    '1': {
				        'margin-top': [250]
				    }
				});
				contactBtn.setStyle('background-image', 'url(images/email.gif)');
				 $('updateMsg').setStyle('display', 'none');
				checkState = "closed";
			}
		});
		
		submitBtn.addEvent('click', function(){
			$('contactForm').send({ onComplete: showResponse, update:'updateMsg' });
		});
		submitBtn.addEvent('mouseover', function(){
			submitBtn.setStyle('background-image', 'url(images/sendover.gif)');
		});
		submitBtn.addEvent('mouseout', function(){
			submitBtn.setStyle('background-image', 'url(images/send.gif)');
		});
		
		function showResponse(){
  		  $('updateMsg').setStyle('display', 'block');
		};
};