/**
 *
 */
function ajax_liga_table(ligaid, page, div) {
    var url = "quiz-liga-tables.php?cmd=ajax_liga_table";
    new Ajax(url, {
	    method: 'post',
        data: { 
                'nLigaID': ligaid,
                'sLigaDiv': div,
                'next':page            
               },
        update: $(div),
        onComplete: function() {
        }
    }).request();
}

/**
 *
 */
function ajax_liga_gameplan(page) {
    var url = "quiz-liga-spielplan.php";
    new Ajax(url, {
	    method: 'post',
        data: { 
                'next':page            
               },
        update: $('liga_gameplan'),
        onComplete: function() {
        }
    }).request();
}

/**
 *
 */
var bChosenResponse = false; 
var bIsGameStarted = false;
/**
 *
 */
function chooseResponse(sItemSessionUIN, nUsrResponse, pSessionID) {
    if(!bChosenResponse) {
        stopTimer();
        location.href='quiz-liga.php?cmd=solve&sItemSessionUIN=' + sItemSessionUIN + '&nUsrResponse=' + nUsrResponse + '&' + pSessionID; 
        bChosenResponse = true;
    }
}
/**
 *
 */
function start_game(pSessionID) {
    if(!bIsGameStarted) {
        location.href='quiz-liga.php?cmd=new_game&' + pSessionID; 
        bIsGameStarted = true;
    }
}
/**
 *
 */
window.addEvent('domready', function(){
    ajax_liga_table(1, 0, 'liga_1');
    ajax_liga_table(2, 0, 'liga_2');
    ajax_liga_table(3, 0, 'liga_3_nord');
    ajax_liga_table(4, 0, 'liga_3_sued');
    ajax_liga_table(5, 0, 'liga_4_nord');
    ajax_liga_table(6, 0, 'liga_4_sued');
    ajax_liga_table(7, 0, 'liga_4_west');
    
    ajax_liga_gameplan(-1);
});
