var xmlHttp ;
function createXMLHttpRequest() 
{
 if(window.ActiveXObject) 
 {
  xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
 }
 else if(window.XMLHttpRequest) {
  xmlHttp = new XMLHttpRequest();
 }
}
function startRequest() 
{
 createXMLHttpRequest();
 var url = "recive_js_info.php";
 xmlHttp.onreadystatechange = handleStateChange;
 xmlHttp.open("GET",url,true);
 //禁止IE缓存
 xmlHttp.setRequestHeader("If-Modified-Since","0");
 xmlHttp.send(null);
 setTimeout("startRequest()",1000);
}
function handleStateChange() 
{
 if(xmlHttp.readyState == 1) 
 {
if(document.getElementById("weather")!=null){
  document.getElementById("weather").innerHTML = "";
 }}
 else if(xmlHttp.readyState == 2) 
 {
if(document.getElementById("weather")!=null){
  document.getElementById("weather").innerHTML = "";
 }}
 else if(xmlHttp.readyState == 4) 
 {
  if(xmlHttp.status == 200) 
  {
if(document.getElementById("show")!=null){
if(xmlHttp.responseText==0){
document.getElementById("show").innerHTML = '';
}else{
document.getElementById("show").innerHTML = xmlHttp.responseText;
}}
if(document.getElementById("top_info")!=null){
if(xmlHttp.responseText==0){
document.getElementById("top_info").innerHTML = '';
}else{
document.getElementById("top_info").innerHTML = "收到<a href=my_information.php class=lf>"+xmlHttp.responseText+"</a>";
}}
if(document.getElementById("top1_info")!=null){
if(xmlHttp.responseText==0){
document.getElementById("top1_info").innerHTML = '';
}else{
document.getElementById("top1_info").innerHTML = "收到<a href=my_information.php class=lf>"+xmlHttp.responseText+"</a>";
}}
   if(document.getElementById("show_info")!=null){
	    if(xmlHttp.responseText==0){
  document.getElementById("show_info").innerHTML = "您最近还有没收到新信息";
		  }else{
   document.getElementById("show_info").innerHTML = "您收到了<a href=my_information.php>"+xmlHttp.responseText+"</a>条信息";
  }}}
  else
  {
if(document.getElementById("weather")!=null){
   document.getElementById("weather").innerHTML = "";
}
  }
 } 
 else
 {
if(document.getElementById("weather")!=null){
  document.getElementById("weather").innerHTML = ""; 
 }}
}

window.onload=function(){
startRequest();
}
