function get_rowsactive(){
    // Bereken aantal overgebleven sporten en geef overgebleven sporten terug in array

	var counter = 0;
	var aSportenActief = new Array();
	
	$("ul#wedstrijdschema li.sport-rij-wrap").each(function(){
	    var sportid = this.id.substr(6);
	    aSportenActief[counter] = sportid;
	    counter++;
	});
	
	return aSportenActief;
}

update_timevars();

// on document ready
$(function(){
	
	NOSWEDSTRIJDSCHEMA.sportev_wrap_left_to_ul 		= parseInt($("div.sport-evenementen-wrap").eq(0).css("left").replace(/px$/,""));
	NOSWEDSTRIJDSCHEMA.wedstrijdschema_left_to_main = parseInt($("#wedstrijdschema").css("margin-left").replace(/px$/,""));
	NOSWEDSTRIJDSCHEMA.sportev_wrap_left 			= NOSWEDSTRIJDSCHEMA.sportev_wrap_left_to_ul + NOSWEDSTRIJDSCHEMA.wedstrijdschema_left_to_main;
	NOSWEDSTRIJDSCHEMA.sportev_wrap_right 			= parseInt($("ul#wedstrijdschema").eq(0).css("width").replace(/px$/,""));; // Fixed width ul#wedstrijdschema
	NOSWEDSTRIJDSCHEMA.rowsactive 					= get_rowsactive();
	
	var aSportsActiveList = NOSWEDSTRIJDSCHEMA.rowsactive;
	
	if(NOSGLOBALVARS.showtimenow == 1){
		set_timeindicator_height('');
		$('div#time-now').animate({width: NOSWEDSTRIJDSCHEMA.timeindicatorwidth+'px'},250);
		$('.gecko div#time-now, .mac div#time-now').animate({opacity: NOSWEDSTRIJDSCHEMA.timeindicatoropacity},250);
	} else {
		$('div#time-now').hide();
	}
	
	// initiate tooltip
	tooltip();
	
	// add click function to left button
	$("a#wedstrijdschema-nav-vorige").click(function(e){
		defaultClickActions(e,this);
	
		move_timeline("left");
		removeTooltip();
	});
	
	// add click function to right button
	$("a#wedstrijdschema-nav-volgende").click(function(e){
		defaultClickActions(e,this);

		move_timeline("right");
		removeTooltip();
	});
	
	mark_live_events();
	if(NOSGLOBALVARS.showtimenow == 1){
		move_timeline_to_now();
		setInterval(update_wedstrijdschema, 60000);
	} else {
		move_timeline_to(250);
	}
	

});
