//判断cookie是否开启
var cookieEnabled=(navigator.cookieEnabled)? true : false
//如果浏览器不是ie4+或ns6+
if (typeof navigator.cookieEnabled=="undefined" && !cookieEnabled)
{ 
	document.cookie="testcookie"
	cookieEnabled=(document.cookie=="testcookie")? true : false
	document.cookie="" //erase dummy value
}
function GetCookie(name)
{
     var arg=name+ "=";
     var alen=arg.length;
     var clen=document.cookie.length;
     var i=0;
     while (i<clen) {
       var j=i+alen;
       if(document.cookie.substring(i,j)
       ==arg)
       return getCookieVal(j);
       i=document.cookie.indexOf("",i)+1;
       if(i==0)break;
     }
     return null;
}
function getCookieVal(offset) {
     var endstr=document.cookie.indexOf
       (";",offset);
     if(endstr==-1) //没有指定其他元素
       endstr=document.cookie.length;
     return unescape(document.cookie.substring
       (offset,endstr));
   }
function Get()
{			
	if (cookieEnabled)
	{		
		var CookieArea = GetCookie('zz_area');
		//var CookieArea = "CNC";
		if (CookieArea == "CNC")
		{		
			document.getElementById('loading').style.display='';				
			document.getElementById('setarea').style.display='none';				
			this.location = "http://w1.syjiajiao.cn/sy";
		}
		else
		{
			//判断电信线路
			if (CookieArea == "TEL")
			{
				document.getElementById('loading').style.display='';				
				document.getElementById('setarea').style.display='none';				
				this.location = "http://w1.syjiajiao.cn/sy";
			}
			else
			{
				if (CookieArea == "UNN")
				{
					document.getElementById('loading').style.display='';				
					document.getElementById('setarea').style.display='none';				
					this.location = "http://w1.syjiajiao.cn/sy";
				}
				else
				{
					document.getElementById('setarea').style.display='';
				}
			}
		}
	}
	else
	{		
		this.location = "http://w1.syjiajiao.cn/sy";
	}
}
function SetCNC()
{
	var mydate = new Date();
	mydate.setTime(mydate.getTime() + 315360000000);
	document.cookie = "zz_area=CNC;expires="+ mydate.toGMTString() + ";domain=syjiajiao.cn";
	Get();
}
function SetTEL()
{
	var mydate = new Date();
	mydate.setTime(mydate.getTime() + 315360000000);
	document.cookie = "zz_area=TEL;expires=" + mydate.toGMTString() + ";domain=syjiajiao.cn";
	Get();
}
function SetUNN()
{
	var mydate = new Date();
	mydate.setTime(mydate.getTime() + 315360000000);
	document.cookie = "zz_area=UNN;expires=" + mydate.toGMTString() + ";domain=syjiajiao.cn";
	Get();
}