var divch=0;
var fw = new Object();
var gd;
fw.Browser = {
	ie: /msie/.test(window.navigator.userAgent.toLowerCase()),
	moz: /gecko/.test(window.navigator.userAgent.toLowerCase()),
	opera: /opera/.test(window.navigator.userAgent.toLowerCase())
};
function dbwindowHeight() {
		var E = document.documentElement;
		return self.innerHeight || (E && E.clientHeight) || document.body.clientHeight;
	}
fw.$ = function(s)
{
	return (typeof s == 'object') ? s: document.getElementById(s);
};

fw.Element = {
	remove: function()
	{
		for (var i=0; i<arguments.length; i++)
		{
			try
			{
				fw.$(arguments[i]).parentNode.removeChild(fw.$(arguments[i]));
			}
			catch (e)
			{
			}
		}
	}
};

fw.JsLoader = {
	load: function(sUrl, fCallback)
	{
		fw.Element.remove(sUrl);
		var _script = document.createElement('script');
		_script.setAttribute('type', 'text/javascript');
		_script.setAttribute('id', sUrl);
		_script.setAttribute('src', sUrl);
		_script.setAttribute('charset', "gb2312");
		document.getElementsByTagName('head')[0].appendChild(_script);
		if (fw.Browser.ie)
		{
			_script.onreadystatechange = function()
			{
				if (this.readyState=='loaded' || this.readyState=='complete')
				{
					fCallback();
					fw.Element.remove(_script);
				}
			};
		}
		else if (fw.Browser.moz || fw.Browser.opera)
		{
			_script.onload = function()
			{
				fCallback();
				fw.Element.remove(_script);
			};

		}
		else
		{
			fCallback();
			fw.Element.remove(_script);
		}
	}

};

fw.load = function(t, i, o, m, d) {
    if (t == 0) {
        u = "players";
        f = "info.js";
    }
    else if (t == 1) {
        u = "teams";
        f = "tinfo.json";
    }
    else return;
    var myDate = new Date()
    //fw.JsLoader.load("http://worldcup.qq.com/d/"+u+"/"+Math.ceil(i/1000)+"/"+i+"/info.js?cache="+myDate.getHours(), function()
    fw.JsLoader.load("http://worldcup.qq.com/d/" + u + "/" + Math.ceil(i / 1000) + "/" + i + "/" + f + "?cache=" + Math.random(), function() {
        if (typeof winfo != "undefined") {

            if (divch == 0) {
                wh = dbwindowHeight();
                var newDiv = document.createElement("div");
                newDiv.id = 'newDiv';
                newDiv.style.position = "absolute";
                newDiv.style.zIndex = "9999";
                newDiv.style.width = "400px";
                newDiv.onmouseover = jtime;
                newDiv.onmouseout = Judge;
                newDiv.className = "wckey-tips";
                var h = 132;
                newDiv.style.height = "60px";
                var dbt = o.offsetTop;
                var dbl = o.offsetLeft;
                var ofH = o.offsetHeight;
                while (o = o.offsetParent) {
                    dbl += o.offsetLeft;
                    dbt += o.offsetTop;
                }
                var bt = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
                var b = wh - (dbt - bt) - ofH;
                if (b > h) h = dbt + ofH; else h = dbt - h;
                newDiv.style.top = h + "px";
                newDiv.style.left = "500px";
                newDiv.style.background = "#ebf2fa";
                newDiv.style.border = "solid 1px #4d637c";
                //newDiv.style.padding = "50px";

                if (t == 0) {
                    var ihtml = "";
                    ihtml += '<div class="box"><table width="400" align="left" border="0" cellspacing="0" cellpadding="0" class="gamer">';
                    //ihtml+='<tr><td width="60"></td>';
                    if (d == "") {
                        d = "最新通知";
                    }
                    ihtml += '<td>【' + d + '】&nbsp;' + m + '</td></tr>';
                    //ihtml+='<td>&nbsp;'+m+'</td></tr>';
                    ihtml += '</table></div>';


                } else {
                    var ihtml = "";
                    ihtml += '<div class="box"><table width="400" align="left" border="0" cellspacing="0" cellpadding="0" class="gamer">';
                    //ihtml+='<tr><td width="60"></td>';
                    if (d == "") {
                        d = "最新通知";
                    }
                    ihtml += '<td>【' + d + '】&nbsp;' + m + '</td></tr>';
                    //ihtml += '<td>&nbsp;' + m + '</td></tr>';
                    ihtml += '</table></div>';

                }
                newDiv.innerHTML = ihtml;

                document.body.appendChild(newDiv);
                divch = 1;
            }

        } else {
            return;
        }
    });
};

var db_gtime=null;
var docEle = function() {
return document.getElementById(arguments[0]) || false;
};
var jtime=function()
{
clearTimeout(db_gtime);
};
function openNewDiv(o,t,i,m,d) 
{
//t 0球员 1球队 2赛程
if (docEle('newDiv')) document.body.removeChild(docEle('newDiv'));
divch=0;
clearTimeout(db_gtime);
fw.load(t,i,o,m,d);
//setTimeout(function(){fw.load(t,i,o);},2);
};
function delDiv() {
        if (docEle('newDiv')) document.body.removeChild(docEle('newDiv'));
        divch=0;
};
function Judge(){
        db_gtime=setTimeout(delDiv,200);
}/*  |xGv00|295870ba552066345eb4815821b4836b */
