﻿// JScript 文件
var objMessengerActiveP4;
function SetCookie(strCookieName,strCookieValue,strExpireDate)
{
    var strExpires;
    if(strExpireDate=="session")
    {
        strExpires="";
    }
    else
    {
        if(strExpireDate)
            strExpires=";expires="+strExpireDate;
        else
            strExpires=";expires="+(new Date( (new Date()).getTime() + 1000 * 60 * 60 * 24 )).toGMTString();//new Date(2021,10,4).toGMTString();
    }
    document.cookie=strCookieName+"="+escape(strCookieValue)+strExpires+";path=/";
}
function IMThis(appID)
{  
	SetCookie('AppAPIID', appID, "session");
	//SetCookie('UrlThis',DeleteComment("http://campaign.msn.com.cn/school/p4/p4.html"));
    //SetCookie('TitleThis',document.title);
 
    CheckMessenger();//检测msn版本
    if( objMessengerActiveP4 != null) objMessengerActiveP4.LaunchApp(appID, '');//App ID需申请
    else
     alert('未登录');
}
 
function CheckMessenger(){
    this.gid=function(i){return document.getElementById(i);};
    try 
    { 
        objMessengerActiveP4 = new ActiveXObject("MSNMessenger.P4QuickLaunch");
    } 
    catch(e)
    {
        if(!gid("noMSNImDiv"))
        {
            noMSNImDiv=document.createElement("div");
            noMSNImDiv.setAttribute("id","noMSNImDiv");
            contentContainer=document.createElement("div");
            noMSNImDiv.appendChild(contentContainer);
        }
        else
        {
        gid("noMSNImDiv").style.display="block";
        };
        noMSNImDiv.className="floatBox";
        contentContainer.className="floatBoxContent";
        contentContainer.innerHTML="<div class='floatBoxHead'><span onmouseover='document.body.style.cursor=\"pointer\"' onmouseout='document.body.style.cursor=\"auto\"' onclick='document.getElementById(\"noMSNImDiv\").style.display=\"none\"'>[x]</a></div>对不起，您当前的配置不支持此功能.<br>要求安装 Messenger6.0 或以上版本及 IE5.5 或以上版本.<br><a href='http://www.windowslive.cn' style='color:black;text-decoration:underline'  target='msnwin'>立即安装 Windows Live Messenger！</a><br><br>";
        dt=gid("P4_IMToolbar");
        dt.appendChild(noMSNImDiv);
        objMessengerActiveP4 = null;
    }
}
