function getCookie(a){
	var b=a+"=";
	a=document.cookie.indexOf(b);
	if(a!=-1){a+=b.length;b=document.cookie.indexOf(";",a);if(b==-1)b=document.cookie.length;
	return 
	unescape(document.cookie.substring(a,b))
	}
	else return ""
}

//是否显示ie8升级提示
function showUpdateIE(){
    var userAgent=navigator.userAgent;
	var matchs=/(msie) ([\w.]+)/.exec(userAgent.toLowerCase());
	var showIE=false;
	var dotShowIE=getCookie('dotShowIE');
	if(dotShowIE){
	   showIE=false;
	}else{
	   showIE=true;
	}
	var system=getSystem();
	//检测是不是IE且小于ie8,且为WindowsXP_32
	//addService只有IE8才有的功能  
	if(matchs&&matchs[2]<8&&showIE&&system=="WindowsXP_32"&&(typeof (document.documentMode)=="undefined")){
	    document.getElementById("ieupdate").style.display = 'block' ;
	}
}

function closeUpdateIE(){
    document.getElementById("ieupdate").style.display = 'none' ;
	setWWWCookie("dotShowIE","Y",14*24) ;
}
function dotShowUpdateIE(){
    document.getElementById("ieupdate").style.display = 'none' ;
    setWWWCookie("dotShowIE","Y",1000*24);
    
}

function getSystem(){
   var userAgent=navigator.userAgent;
   var platform=/Win64|WOW64|x64/i.test(userAgent)?"64":"32";
   var matchs=/Windows NT ([\w.]+)/.exec(userAgent);
   var version=matchs[1].toString();
   var system="";
   if(version<6){
        system="WindowsXP";
   }else if(version.toString()=="6.0"){
        system="WindowsVista";
   }else if(version=="6.1"){
        system="Windows7";
   }else{
        system="WindowsXP";
   }
   return system+"_"+platform;
}

showUpdateIE();


function setWWWCookie(a,b,d){
	d=new Date((new Date).getTime()+d*36E5);document.cookie=a+"="+escape(b)+"; path=/; domain=www.xunlei.com; expires="+d.toGMTString()
	}