$(document).ready(function() {
	
	
	
	$("#search-query:[class!=hasBeenFocused], #plz-query:[class!=hasBeenFocused]").live("focus", function(){
		$(this).val("").addClass("hasBeenFocused");;
	});
	
	
	
	
});


function validEmail(email) {
  var strReg = "^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$";
  var regex = new RegExp(strReg);
  return(regex.test(email));
}

function checkdateformat(datum){
	var dateformat = /^\d{2}(\.)\d{2}(\.)\d{4}$/;
	var result = dateformat.test(datum);
	return result;
}

function checktimeformat(time){
	var dateformat = /^\d{2}(\:)\d{2}$/;
	var result = dateformat.test(time);
	return result;
}

function bildwechsel(tb,start,init,opt) {
	
	var speed = 6000;
	var fadespeed = 2000;
	if(init == true) {
		speed = speed-fadespeed;
	}
	
	$("#image img").css({position:"absolute"});
	var anzahl = tb.length;
	if(start == anzahl-1) {
		var next = 0;
	} else {
		var next = start+1;	
	}
	


	if(anzahl > 1) {
		// init
		$("#image").append('\n<img src="'+tb[next]+'" alt="Titelbild" style="display:none;position:absolute;z-index:1001;" />');
		
		if(start == 0 && init == true) {
			$("#image img:first").show();
		}
			
		var images = $("#image img");
	
		
		if(init == false) {	
			$(images[1]).fadeIn(fadespeed);
			$(images[0]).fadeOut(fadespeed, function(){	
				
				$(images[0]).remove();						   
			});
		}
		
	
		
		exe = setTimeout(function(){
			bildwechsel(tb,next,false,"run");
		}, speed);
	
		
	

	}
}


