$(document).ready(function(){
	
	$("tr.data").hover(
		function() {
			$(this).css('background-color', '#333');
			$(this).css('cursor', 'pointer');
		},
		function() {
			$(this).css('background-color', 'transparent');
			$(this).css('cursor', 'auto');
		}
	);
	
	$("tr.data_highlighted").hover(
			function() {
				$(this).css('background-color', '#aa0000');
				$(this).css('cursor', 'pointer');
			},
			function() {
				$(this).css('background-color', '#880000');
				$(this).css('cursor', 'auto');
			}
		);
	
	$("tr.row").hover(
			function() {
				$(this).css('background-color', '#333');
			},
			function() {
				$(this).css('background-color', 'transparent');
			}
		);
	
	$('input[name="select_all"]').click( function(){
		if($(this).attr('checked'))
		{
			$('input').attr('checked', 'checked');
		} else {
			$('input').attr('checked', '');
		}
	});
	
	$('img.courses').hover(
			function() {
				$(this).attr('src', '/img/alle_kurse_hover.jpg');
			},
			function() {
				$(this).attr('src', '/img/alle_kurse.jpg');
			}
	);
	$('img.courses_s').hover(
			function() {
				$(this).attr('src', '/img/alle_kurse_s_hover.jpg');
			},
			function() {
				$(this).attr('src', '/img/alle_kurse_s.jpg');
			}
	);
	
	$('img.gallery').hover(
			function() {
				$(this).attr('src', '/img/galerie_hover.jpg');
			},
			function() {
				$(this).attr('src', '/img/galerie.jpg');
			}
	);
	$('img.gallery_s').hover(
			function() {
				$(this).attr('src', '/img/galerie_s_hover.jpg');
			},
			function() {
				$(this).attr('src', '/img/galerie_s.jpg');
			}
	);
	
	$('ul.sf-menu').superfish(); 
	
});



function number_format( number, decimals, dec_point, thousands_sep ) {
    var n = number, prec = decimals;
    n = !isFinite(+n) ? 0 : +n;
    prec = !isFinite(+prec) ? 0 : Math.abs(prec);
    var sep = (typeof thousands_sep == "undefined") ? ',' : thousands_sep;
    var dec = (typeof dec_point == "undefined") ? '.' : dec_point;
 
    var s = (prec > 0) ? n.toFixed(prec) : Math.round(n).toFixed(prec);
 
    var abs = Math.abs(n).toFixed(prec);
    var _, i;
 
    if (abs >= 1000) {
        _ = abs.split(/\D/);
        i = _[0].length % 3 || 3;
 
        _[0] = s.slice(0,i + (n < 0)) +
              _[0].slice(i).replace(/(\d{3})/g, sep+'$1');
 
        s = _.join(dec);
    } else {
        s = s.replace('.', dec);
    }
 
    return s;
}