﻿

//============================检查浏览器*start========================================
//设置允许的浏览器
var G_browsers=new Array(
"MSIE 6.0",
"MSIE 7.0",
"MSIE 8.0")


function checkBrowser()
{
    var userAgent=navigator.userAgent;
    var canUse=false;
    for(var i=0;i<G_browsers.length;i++){
        if(userAgent.indexOf(G_browsers[i])>-1){
            canUse=true;
            break;
        }
    }
    //if(navigator.userAgent.indexOf("MSIE 7.0") == -1 && navigator.userAgent.indexOf("MSIE 6.0") == -1 && navigator.userAgent.indexOf("MSIE 8.0") == -1){
    if(!canUse){
        location.replace("checkBrowser.aspx");
        return;
    }
    
    if(Detect())
    {
      alert("您的网页开启或者安装了 [拦截弹出窗口] 程序，可能会对 [建造师系统] 使用产生影响，\r\n请您最好先关闭 [拦截弹出窗口] 程序，然后进入系统！");
    }  
}
//检查是否允许弹出窗口
function Detect()
{
	var e = false;
	var pw1 = null;
	var pw2 = null;
	try
	{
		do
		{
			var d = new Date();
			var wName = "ptest_" + d.getTime();
			var testUrl ="checkwinopen.htm";
			pw1 = window.open(testUrl,wName,"width=0,height=0,left=5000,top=5000",true);
		    
			if (null == pw1 || true == pw1.closed)
			{
				e = true;
				break;
			}			
			pw1.close();
			pw1 = null;
		}
		while(false);
	}
	catch(ex)
	{
		e = true;
	}
	if (null != pw1)
	{
		try { if (!pw1.closed) pw1.close(); } catch(ex){}
	}
	return e;
}
//============================检查浏览器*end========================================