$(document).ready(function() {
	
	$("ul#nav h3").hover(
		function () {
			if ( $(this).attr('className')!='static' ) $(this).addClass('current');
		},
		function () {
			if ( $(this).attr('className')!='static' ) $(this).removeClass('current');
		}
	);
	
	
	$("div#footer div#newsletter input#email").defaultvalue("ihre email-adresse");
	
	
	$('input[@id^=subscribe]').click(function() {
		
		var Regex =/^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if( !Regex.test( $('#email').val() ) ) {
			alert('Invalid email address.');
			return false;
		}
		
		$.ajax({
			type: "POST",
			url: $('#subscribeForm').attr('action'),
			data: 'email='+$('#email').val(),
			dataType: 'json',
			cache: false,
			success: function(data) {
				if (data.status==1) $('#email').defaultvalue("ihre email-adresse");
				alert(data.message);
			}
		});
		
		return false;
	});
	
	
	$("a[@id^=toggle]").click(function () {
		var id = $(this).attr('id').replace('toggle', '');
		$("#toggleText"+id).slideToggle("slow");
	});


	if ($('h3#scroll').length>0) {
		$.scrollTo('h3#scroll', 1000);
	}
	
	if ($('table#scroll').length>0) {
		$.scrollTo('table#scroll', 1000);
	}
});
