function checkValues(form)
{
	var error=false;
	
	var toCheck=new Array();
	
	toCheck[0]='vorname';
	toCheck[1]='nachname';
	toCheck[2]='email';
							
	for(x=0;x<toCheck.length;x++){
		if($(toCheck[x]).value==''){
			$(toCheck[x]).style.borderColor="#C40014";
			$(toCheck[x]).style.backgroundColor="#FFDDDD";
			error=true;
		}
		else{
			$(toCheck[x]).style.borderColor="#aaa";
			$(toCheck[x]).style.backgroundColor="#ffffff";
		}
	}
							
	if(error==false)
	{
		//$('mailer_message_errortext').style.display='none';
		var currPost='&ajax=true';
		
		for(x=0;x<form.length;x++)
		{
			if (form[x].value!=''){
				if (form[x].type=='checkbox'){
					if (form[x].checked==true){
						currPost=currPost+'&'+form[x].name+'='+form[x].value;
					}
				}else{
					currPost=currPost+'&'+form[x].name+'='+form[x].value;
				}
			}else{
				if (form[x].tagName=='INPUT' || form[x].tagName=='TEXTAREA'){
					if (form[x].type=='checkbox'){
						if (form[x].checked==true){
							currPost=currPost+'&'+form[x].name+'='+form[x].value;
						}
					}else{
						currPost=currPost+'&'+form[x].name+'='+form[x].value;
					}
				}else{
					currPost=currPost+'&'+form[x].name+'='+form[x].options[form[x].selectedIndex].value;
					if(form[x].selectedIndex==0){
						currPost=currPost+'&'+form[x].name+'=Herr';
					}else{
						currPost=currPost+'&'+form[x].name+'=Frau';
					}
				}
			}
		}
		//alert(currPost);
		$('mailer_message_text').style.display='';
		$('kontakt_formular').style.display='none';
		
		new Ajax.Updater('mailer_message_text','../scripts/forms/mailer.php', { asynchronous:true, postBody:currPost });
	}else{
		//$('mailer_message_errortext').style.display='';
	}

	return false;
}

function find_kat(url){	
	if(url!=""){	
		window.location.href=url;
	}
}

getRandom = function(min,max){
	if(min>max){
		return(-1);
	}
	if(min ==max){
		return(min);
	}
	return(min+parseInt(Math.random()*(max-min+1)));
}

showTeaser = function(){
	$$('.teaser .t')[getRandom(0,$$('.teaser .t').length-1)].appear();
}

document.observe("dom:loaded", function() {
	showTeaser();
	$$('.article_to_article .block').each(function(b){
		if(b.down(0).clientWidth == 418){
			b.onmouseover = function(e){this.down(0).style.left=-209+'px'};
			b.onmouseout = function(e){this.down(0).style.left=0+'px'};
		}
	});
});