
var appId = '5602';
var obj;
var strLcid = '2057';

//20575602

window.onload = OnLoad;

function OnLoad()
{
    try
    { obj = new ActiveXObject("MSNMessenger.P4QuickLaunch"); }
    catch (e)
    { obj = null; }
	if(queryString('play') == 'true')
    { PlayGame(); }
} // OnLoad

function PlayGame()
{
    if (HasIE() == true)
    {
        // Running IE so launch the game.
	    LaunchGame();
    }
	else
	{
	    // Running another browser.
	    alert("Please reload this page in Internet Explorer\n\nOr choose Fishticuffs from the games menu in Windows Live Messenger.");
	}
} // PlayGame

/*
 * Launches the windows live messenger app window.
 *
 * If the user doesn't have messenger, they are alerted.
 */
function LaunchGame()
{
	if (HasMessenger() == true)
	{ obj.LaunchApp(strLcid + appId, ''); }
	else
	{ alert("You must have Windows Live Messenger to play the game."); }
} // LaunchGame

function HasMessenger()
{
    return new Boolean((obj != null));
} // HasMessenger

/*
 * Returns true is the user is running IE.
 * Returns false if the user is running another browser
 */
function HasIE()
{
    var correctBrowser = (navigator.appName == "Microsoft Internet Explorer");
    var correctVersion = (parseFloat(navigator.appVersion)>=6);
    return new Boolean(correctBrowser + correctVersion);
} // HasIE
