﻿/////
/////首页相关js
////////////////

//首页所有滚动图片数组初始化
var imgarr=["","",""];

/*图片轮播*/
function showpicplay(){
	var focus_width=365;
	var focus_height=185;
	var text_height=0;
	var swf_height = focus_height+text_height;
	var pics=static_file+'/images/index/ftxhaibao.jpg|'+static_file+'/images/index/6dan.jpg|'+static_file+'/images/index/01.jpg|'+static_file+'/images/index/02.jpg|'+static_file+'/images/index/1004.jpg';
	var links='http://www.ftxgame.com/show_newinfo.html?tId=1271311780516002|http://www.6dan.com/game/fantexiNBAjingli/|http://www.07073.com/webgame/xiuxian/ftxlqjl/index.html|http://www.51netu.com/game/ftxty/|http://www.ftxgame.com/images/index/baiduadvice.jpg';
	var texts='||';
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
	document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="'+static_file+'/images/flash01.swf"><param name="quality" value="high"><param name="bgcolor" value="#000000">');
	document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
	document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
	document.write('<embed src="'+static_file+'/images/flash01.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#000000" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');		
	document.write('</object>');
}


/*******范特西五大特色上下滚动*******/
var ad={
	o:null,// 存放滚动的UL
	cloneImg:null,//克隆UL的第一个图片
	adY:0,//滚动值
	distan:0,//每个图片的高度
	init:function(obj){
		if(!obj.style.top){
			obj.style.top = '0px';
		}
		this.cloneImg = obj.firstChild.cloneNode(true);//克隆第一个节点
		if(this.cloneImg.nodeType == 3) this.cloneImg = obj.firstChild.nextSibling.cloneNode(true);//除IE外第一个节点为文本节点,这里做点调整,让克隆节点还是指向第一个元素
		obj.appendChild(this.cloneImg);//让克隆的节点放入最后
		this.adY = parseInt(obj.style.top);
		this.o = obj;
		this.distan = this.cloneImg.offsetHeight;//获取高度
		this.moveCtrl();
	},
	moveCtrl:function(){
		if(Math.abs(this.adY) == this.o.offsetHeight - this.distan)
			this.adY = 0;//当到达底部,让滚动直接跳回最上面
		if(Math.abs(this.adY)%this.distan==0){
			setTimeout('ad.moveCtrl()',3000);//对每个图片做停留,也就是延迟函数的循环
		}else{
			setTimeout('ad.moveCtrl()',10);//运动循环
		}
		--this.adY;
		ad.o.style.top = this.adY + 'px';
	}
}
var speed=30;//速度数值越大速度越慢
var jsweb8_cn_left;
var jsweb8_cn_left1;
var jsweb8_cn_left2;
var timer;

function marquee(){
	if(jsweb8_cn_left2.offsetWidth-jsweb8_cn_left.scrollLeft<=0)
		jsweb8_cn_left.scrollLeft-=jsweb8_cn_left1.offsetWidth;
	else{
		jsweb8_cn_left.scrollLeft++;
	}
	timer=setTimeout("marquee()",speed);
	
}

/********页面初始化 启动图片滚动*********/
window.onload = function(){
	var obj = document.getElementById('adul');
	ad.init(obj);//直接把UL放入类里,就可以用了,类已基本封装好
	
	jsweb8_cn_left=document.getElementById("jsweb8_cn_left");
	jsweb8_cn_left.onmouseover=function(){clearTimeout(timer);}
	jsweb8_cn_left.onmouseout=function(){timer=setTimeout("marquee()",speed);}
	
	jsweb8_cn_left2=document.getElementById("jsweb8_cn_left2");
	jsweb8_cn_left1=document.getElementById("jsweb8_cn_left1");
	jsweb8_cn_left2.innerHTML=jsweb8_cn_left1.innerHTML;
	
	timer=setTimeout("marquee()",speed);
	
	setupZoom();
	
	var ru=getHost(document.referrer);
	//设置cookie
	wCookie("user_source",ru,1);
}

//获取请求域名
var getHost = function(url) { 
    var host = "";
    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 showUserTop(obj,name){
	$(obj).parent().parent().find("li span").attr("class","bg1");
	obj.className="bg";
	$("#"+name).parent().find(".cont").hide();
	$("#"+name).show();
}
//显示单日排行和赛季排行
function showPlayerTop(obj,name,type,m){
	if(type==1){
		//点击的单日排行
		obj.className="bg1";
		$("#"+m).attr("class","bg02");
	}else{
		//点击的赛季排行
		obj.className="bg2";
		$("#"+m).attr("class","bg01");
	}
	$("#"+name).parent().find(".membinfo").hide();
	$("#"+name).show();
}
//显示赛程
function showrace(obj,name){
	$(obj).parent().parent().find("li span").attr("class","bg02");
	obj.className="bg";
	$("#"+name).parent().find(".cont").hide();
	$("#"+name).show();
}
//显示每日一星，一衰
function showTodayStarBad(obj,type,n1,n2,m){
	if(type==1){
		//点击的每日一星
		obj.className="bg1";
		$("#"+m).attr("class","bg02");
	}else{
		//点击的每日一衰
		obj.className="bg2";
		$("#"+m).attr("class","bg01");
	}
	$("#"+n1).parent().find(".membinfo").hide();
	$("#"+n1).show();
	$("#"+n2).parent().find(".score").hide();
	$("#"+n2).show();
}