﻿
function jt_8bo_data(){
    var _day=10000;
    var _odds,_out_odds;
    var _detail;
    var _spop = null;
    var _poplayer=null;
	var _isshow=true;
	var _isie=document.all;
	var _poptid=0;
    function $(id){ return document.getElementById(id);}
    function tablestyle(name){$('dd').className=name;}
    function fontsize(name){$('dm').className='ma '+name;}
    function showfwin(obj,evt){
        var cur=MyCursor.get(evt);
        obj.style.visibility='visible';
        obj.style.top= (cur.y + 10) + 'px';
        obj.style.left=(cur.x-obj.clientWidth/2) + 'px';
    }
    function pkcolor(color){
        var cs=document.createStyleSheet;
        if(cs){
            cs=document.createStyleSheet();
            cs.cssText='.d .sbs{ color:'+color+';}';
        }else{
            cs=$('_pkcolor');if(!cs){cs=document.createElement('style');cs.id='_pkcolor';cs.type='text/css'; document.getElementsByTagName('head')[0].appendChild(cs);}
            cs.innerHTML='.d .sbs{ color:'+color+';}';
        }
    }
	function realOffset(o){
	  var x = y = 0; 
	  do{
	  x += o.offsetLeft || 0;
	  y += o.offsetTop  || 0;
	  o  = o.offsetParent;}while(o);
	  return {"x" : x, "y" : y};
	}
    this.hidematch=function(v){
        //hidematch(v);
    };
    this.state=function(v){
        //ShowMatchByMatchState(v);
    };
    this.league=function(v){
        //CheckLeague(v);
    };
    this.pkcolor=function(color){ pkcolor(color); MyCookie.set('pkcolor',color,_day);};
    this.rankopen=function(obj){
        var v = $("myd").getElementsByTagName("code");
        var visible = "visible";if(obj.innerHTML=='关闭球队排名'){obj.innerHTML='开启球队排名';visible="hidden";}else{obj.innerHTML='关闭球队排名';}
        for (var i = 0; i < v.length; ++i){v[i].style.visibility = visible;}

    };
    this.pkhistory=function(v){
        var pk=$('pk1');pk.value=v;pk.parentNode.submit();
    };
    this.hdetail=function(){_detail.style.visibility='hidden';};
    this.showdetail=function(id,evt){
		if(!_isshow){return;}
		_d.hideodds1();
        showfwin(_detail,evt);
    };
    this.showgoal=function(v){
        //showgoallisthtml(v);
    };
    this.leagueinit=function(){
        var tbody=$('dleaguebody');
    };
	this.moveodds=function(evt){
		clearTimeout(_out_odds);
		var mos =MyCursor.get(evt);
		if(_odds.y==mos.y){return;}
		_odds.y=mos.y;
		_odds.style.top=(mos.y -10) + 'px';
	};
	this.hideodds1=function(){/*_odds.style.display='none';*/_odds.style.visibility='hidden';};
    this.hideodds=function(){_out_odds=setTimeout("_d.hideodds1();",90);};
    this.showodds=function(id,td,evt){
		if(!_isshow){return;}
		clearTimeout(_out_odds);
		
		var cus=realOffset(td);
		_odds.style.top= (cus.y+5) + 'px';
		_odds.style.left=(cus.x + td.clientWidth -20) + 'px';
		_odds.style.visibility='visible';
    };
	this.showodds1=function(){
		clearTimeout(_out_odds);
	};
    this.closetxtad=function(obj){/*obj.parentNode.parentNode.style.display='none';*/ _ibo.bindtablead(obj); };
	this.poplayershow=function(){clearTimeout(_poptid); _poplayer.style.visibility="visible";};
  	this.poplayerhide=function(){_poptid=setTimeout('_d.poplayerclose();',200);};
	this.poplayerclose=function(){_poplayer.style.visibility="hidden";};
    this.showpop=function(event) {
        var o;
	    if(event.srcElement){ o = event.srcElement;}else{ o = event.target;}
		if(!o.init){
			var alt=o.getAttribute('myalt');
			if(alt) {o.pop=alt;o.removeAttribute('myalt'); }
			o.init=true;
		}
	    if(o.pop!=_spop) {
		    _spop=o.pop;
		    if(_spop) {
			    this.poplayershow();
		        var mos=MyCursor.get(event);
				var cus=realOffset(o);
	            _poplayer.innerHTML=_spop.replace(/\^br/g,"<br />");
	            _poplayer.style.left=(mos.x-_poplayer.clientWidth/2)+"px";
	            _poplayer.style.top=(cus.y-_poplayer.clientHeight)+'px';//(mos.y-_poplayer.clientHeight-11)+"px";
				_poplayer.pop=_spop;
		    } else {
			    this.poplayerhide();        
		    }
	    }else if(o.pop){
			clearTimeout(_poptid);
		}
    };
    this.tablestyle=function(name){tablestyle(name);MyCookie.set('tablestyle',name,_day);};
    this.fontsize=function(name){fontsize(name);MyCookie.set('fontsize',name,_day);}
	this.selstart=function(){ _isshow=false;};
	this.selend=function(){_isshow=true;}
    this.init=function(){
        _odds=$('oddswindow');
        _detail=$('detailwindow');
        _poplayer=$('fpoplayer');
		_poplayer.onmouseover=function(){_d.poplayershow();};
		_poplayer.onmouseout=function(){_d.poplayerhide();};
		_poplayer.onmouseup=function(e){if(!e){e=window.event;} if(e.button==2){this.onmouseout=function(){};}};
        var name='';
        var obj;
        name=MyCookie.get('tablestyle')||'dtable';if(name){ tablestyle(name); obj=$('tstyle_'+name);if(obj){obj.checked=true;}}
        name=MyCookie.get('fontsize');if(name){ fontsize(name); obj=$('tfont_'+name);if(obj){obj.checked=true;}}
        name=MyCookie.get('pkcolor');if(name){ pkcolor(name); }
    };
    
    
}
var _d =new jt_8bo_data();


if(!document.onmouseover) {
    document.onmouseover = function(e) {_d.showpop(e?e:window.event); }
}    

/*
定义公司
*/
/*单式 */
var Com_name=new Array();
Com_name[1]="皇冠";
Com_name[2]="皇冠精简";
Com_name[3]="印尼";
Com_name[4]="马来";
Com_name[5]="澳门";
Com_name[6]="盈禾";


var Com_id=new Array();
Com_id[0]=1;
Com_id[1]=1;
Com_id[2]=100;
Com_id[3]=101;
Com_id[4]=102;
Com_id[5]=2;
Com_id[6]=14;


var PL_list=new Array();
PL_list[1]="1,1,1,1,1,1".split(","); // 单式 滚球 早餐 半全场 入球数 波胆
PL_list[2]="1,0,0,0,0,0".split(",");
PL_list[3]="1,1,1,0,0,0".split(",");
PL_list[4]="1,1,1,0,0,0".split(",");
PL_list[5]="1,0,0,0,1,1".split(",");
PL_list[6]="1,0,1,0,0,0".split(",");


var PL_listname=new Array();
PL_listname[0]="单式"; // 单式 滚球 早餐 半全场 入球数 波胆
PL_listname[1]="滚球";
PL_listname[2]="早餐";
PL_listname[3]="半全场";
PL_listname[4]="入球数";
PL_listname[5]="波胆";

var PL_listfile=new Array();
PL_listfile[0]="/"; // 单式 滚球 早餐 半全场 入球数 波胆
PL_listfile[1]="index_zd.html";
PL_listfile[2]="index_zc.html";
PL_listfile[3]="bqc.html";
PL_listfile[4]="rqs.html";
PL_listfile[5]="bd.html";


var areaary=new Array();
	areaary[1]="b2";
	areaary[2]="b3";
	areaary[14]="b6";



function schange(obj,url,count,dvalue){
		var v=obj.options[obj.selectedIndex].value;
		if(!v){return;}
		var arr=v.split(',');
		if(arr.length<count){
		    arr[arr.length]=dvalue;
		}
		
		for(var i=0;i<arr.length;i++){
		    url=url.replace('{'+i+'}',arr[i]);
		}
		window.open(url);
	};




