
function betSlip(selectionID, feedID, marketID, chosenPrice, isBestPrice, priceDisplayType)
{
    _setupReferalCookie();
	
	var windowName = ((new Date()).getTime() + "" + Math.floor(Math.random() * 1000000)).substr(0, 18);
	
	window.open("/compareodds/bet-slip.aspx?fm_fd_id=" + feedID + "&eoMarketID=" + marketID + "&selectionID=" + selectionID + "&dp=" + chosenPrice + "&isbp=" + isBestPrice + "&pt=" + priceDisplayType, windowName, "width=500,height=500,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no");	
}

function spreadSell(feedID, marketID, selectionID, sellPrice, isBestPrice)
{
    _setupReferalCookie();
    
    var windowName = ((new Date()).getTime() + "" + Math.floor(Math.random() * 1000000)).substr(0, 18);
    
    var betSlipWindow = window.open("/compareodds/bet-slip.aspx?fm_fd_id=" + feedID + "&eoMarketID=" + marketID + "&selectionID=" + selectionID + "&dp=" + sellPrice + "&isbp=" + isBestPrice + "&spread=Sell", windowName, "width=500,height=500,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no");
	if (betSlipWindow.opener == null) betSlipWindow.opener = self;
	 	betSlipWindow.focus();
}

function spreadBuy(feedID, marketID, selectionID, buyPrice, isBestPrice)
{
    _setupReferalCookie();
    
    var windowName = ((new Date()).getTime() + "" + Math.floor(Math.random() * 1000000)).substr(0, 18);
	
	var betSlipWindow = window.open("/compareodds/bet-slip.aspx?fm_fd_id=" + feedID + "&eoMarketID=" + marketID + "&selectionID=" + selectionID + "&dp=" + buyPrice + "&isbp=" + isBestPrice + "&spread=Buy", windowName, "width=500,height=500,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no");
	if (betSlipWindow.opener == null) betSlipWindow.opener = self;
		betSlipWindow.focus();
}

//--Private (by convention _) function creates BSPageReferer cookie
function _setupReferalCookie()
{
    var refStr = new String(document.location);
	SetCookie("BSPageReferer", refStr, null, "/") ;
	
	if ((refStr.indexOf("/m/") > 0) || (refStr.indexOf("/mhr/") > 0)) 
	{
		SetCookie("MRM", refStr, null, "/") ;
	}
	else
	{
		DeleteCookie ("MRM") ;
	}
}