var infos;
var regSend = false;


addLoadEvent(function() {

	infos = document.getElementsByClassName('info');
	
 	if(infos.length > 0){
		$('teaser1').onclick = function(){
			showInfos(1);		
		  };	
		$('teaser2').onclick = function(){
			showInfos(2);		
		  };
		$('teaser3').onclick = function(){
			showInfos(3);
		 };
	}
	
	if($('loginformform')){
		$('loginformform').onsubmit =function (){
			doLogin();
			return false;
		}
	}

	if($('pass1')){ // REG VISIBLE?
		$('pass1').onfocus = function(){ 
			if($('repeatpass').style.display == "none") Effect.BlindDown('repeatpass',{duration:0.4});
		 };	 
		$('pass2').onblur = function(){ 
			if($F('password')!=$F('password2')) alert("Bitte geben Sie Ihr Passwort erneut ein.");
		 };	 
		new Ajax.Autocompleter("university", "university_choices", "/data/universityID.php");
		new Ajax.Autocompleter("studyfield", "studyfield_choices", "/data/studyField.php");
	}
});
		

function showInfos(num){
	$('flash').style.margin = 0;
	if(num == 1)
	$('flash').style.marginRight = "66%";
	if(num == 3)
	$('flash').style.marginLeft = "66%";
	
	infos.each( function(box){
			box.style.display = "none";
	});
	
	infos[num-1].style.display = "block";
	
	var id = 'teaser'+num;
	Element.addClassName('teaser1', "light");
	Element.addClassName('teaser2', "light");
	Element.addClassName('teaser3', "light");
	Element.removeClassName(id, "light");
}
