//alert("AddToMyBet");
function ExecuteAction(object,sifraTima,imeTima,sifraLige,imeLige,kvota,tipIgre,pageClass,Place,LastN,Sezona)
{
	if(object.checked)
	{
		Core.UserEnvironment.AddTeam(sifraTima,imeTima,sifraLige,imeLige,kvota,tipIgre,
		 pageClass,Place,LastN,Sezona,stdCallBack);
	}
	else
	{
		Core.UserEnvironment.DeleteTeam(sifraTima,imeTima,stdCallBack);
	}
}
function AddPair(object,sifraDomacina,sifraGosta,imeDomacina,imeGosta,imeLige,kvota,tipIgre,pageClass,Place,LastN,Sezona)
{
	if(object.checked)
	{
		Core.UserEnvironment.AddPair(sifraDomacina,sifraGosta,imeDomacina,imeGosta,imeLige,kvota,tipIgre,pageClass,
			Place,LastN,Sezona,stdCallBack);
	}
	else
	{
		Core.UserEnvironment.DeletePair(sifraDomacina,sifraGosta,imeDomacina,imeGosta,stdCallBack);
	}
}
function StatsOdds_AddPair(object,selectName,sifraDomacina,sifraGosta,imeDomacina,imeGosta,imeLige,Place,Sezona,LastN)
{
	if(object.checked)
	{
		//alert("selectName =" + selectName);
		var selOddControl = document.getElementById(selectName);
		//alert("Usao " + selOddControl);
		var selIndex = selOddControl.selectedIndex;
		//alert("selIndex=" + selIndex);
		var tipIgre = selOddControl.options[selIndex].text;
		var kvotaPom = selOddControl.options[selIndex].value;
		var kvota = parseFloat(kvotaPom)
		if(!kvota)
		{
			alert("Incorrect odd format " + kvotaPom );
			return;
		}
		if(confirm("Are you sure you want to add (" + imeDomacina  + " vs " + imeGosta + ")[ game : " + tipIgre + "] [odd:" + kvota + "]" ))
		{
			Core.UserEnvironment.AddPair(sifraDomacina,sifraGosta,imeDomacina,imeGosta,imeLige,kvota,tipIgre,6,
				Place,LastN,Sezona,stdCallBack);
		}
		else
		{
			object.checked = false;
		}
		
	}
	else
	{
		Core.UserEnvironment.DeletePair(sifraDomacina,sifraGosta,imeDomacina,imeGosta,stdCallBack);
	}
}
function stdCallBack(result)
{
	if(result)
	{
		if(result.value)
		{
			if(result.value.ScriptCode.length > 0)
			{
				eval(result.value.ScriptCode);
			}
			if(result.value.ErrorMessage.length > 0)
			{
				alert(result.value.ErrorMessage);
			}
			else
			{
				alert(result.value.Message);
			}
		}
	}
	//alert("Team was succesfuly added to my bet!");
}