﻿// JScript 文件
    document.write("<object height='0' id='MsgrObj' width='0'></object>");
    function MySendIM(person)
    {
        var MsgrObj = document.getElementById("MsgrObj");
        //Check if person has messenger installed
        try{MsgrObj.classid="clsid:B69003B3-C55E-4B48-836C-BC5946FC3B28";}
        catch(e){if(!(e.number && 2148139390) == 2148139390)return;}
        try{
            //Check if you are logged in
            if(MsgrObj.MyStatus == 1)
            {
                alert("You are not logged into Messenger.");
                return;
            }
            MsgrObj.InstantMessage(person);
        }
        catch(e)
        {
        }
    }

    function MyAddToContacts(person)
    {
        //Check if person has messenger installed
        try{MsgrObj.classid="clsid:B69003B3-C55E-4B48-836C-BC5946FC3B28";}
        catch(e){if(!(e.number && 2148139390) == 2148139390)return;}

        //Check if you are logged in
        if(MsgrObj.MyStatus == 1)
        {
            alert("You are not logged into Messenger.");
            return;
        }

        //Check if person is already in contact list
        try{var contact = MsgrObj.GetContact(person,"");}
        catch(e)
        {
            if((e.number && 2164261642) == 2164261642) //MSGR_E_USER_NOT_FOUND
            {
                MsgrObj.AddContact(0,person);
                return
            }
        }

        alert("That person is already in your contact list!");
    }
