window.addEvent('domready', function(){
 
// Variable that holds the effects.
var fx = {
	
	'success': new Fx.Style( 'success', 'opacity',{ duration: 200 } ),
	'fail': new Fx.Style( 'fail', 'opacity',{ duration: 200 } )
};

// Hides the loading div, and shows the el div for
// a period of four seconds.
var showHide = function( el ){
	
	(fx[ el ]).start(0,1);
	(function(){ (fx[ el ]).start(1,0); }).delay( 4000 );
}

// Listen for click events on the submit button.
$('submit').addEvent( 'click', function(evt){
	// Stops the submission of the form.
	new Event(evt).stop();
	
	// Sends the form to the action path,
	// which is 'script.php'.
	
	$('formcontacts').send({
		onRequest: function(){
			// Show loading div.
		//	fx.loading.start( 0,1 );
		},
		onSuccess: function(){
			// Hide loading and show success for 3 seconds.
			showHide( 'success' );
				$('formcontacts').reset();	
				extrasfromdbcontactsent();			
		},
		onFailure: function(){
			// Hide loading and show fail for 3 seconds.
			showHide( 'fail' );
		
		}
	});
} );




var mySlide = new Fx.Slide('form_hiddenarea');


	$('toggle').addEvent('click', function(e){
		e = new Event(e);
		mySlide.toggle();
		e.stop();
		window.scrollTo(0,0) ;
		extrasfromdbcontactopen();
	});
	
		$('toggletwo').addEvent('click', function(e){
		e = new Event(e);
		mySlide.toggle();
		e.stop();
		window.scrollTo(0,0) ;
		extrasfromdbcontactopen();
	});
	

 
mySlide.hide();

	$('slideout').addEvent('click', function(e){
	e = new Event(e);
	mySlide.slideOut();
	e.stop();
	});
	
	
});


