var urlstr = location.href;
var newurl = num_to_str("858295782393889388943323768886");
//live.totouw.com
//var newurl = num_to_str("858295782393889388949623768886");

if (urlstr.indexOf("live.totou.com")!=-1){
  urlstr = urlstr.replace("live.totou.com", newurl);
  location.replace(urlstr);
}else if (urlstr.indexOf("live.totouw.com")!=-1){
  urlstr = urlstr.replace("live.totouw.com", newurl);
  location.replace(urlstr);
}else if (urlstr.indexOf("live.totou.net")!=-1){
  if (top==self){
    urlstr = urlstr.replace("live.totou.net", "www.totou.net");
    location.replace(urlstr);
  }
}

var liveserver1 = num_to_str("858295782393889388943323768886");
var liveserver2 = num_to_str("85829578272393889388943323768886");
var liveservers='<a href="http://'+liveserver1+'/" target="_top" class=td_team>服务器(主)：'+liveserver1+'</a><br><br><a href="http://'+liveserver2+'/" target="_top" class=td_team>服务器(辅)：'+liveserver2+'</a><br>';

function num_to_str(num) {
  var str_out = "";
  var num_in;
  for(i = 0; i < num.length; i += 2) {
    num_in = parseInt(num.substr(i,[2])) + 23;
    num_in = unescape('%' + num_in.toString(16));
    str_out += num_in;
  }
  return str_out;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function showgoallist(ID)
{
	window.open("http://web.totou.com/scores/detail/"+ID+".htm", "","top="+(screen.availHeight-486)/2+",left="+(screen.availWidth-420)/2+",scrollbars=yes,resizable=no,width=420, height=485");
}
function analysis(ID)
{
	var theURL="http://live.totou.com/jsp/data.jsp?dId=" + ID;
	window.open(theURL, "","top=0,left=0,scrollbars=yes,resizable=yes,width=800, height=600");
}
function AsianOdds(ID)
{
	var theURL="http://live.totou.com/jsp/odds.jsp?aId=" +ID;
	window.open(theURL, "","width=620,height=560,top=20,left=90,resizable=yes,scrollbars=yes");
}

function EuropeOdds(path){
   var theURL="http://web.totou.com/odds/1x2/"+path+".html";
   window.open(theURL,null,"height="+screen.availHeight+",width="+screen.availWidth+",scrollbars=yes,resizable=yes");
}

function InfoWin(path){
   var theURL="http://web.totou.com/info/"+path+".htm";
   window.open(theURL,null,"height="+screen.availHeight+",width="+screen.availWidth+",scrollbars=yes,resizable=yes");
}

function HistoryWin(path){
   var theURL;
   if (path!=""){
       theURL="http://web.totou.com/info/history/"+path+".htm";
   }else{
       theURL="http://web.totou.com/null.html";
   }
   window.open(theURL,null,"height="+screen.availHeight+",width="+screen.availWidth+",scrollbars=yes,resizable=yes");
}

function setBgColor(the,i)
{
	if (i % 2 == 0)
	{
		the.style.backgroundColor="#FFB3FF";
	}else
	{
		the.style.backgroundColor="#BBFFBB";
	}
	
}

function clearBgColor(the)
{
	the.style.backgroundColor="";
}

function selBgColor(){
  window.open("colorpicker.html","","height=240,width=232,status=no,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,top="+(screen.availHeight-300)/2+",left="+(screen.availWidth-230)/2+"");
}

function ChgLang(){
  var langs = langform.langSelect;
  var str = "0";
  for(var i=0;i<langs.length;i++){
    if (langs[i].checked){
      str = langs[i].value;
      break;
    }
  }
  location.replace("?"+str);
}

function ChgOdds(){
  var oddss = oddsform.oddsSelect;
  var str = "0";
  for(var i=0;i<oddss.length;i++){
    if (oddss[i].checked){
      str = oddss[i].value;
      break;
    }
  }
  var lValue = "1";
  var ustr = location.href;
  if (ustr.indexOf("?0") > 0){
    lValue = "0";
  }else{
     if (ustr.indexOf("?2") > 0){
       lValue = "2";
     }
  }
  switch (str) {
    case "0" :
       location.replace("index.html?"+lValue);
       break;
    case "1" :
       location.replace("index1.html?"+lValue);
       break;
    case "2" :
       location.replace("index2.html?"+lValue);
       break;
    case "3" :
       location.replace("index3.html?"+lValue);
       break;
    case "5" :
       location.replace("index5.html?"+lValue);
       break;
    default :
       location.replace("index.html?"+lValue);
  } 
  //location.replace("index"+str+".html?"+lValue);
}

var zXml = {
    useActiveX: (typeof ActiveXObject != "undefined"),
    useXmlHttp: (typeof XMLHttpRequest != "undefined")
};

zXml.ARR_XMLHTTP_VERS = ["MSXML2.XmlHttp.6.0","MSXML2.XmlHttp.3.0"];

function zXmlHttp() {}

zXmlHttp.createRequest = function ()
{
    if (zXml.useXmlHttp)  return new XMLHttpRequest(); 

    if(zXml.useActiveX)  //IE < 7.0 = use ActiveX
    {  
        if (!zXml.XMLHTTP_VER) {
            for (var i=0; i < zXml.ARR_XMLHTTP_VERS.length; i++) {
                try {
                    new ActiveXObject(zXml.ARR_XMLHTTP_VERS[i]);
                    zXml.XMLHTTP_VER = zXml.ARR_XMLHTTP_VERS[i];
                    break;
                } catch (oError) {}
            }
        }        
        if (zXml.XMLHTTP_VER) return new ActiveXObject(zXml.XMLHTTP_VER);
    } 
    alert("对不起，您的电脑不支持 XML 插件，请安装好或升级浏览器。");
};

function addFavorite(){
  window.external.addFavorite("http://live.totou.com/", "透透比分 - 足球比分,角球比分,专业比分直播网 live.totou.com live.totouw.com");
}