window.addEvent('domready', function() {
	Element.implement({ 
    clearFocusResetBlur: function(attr){ 
        var valueString = this.get(attr); 
        this.addEvents({ 
            'focus': function(){ 
                if( this.get('value') == valueString ) this.set('value',''); 
            }, 
            'blur': function(){ 
                if( this.get('value') == "" ) this.set('value',valueString); 
            } 
        }); 
    	} 
	}); 

	$('vornameField').clearFocusResetBlur('alt'); 
	$('nachnameField').clearFocusResetBlur('alt'); 
	$('emailField').clearFocusResetBlur('alt'); 

	$('newsletterForm').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 = $('newsletterstatus').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();
	});
	
	
	containerHeight = $('video-container').getStyle("height");

	$('video-container').setStyle("height", "16px");
	$('trailer').set('opacity', '0');

	hidden = true;
		
		$('video-button').addEvents({
			'click': function(event){
				event.stop();
				if ( hidden ) {
					$('video-container').set('tween', {duration: 1000}).tween('height', containerHeight);
					$('trailer').set('opacity', '1');
					$('video-button').set('html', "Trailer zu Humaniti verstecken" );
					hidden = false;
				} else {
					$('video-container').set('tween', {duration: 1000}).tween('height', "16px" );
					$('video-button').set('html', "Trailer zu Humaniti anzeigen" );
					$('trailer').set('opacity', '0');

					hidden = true;
				}
			}
		});
		
		
});