$(document).ready(function() {

    initGeneralEvents();

});


initGeneralEvents = function(){

    $('a#logout').bind('click',function(){
        if(confirm('Wollen Sie sich wirklich ausloggen?')){
            location.href = 'logout.php';
        }
    });
	
	
	$('a.reset_quizsession').bind('click',function(event){
    	var destination = $(this).attr('href');	

		event.preventDefault();
		event.stopPropagation();
		
		$.ajax({
		  url: '_ajax/deleteQuizSession.php',
		  type: 'GET',
		  data: null,
		  async: false,
		  cache: false,
		  success: function(data, textStatus, jqXHR){
			location.href = destination;
		  },
		  error: function(jqXHR, textStatus, errorThrown){
			location.href = destination;
		  }
		});			
	});	
	

    $('a#back-link').bind('click',function(event){
		event.preventDefault();
		event.stopPropagation();
        history.back();
    });


}
