$('document').ready(function () {
	var tmp = new Array('div.NextEvents table tr', 'div.LobbyLive table tr', 'div.LobbyTV table tr');
	$(tmp).each(function (ix, item) {
		$(item).mouseover(function () {
			$(this).addClass('hi');
		}).mouseout(function () {
			$(this).removeClass('hi');
		})
	});

	$('img').each(function (ix, item) {
		if ($(item).attr('alt')) {
			$(item).attr('title', $(item).attr('alt'));
		}
	});

/*	$('#liveCountHolder').html($('#liveCount').html());*/

	$('#z_left_column .addon').html('<img src="/poker/img/toutnament/banner_bleff.gif"/>');

    if ($('#lobbyLiveHolder').length) refreshContent(1, true, '#lobbyLiveHolder',50);
    if ($('#lobbyNextHolder').length) refreshContent(2, true, '#lobbyNextHolder',110);
    if ($('#liveContentHolder').length) refreshContent(3, true, '#liveContentHolder',30);
    if ($('#lobbyLiveTvHolder').length) refreshContent(4, true, '#lobbyLiveTvHolder',50);

});

function refreshContent(pType, continuous, eName, rInterval) {
    //если обновляемый блок не обернут в спец-контейнер обноалять не будем
    //иначе при обновлении блоки начнут складываться друг-в друга как матрешки
    //и в итоге все зависнет
    var $el = $(eName).parent('.dynamic');
    if (!$el.length) return;
    do
    {

        //при первом запуске скипаем обновление
        if (!$el.hasClass('updatable')) {
            $el.addClass('updatable');
            break;
        }
        $el.load("./refresh.php?type="+pType, function () {
            if (continuous) setTimeout('refreshContent('+pType+','+continuous+',"'+eName+'", '+rInterval+')', 1000*rInterval);
        });
        return;
    }    while(false);
	if (continuous)
    {
        setTimeout('refreshContent('+pType+','+continuous+',"'+eName+'", '+rInterval+')', 1000*rInterval);
    }
}


