﻿function openDialogNumbers(obj,id)
{
	objPopup.UpdateTitleBarHTML(createDialogTitle('Ticket Numbers'));
	objPopup.UpdateContentHTML(createDialogContent('Fetching data...<p>&nbsp; &nbsp; <a href="#" class="tryagain" onclick="openDialogNumbersTryAgain(\''+id+'\');return false;">Click here if data does not load</a></p>'));
	objPopup.OpenWindow(findPosY(obj)-100);
	Betslips.RealTimeDataService.GetCartNumbers(id, OnRequestComplete);
}

function openDialogNumbersTryAgain(id)
{
	objPopup.UpdateContentHTML(createDialogContent('Fetching data (second try)...'));
	Betslips.RealTimeDataService.GetCartNumbers(id, OnRequestComplete);
}

function openDialogGames(obj,id)
{
	objPopup.UpdateTitleBarHTML(createDialogTitle('State Games'));
	objPopup.UpdateContentHTML(createDialogContent('Fetching data...<p>&nbsp; &nbsp; <a href="#" class="tryagain" onclick="openDialogGamesTryAgain(\''+id+'\');return false;">Click here if data does not load</a></p>'));
	objPopup.OpenWindow(findPosY(obj)-100);
	Betslips.RealTimeDataService.GetCartGames(id, OnRequestComplete);
}

function openDialogGamesTryAgain(id)
{
	objPopup.UpdateContentHTML(createDialogContent('Fetching data (second try)...'));
	Betslips.RealTimeDataService.GetCartGames(id, OnRequestComplete);
}

function OnRequestComplete(result) 
{
	objPopup.UpdateContentHTML(createDialogContent(result));
}
