window.addEvent('domready', function() {

	/* GLOBAL VARS and MORE */
	var mooCookie = new Hash.Cookie("mooCookie");
	var anredeCookie = new Hash.Cookie("anrede");
    
    
	/* FORMULAR LANGDATENSATZ */
	if($defined($E(".form_register #ctrl_salutation"))){
		$$(".form_register #ctrl_salutation option").each(function(eli,cnt){
			if(eli.getProperty("value") == anredeCookie.get("anrede")){
				eli.setProperty("selected","selected");
			}
		});
	}


    /* FORMULAR KURZDATENSATZ */
    if($defined($E('.form_kurzdatensatz input[name=dateOfBirth]'))) {
		$E(".form_kurzdatensatz form").addEvent("submit",function(){
			if($defined($E(".form_kurzdatensatz .radio_container"))){
				$$(".form_kurzdatensatz .radio_container input").each(function(eli,cnt){
					if(eli.getProperty("checked")){
						anredeCookie.set("anrede",eli.getProperty("value"));
					}
				});
			}
		});
		
        if($E('.form_kurzdatensatz input[name=dateOfBirth]').value.length <= 0) {
            $E('.form_kurzdatensatz input[name=dateOfBirth]').value = "z.B.: 01.01.1980";
        }
            
        $E('.form_kurzdatensatz input[name=dateOfBirth]').addEvent("focus",function(e){
            if(this.value.contains("z.B.:"))
                this.value = "01.01.1980";
        });
    }



});



