<!--
var arycountry=["CHINA","UNITED STATES","SINGAPORE","HONG KONG","TAIWAN","MACAO","GERMANY","ITALY"];		//这些国家不能访问
var cookiename="countryofmysitewhy";  //cookie的名称
var glbcountry; //哪个国家的

//JS操作cookies方法!
//写cookies
function setCookie(name,value)
{
var exp = new Date(); 
exp.setTime(exp.getTime() + 1*60*60*1000);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
//读取cookies
function getCookie(name)
{
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
if(arr=document.cookie.match(reg)) return unescape(arr[2]);
else return null;
}
//删除cookies
function delCookie(name)
{
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval=getCookie(name);
if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}
//使用示例
//setCookie("name","hayden");
//alert(getCookie("name"));




//创建xmlhttp
function CreateHTTPObject()
{
    var xmlhttp;
    
    try
    {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e)
    {
        try
        {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (e)
        {
            xmlhttp = false;
        }
    }
    
    if (!xmlhttp && typeof XMLHttpRequest!='undefined')
    {
        try
        {
            xmlhttp = new XMLHttpRequest();
        }
        catch (e)
        {
            xmlhttp=false;
        }
    }
    
    if (!xmlhttp && window.createRequest)
    {
        try
        {
            xmlhttp = window.createRequest();
        }
        catch (e)
        {
            xmlhttp=false;
        }
    }
    
    return xmlhttp;
}


//使用全局变量 xmlhttp
function OnReadyStateChng()
{
    if (xmlhttp.readyState == 4)
    {
        if (xmlhttp.status == 200)
        {
			//  document.getElementById("board").innerHTML = xmlhttp.responseText; //处理完毕
			// glbcountry = xmlhttp.responseText;				//从网址上获取国家
			// setCookie(cookiename,glbcountry);
			 var strtemp = xmlhttp.responseText;				//从网址上获取国家
			 document.write(strtemp);
		//	 alert(xmlhttp.responseText);
			 var indexaaaaa=0;
		//	 alert(indexaaaaa);
			 indexaaaaa =strtemp.indexOf("<");
		//	 alert(indexaaaaa);
			 //glbcountry = strtemp.substring(0,index-1).replace(/(^\s*)|(\s*$)/g, "");
			 glbcountry = strtemp.substring(0,indexaaaaa-1);
	//		 alert(glbcountry);
			 setCookie(cookiename,glbcountry);
        }
        else
        {
          //  document.getElementById("board").innerHTML = "HTTP 错误，状态码：" + xmlhttp.status;
 //document.getElementById("board").innerHTML = xmlhttp.responseText;
        }
    }
}


//判断是不是要显示页面
function judgecountry()
{
	var arylength = arycountry.length;
	for(var i =0;i<	arylength ; i ++ )
	{
	//alert(glbcountry.indexOf(arycountry[i]));
		if (glbcountry.indexOf(arycountry[i])>=0)
		{
			return false;			//这个国家不显示页面
		}
	}
	return true;		//显示页面
}


//获取cookie
var glbcountry = getCookie(cookiename);
if (glbcountry==null)  //cookie为空，调用
{
	var xmlhttp = CreateHTTPObject();
	if (xmlhttp)
	{
		//xmlhttp.overrideMimeType('text/xml');
		xmlhttp.open("GET", "xmlhttp.aspx", false);
		xmlhttp.onreadystatechange = OnReadyStateChng;
		xmlhttp.send(null);
	//	alert('ccccc');
	}
}

//alert(judgecountry());
if(!judgecountry())		//该国家不显示
{
//	alert('fffffffffff');
	window.location.href='dnserror.htm';
}
-->

