var appId , emailId, obj;
var strHost, strBaseUrl;
var winModalWindow, strUrlExtension;
var strLcid;

function OnLoad()
{
	if (appId != "")
	{
		CheckP4Launch(appId, "");
	}
}

function CheckP4Launch(appId, emailId)
{
	CheckMessenger();
	LaunchApp(appId, emailId);
}

function TryItNow(appId)
{
	CheckMessenger();
	LaunchApp(strLcid + appId, "");
}

function LaunchApp(appId, emailId)
{
	if (obj != null)
	{
		obj.LaunchApp(appId, emailId);
	}
}

function CheckMessenger()
{
	eval ('try {obj = new ActiveXObject("MSNMessenger.P4QuickLaunch"); } catch (e) {obj = null;}');
	var strErrorPage = "http://" + strHost + strBaseUrl + "/Resource/Error.aspx"
	
	if (fBrowser == false)
	{
		ShowWindow(strErrorPage + strUrlExtension + "err=1", 410, 130);
	}	
	else if (obj == null)
	{
		ShowWindow(strErrorPage + strUrlExtension + "err=2", 410, 225);
	}
}

function IgnoreEvents(e)
{
  return false
}
 
function ShowWindow(strError, width, height)
{
  if (window.showModalDialog)
  {
    window.showModalDialog(strError,null,
    "dialogWidth="+width+"px;dialogHeight="+height+"px;help=no;dialogLeft=160")
  }
  else
  {

    var ah = screen.availHeight;
    var y = (ah - height) / 2;
    window.top.captureEvents (Event.CLICK|Event.FOCUS)
    window.top.onfocus=HandleFocus 
    winModalWindow = window.open (strError,"ModalChild",
       "dependent=yes,width="+width+",height="+height+",top="+y+",left=160,screenX=160,screenY="+y)
    winModalWindow.focus()
  }
}

function HandleFocus()
{
  if (winModalWindow)
  {
    if (!winModalWindow.closed)
    {
      winModalWindow.focus()
    }
    else
    {
      window.top.releaseEvents (Event.CLICK|Event.FOCUS)
    }
  }
  return false
}

var strDownloadUrl = "/Download";
var strActiveXHTML = '<OBJECT height="40" width="410" ID="MsnMessengerSetupDownloadControl" CLASSID="CLSID:B38870E4-7ECB-40DA-8C6A-595F0A5519FF" codebase="../download/MsnMessengerSetupDownloader.cab#version=1,0,0,3" VIEWASTEXT><PARAM name="Url" value=""></OBJECT>';
function LaunchDownload(){location.href=strDownloadUrl;}

strUrlExtension = '?'; strHost = "messenger.msn.fr"; strBaseUrl = ""; strLcid = ""; fBrowser = true; value = ''; emailId = ""; 
