﻿function getIpIsCH()
{       
        CreateAjax();
        if(request)
        {
            var url = "getIp.aspx";
            request.open("GET",url,true);
            request.onreadystatechange = isCh;
            request.send(null);       
         }     
}
function isCh()
{
     if(request.readyState == 4)
    {  
    
       if(request.status == 200) 
        {  
        
            if(request.responseText.length > 0) 
            {
                if(request.responseText != "true") //表示不是中国的IP
                {
		    //alert("非中国");
                    window.location.href= "http://www.handseeing.com/en/";
                }
		else{
			//alert("中国");
			}        
            }
        }
    }
}
function CreateAjax()
{
    try{
        request = new XMLHttpRequest();
    }
    catch(trymicrosoft)
    {
        try{
            request = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch(othermicrosoft)
        {
            try{
                request = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(failed)
            {
                request = false;
            }
        }
    }
 }
 getIpIsCH();
