;(function(w){var checkOnline;var isConnect=false;var xmlhttp=new XMLHttpRequest(),time=2000,url="",OL=OL||{};OL={OL_api:{onLineHandler:function(func){onlinenetwork.online=func
  return this},offLineHandler:function(func){onlinenetwork.offline=func
  return this}},setStatus:function(newStatus){this.eventStatus(newStatus);w.onLine=newStatus;},eventStatus:function(newStatus){if(newStatus===true&&onlinenetwork.online!==undefined&&(w.onLine!==true||this.handlerFired===false)){onlinenetwork.online();}
  if(newStatus===false&&onlinenetwork.offline!==undefined&&(w.onLine!==false||this.handlerFired===false)){onlinenetwork.offline();}
  this.handlerFired=true;},XMLHttpLogic:function(async){var url=this.getOnLineCheckURL(),self=this;if(async){xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState===4){try{self.processXmlhttpStatus();}catch(err){self.setStatus(false);}}};}else{xmlhttp.onreadystatechange=undefined;}
  xmlhttp.open("HEAD",url,async)
  xmlhttp.setRequestHeader("If-Modified-Since","0");this.tryToSend(xmlhttp);},processXmlhttpStatus:function(){var tempOnLine=this.verifyStatus(xmlhttp.status);this.setStatus(tempOnLine);},tryToSend:function(xmlhttprequest){try{xmlhttprequest.send();}catch(e){this.setStatus(false);}},verifyStatus:function(status){return status===200;},getOnLineCheckURL:function(){return url+'?key='+Math.floor(Math.random()*1000000);},startCheck:function(){var self=this
  setInterval(function(){self.XMLHttpLogic(true)},time);},checkOnLine:function(){this.XMLHttpLogic(false)},getStatusFromNavigatorOnLine:function(){if(w.navigator.onLine!==undefined){this.setStatus(w.navigator.onLine);}else{this.setStatus(true);}},getExplorer:function(newStatus){var explorer=window.navigator.userAgent;this.setStatus(newStatus)
  console.log(explorer)
  console.log("url:"+url)},addEvent:function(obj,type,callback){},init:function(){var self=this
  this.addEvent(w,'load',function(){console.log("load====");self.eventStatus(w.onLine);});this.addEvent(w,'online',function(){console.log("online====");self.getExplorer(true)});this.addEvent(w,'offline',function(){console.log("offline====");self.getExplorer(false)});self.getExplorer(true)
  this.handlerFired=false;}}
  onlinenetwork=function(json){if(json){if(json.time)time=json.time;if(json.url)url=json.url;}
  OL.init()
  for(var a in OL.OL_api)this[a]=OL.OL_api[a];return this}
  w.onlinenetwork=onlinenetwork})(window);