window.addEvent('domready', function() {
if($('elementCallBackForm')){
    // Toggle CallBackBox
    var status = {
        'true': '<div class="elementToggleArrowUp" title="Kontaktformular schlie&szlig;en"></div>',
        'false': '<div  class="elementToggleArrowDown" title="Kontaktformular &ouml;ffnen"></div>'
    };

    var myVerticalSlide = new Fx.Slide('elementVerticalSlide');

    myVerticalSlide.hide();
    $('elementVerticalStatus').set('html', status[myVerticalSlide.open]);

    $('elementVerticalToggle').addEvent('click', function(e){
        e.stop();
        myVerticalSlide.toggle();
    });
	
    // When Vertical Slide ends its transition, we check for its status
    myVerticalSlide.addEvent('complete', function() {
        $('elementVerticalStatus').set('html', status[myVerticalSlide.open]);
    });

    // CallBackForm
	$('elementCallBackForm').addEvent('submit', function(e) {
		//Prevents the default submit event from loading a new page.
		e.stop();
		//Empty the log and show the spinning indicator.
		var log = $('log_res').empty().addClass('ajax-loading');
		//Set the options of the form's Request handler. 
		//("this" refers to the $('myForm') element).
		this.set('send', {onComplete: function(response) { 
			log.removeClass('ajax-loading');
			log.set('html', response);
		}});
		//Send the form.
		this.send();
	});
}
});
