﻿
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,td){
        var cus=realOffset(td);
        var cur=MyCursor.get(evt);
        obj.style.top= (cus.y + 25) + 'px';
        obj.style.left=(cur.x-obj.clientWidth/2) + 'px';
        obj.style.visibility='visible';
    }
	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.pkhistory=function(v){
        var pk=$('pk1');pk.value=v;pk.parentNode.submit();
    };
    this.hdetail=function(){_detail.style.visibility='hidden';};
    this.showdetail=function(mid,evt,td){
		if(!_isshow){return;}
		_d.hideodds1();
		d_show(mid);
		showfwin(_detail,evt,td);
			
    };
	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(mid,td,evt){
		if(!_isshow){return;}
		clearTimeout(_out_odds);
		o_show(mid);
		var cus=realOffset(td);
		_odds.style.top= (cus.y+10) + 'px';
		_odds.style.left=(cus.x + td.clientWidth -20) + 'px';
		_odds.style.visibility='visible';

    };
	this.showodds1=function(){
		clearTimeout(_out_odds);
	};
    this.leagueinit=function(){
        var tbody=$('dleaguebody');
    };
    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);
		}
    };
_ibo.style('blue');
  function init_fontsize(o){
		if(o=='small'){
			$('tfont_small_2').checked=$('tfont_small').checked=true;
		}else{
			$('tfont_big_2').checked=$('tfont_big').checked=true;
		}
	}
    this.tablestyle=function(name){tablestyle(name);MyCookie.set('tablestyle',name,_day);};
   this.fontsize=function(name){fontsize(name);MyCookie.set('fontsize',name,_day);init_fontsize(name);}
    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');if(name){ tablestyle(name); obj=$('tstyle_'+name);if(obj){obj.checked=true;}}
        name=MyCookie.get('fontsize')||'small';init_fontsize(name);fontsize(name);
        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); }
}    

