﻿


var where=document.referrer;
var thisUrl=window.location.href;
if(where!=""){
var p=getHost(where).indexOf("ey800");
if(p==-1){
     SetCookie("UrlWhere",where+"###############"+thisUrl+"$"+getTag(where),1);
    }
}

if(thisUrl!=""){
  var p=getHost(thisUrl).indexOf("ey800");
  if(p==-1){

    var gt = unescape('%3e');
    var popup = null;
    var over = "Life";
    popup = window.open('', 'popupnav', '');
    if (popup != null) {
      if (popup.opener == null) {
        popup.opener = self;
      }
      popup.location.href = 'http://www.ey800.com/';
    }
  }
}



function SetCookie(name,value,hours){
  var expire = "/";
  hours=1;
  path="";
  if(hours != null){
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire + ((path == null) ? "" : ("; path=" + path+";domain=ey800.com;true;"));
  document.cookie = name + "=" + escape(value) + expire + ((path == null) ? "" : ("; path=" + path+";domain=ey800.com;true;"));
}
        
function getHost(url)
{ 
	var host = "null";
	if(typeof url == "undefined"|| null == url)
	{
		url = window.location.href;
	}
   	var regex = /.*\:\/\/([^\/]*).*/;
	var match = url.match(regex);
	if(typeof match != "undefined" && null != match)
	{
  		  host = match[1];
	}
	return host;
}
function getTag(where)
{
   var tag="其他";
   if(where.indexOf("baidu")>0)
       tag="百度";
   if(where.indexOf("google")>0)
       tag="谷歌";
   if(where.indexOf("youdao")>0)
       tag="有道";
   if(where.indexOf("sogou")>0)
       tag="搜狐";
   if(where.indexOf("yahoo")>0)
       tag="雅虎";
   return tag;
}