window.addEvent('domready', function() {

	/* DTR-Replacement für Links in der Navigation auch bei Überfahren des li-Elements */
	$$('img.dtrimage').each(function(el){
		var pel = el.getParent('a');
		if(pel)
		{
			pel.addEvents({
				'mouseover': function() {
					el.onmouseover();
				},
				'mouseout': function() {
					el.onmouseout();
				}
			});
		}
	});
	
	//store titles and text
	$$('a.tipz').each(function(element,index) {
		var content = element.get('title').split('::');
		element.store('tip:title', content[0]);
		element.store('tip:text', content[1]);
	});
	
	//create the tooltips
	var tipz = new Tips('.tipz',{
		className: 'tipz',
		fixed: false,
		hideDelay: 50,
		showDelay: 50,
		windowPadding: {'x':40,'y':40},
		'show': function(tip) {
			tip.fade('in');
		},
		'hide': function(tip) {
			tip.fade('out');
		}
	});
	
	var i=0;
	// Margin für Bild-Galerie setzen
	$$('div.gallery').each(function(el){
		
		i=i+1;
		
		if(i%2 == 0)
		{
			el.setStyle('margin-right','0px');
		}
		
	});
	
	// Formular-Vorbelegung bei übergebenen Parametern im GET-String
	var myuri = new URI(document.location);
	if(myuri.get('file')=='anmeldung.html' && myuri.get('query') != '')
	{
		var strQuery = myuri.get('query');
		objQuery = strQuery.parseQueryString();
		if(objQuery.k && $('ctrl_20').get('value') == '--')
		{
			$('ctrl_20').set('value',objQuery.k);
		}
		if(objQuery.b && $('ctrl_26').get('value') == 'TT.MM.JJJJ')
		{
			$('ctrl_26').set('value',objQuery.b);
		}
		if(objQuery.d && $('ctrl_27').get('value') == '--')
		{
			$('ctrl_27').set('value',objQuery.d);
		}
		if(objQuery.u && $('ctrl_28').get('value') == 'SS:mm')
		{
			$('ctrl_28').set('value',objQuery.u);
		}
		myuri.clearData();
		$('f9').set('action',myuri.get('file'));
	}
	
});
