$(document).ready(function() {

	$('div.facebook_like iframe[src=""]').attr('src', 'http://www.facebook.com/plugins/like.php?href='+encodeURIComponent(document.location.href)+'&amp;layout=standard&show_faces=false&width=472&action=like&font=arial&colorscheme=light&height=35');

	$('a.toggleSuchfeld').click(function() {
		$(this).closest('div.suchform').find('div.suche_erweitert').toggle('slow', function() {
			$(this).closest('div.suchform').toggleClass('suchform_open');
		});
		$(this).blur();
	});
	
	$('div.teilnehmerliste_checkbox input').change(function() {
	    if ($(this).attr('checked'))
	        $(this).closest('div.teilnehmerliste_eingabe_einzeln').addClass('teilnehmereintrag_active');
	    else
	        $(this).closest('div.teilnehmerliste_eingabe_einzeln').removeClass('teilnehmereintrag_active');
	});

	$('div.datumslabels a.suche-erweitert-alle-an').click(function(e) {
        $(this).closest('div.datumslabels').find('input.checkbox').attr('checked', true);
        $(this).blur();
        e.preventDefault();
	});

	$('div.datumslabels a.suche-erweitert-alle-aus').click(function(e) {
        $(this).closest('div.datumslabels').find('input.checkbox').attr('checked', false);
        $(this).blur();
        e.preventDefault();
	});

});


function checkBrowser_forLogin(browser)
{
	return (navigator.userAgent.indexOf(browser) != -1);
}

function getEl_forLogin(id)
{
	return document.getElementById(id);
}

function checkKey_forLogin(event, id_login_button)
{
	if ((event && event.which == 13) || (event && event.keyCode == 13))
		window.location.href = getEl_forLogin(id_login_button).href; //	document.getElementById(id_login_button).onclick();
	else
		return true;
}

function registerLoginControls(id_login_button, id_input_user, id_input_password)
{
	if (checkBrowser_forLogin('MSIE'))
	{
		getEl_forLogin(id_input_user).onkeypress = function() { checkKey_forLogin(event, id_login_button); }
		getEl_forLogin(id_input_password).onkeypress = function() { checkKey_forLogin(event, id_login_button); }
	}
	else
	{
		getEl_forLogin(id_input_user).onkeypress = function(event) { checkKey_forLogin(event, id_login_button); }
		getEl_forLogin(id_input_password).onkeypress = function(event) { checkKey_forLogin(event, id_login_button); }
	}
	getEl_forLogin(id_input_user).focus();
}


function registerDefaultButtonControls(id_button, id_input)
{
	if (checkBrowser_forLogin('MSIE'))
	{
		getEl_forLogin(id_input).onkeypress = function() { checkKey_forLogin(event, id_button); }
	}
	else
	{
		getEl_forLogin(id_input).onkeypress = function(event) { checkKey_forLogin(event, id_button); }
	}
	getEl_forLogin(id_input).focus();
}








		

