
var activex = ((navigator.userAgent.indexOf('Win')  != -1) && (navigator.userAgent.indexOf('MSIE') != -1) && (parseInt(navigator.appVersion) >= 4 ));
var CantDetect = ((navigator.userAgent.indexOf('Safari')  != -1) || (navigator.userAgent.indexOf('Opera')  != -1));

function oopsPopup() {    
    if(confirm("系统检测到您未安装mTalk客户端\n建议您马上下载mTalk客户端\n体验超清晰语音通讯")){
//        var windowName = "oops";
//        oopswindow = window.open(windowName);
        location.href="http://download.mtalk.com.cn/download/mtalk.exe";
    }
    else{
//        var URLtoOpen = "http://www.mtalk.com.cn/download.jsp";
        alert("您取消了下载mTalk客户端.");
//        oopswindow = window.open(URLtoOpen);
    }
return false;
}

if(typeof(detected) == "undefined" && activex) {
    document.write(               
        ['<script language="VBScript">',
        'Function ismtalkInstalled()',
        'on error resume next',
        'Set omtalk = CreateObject("AddrBook.mTAddrBookItem.1")',
        'ismtalkInstalled = IsObject(omtalk)',
        'Set omtalk = nothing',
        'End Function',
        '</script>'].join("\n")
    );
}

function mtalkCheck() {
    if(ismtalkInstalled()) {
        detected = true;
        return true;
     	}
		else{
        detected = true;
        return oopsPopup();
      }  
}

