$(document).bind('gameStarted', function () {
    //Put here some code.
    console.log("game started");
});

$(document).bind('gameFinished', function (e, statistic) {
    //Put here some code.
    console.log("game Finished. Statistic- ", statistic);

    //$.post("results.php", results);
	
	calllvback = function(){
		game_name1 = $('div.game .info_game_name').text().split(':');
		 player1 = $('div.game .info_player').text().split(':');
		 game_percent1 = $('div.game .info_score').text().split(':');
		 date1= $('div.game .info_date').text().split(':');
		 game =  game_name1[1].trim();player =  player1[1].trim(); percent =game_percent1[1].trim(); date=date1[1].trim();
		 //alert(game_name1[1] + "    "   +  player1[1]  +  "     "   +  game_percent1[1] );
		 $.ajax({
            url: 'results.php',
            type: 'GET',
            dataType:'text',
			beforeSend: function ( xhr ) {
              },
            data: {game_name: game,
					player: player,
					game_percent:percent,
					date:date
			}
    });
}
setTimeout('calllvback()', 1000);
});
