function isEmail(email) {
	//var rx = /^..+@..+\..{2,5}$/;
	var rx =/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.([a-zA-Z]{2,4})$/;
	return rx.test(email);
}

$(document).ready(function(){
	
	$('#mycarousel').jcarousel({auto: 8,wrap:'both',scroll:1});
	
	$('.tTip').betterTooltip({speed: 150, delay: 100});
	
	$('#toggle_kontakt').click(function() {
	  $('#kontaktform_container').slideDown('slow', function() {});
	  $('#toggle_kontakt .link2').fadeOut('slow', function() {});
	});
	
	$('#kontaktform_container .link1').click(function() {
	  $('#kontaktform_container').slideUp('slow', function() {});
	  $('#toggle_kontakt .link2').fadeIn('slow', function() {});
	});
	
	$('#toggle_kontakt2').click(function() {
	  $('#kontaktform_container2').slideDown('slow', function() {});
	  $('#toggle_kontakt2 .link2').fadeOut('slow', function() {});
	});
	
	$('#kontaktform_container2 .link1').click(function() {
	  $('#kontaktform_container2').slideUp('slow', function() {});
	  $('#toggle_kontakt2 .link2').fadeIn('slow', function() {});
	});
	
	$('#callback').click(function() {
		  if(this.checked){
			  $('#time').slideDown('fast', function() {});
		  }else{
			  $('#time').slideUp('fast', function() {});
		  }
	});
	$('#callback2').click(function() {
		  if(this.checked){
			  $('#time2').slideDown('fast', function() {});
		  }else{
			  $('#time2').slideUp('fast', function() {});
		  }
	});
	
	
	
	$('#kontaktform').submit(function() {
		if(this.email.value=="" || this.name.value==""){
			alert("Bitte füllen Sie alle Pflichtfelder aus!");
			return false; 
		}else{
			$(this).ajaxSubmit(options = {type:'post',success:showResponse,url:'kontakt.php?form=kontakt'});
			return false;
		}
	});
	
	$('#kontaktform2').submit(function() {
		if(this.email2.value=="" || this.name2.value==""){
			alert("Bitte füllen Sie alle Pflichtfelder aus!");
			return false; 
		}else{
			$(this).ajaxSubmit(options = {type:'post',success:showResponse2,url:'kontakt.php?form=vortrag'});
			return false;
		}
	});
	
	
	function showResponse(responseText, statusText, xhr, $form)  { 
		$('#kontaktform').html('<br /><b>Vielen Dank für Ihre Anfrage.</b><br /><br />Wir werden uns umgehend bei Ihnen melden.<br /><br />');
	}
	function showResponse2(responseText, statusText, xhr, $form)  { 
		$('#kontaktform2').html('<br /><b>Vielen Dank für Ihre Anfrage.</b><br /><br />Wir werden uns umgehend bei Ihnen melden.<br /><br />');
	}
	
	
});

