jQuery(function($) {
    init_DownloadList();
    init_NLsignIn();

	$('.programm_opener').click(function(){
		$(this).toggle();
		$(this).next().toggle();
	});
});

// Downloadbox
function init_DownloadList(){

    $(".download_list li a.download_opener").removeAttr('href');

    $(".download_list li").click( function(){
        $('span.download_info',this).slideToggle(300);
        $(this).toggleClass('clicked');
    });

    $(".download_list a.download").mouseover( function(){
        $(this).parents('li').eq(0).unbind("click");
    });

    $(".download_list a.download").mouseout( function(){
        $(this).parents('li').eq(0).bind("click", function(){
            $('span.download_info',this).slideToggle(300);
            $(this).toggleClass('clicked');
        });
    });
}

function init_NLsignIn(){

	$('#teasercolumn fieldset.hidden .qfreqnote').hide();
	$('#teasercolumn fieldset span.form_error').remove();


	 $('#teasercolumn fieldset:not(.hidden) .qfelement').each(function(){
	 	var el = $(this).find('input, select').eq(0);
		var label = el.parent().prev('label');

		label.find('span').remove();
		label.hide();
		var text = label.text().replace(/^\s*([\S\s]*?)\s*$/, '$1');

	 	if (el.is('select')){
	 		el.parent().hide();
	 		el.find('option').eq(3).attr('selected','selected');
	 	}
	 	else if (el.is('input') && el.val() == ''){
			el.val(text);
	 	}

		el.bind('focus', function(){
	 		$(this).val('');
	 	});

		el.bind('blur', function(){
	 		if ($(this).val() == ''){
				el.val(text);
			}
	 	});
	 });
}

