
var Tab = function(h,con,m,fn){
	this.h=$(h);
	this.con=$(con);
	this.method = m;	
	this.n;
	this.init(fn);
}
Tab.prototype = {
      init:function(fn){
		var _this = this;
		this.h.eq(0).addClass('curr')
		this.con.hide().eq(0).show();
		this.h.bind(this.method,function(){			
			_this.n=_this.h.index($(this));
			_this.h.removeClass('curr');
			$(this).addClass('curr');
			_this.con.hide().eq(_this.n).show();	
			if(fn){
				fn();		
			}					
			return  false;
		});		
	},
	getVIndex:function(){	
		return this.h.index(this.h.siblings('a.curr'))
	}	
}

function  txt_slide(id,w,n){

	var box=document.getElementById(id),can=true,w=w||1500,fq=fq||10,n=n==-1?-1:1;	
	if(box.getElementsByTagName('li').length>2){		
		box.innerHTML+=box.innerHTML;
		box.onmouseover=function(){can=false};
		box.onmouseout=function(){can=true};
		var max=parseInt(box.scrollHeight/2);
		new function (){
			
			var stop=box.scrollTop%33==0&&!can;
			if(!stop){
				var set=n>0?[max,0]:[0,max];
				box.scrollTop==set[0]?box.scrollTop=set[1]:box.scrollTop+=n;
			};
			setTimeout(arguments.callee,box.scrollTop%33?fq:w);
		};
	};
};


	
function Lb(obj,url){
	this.url = url?url:'http://xt.ztgame.com/swf/xt_110829_03.flv';
	this._obj=obj;
	this.alertBox();
	this.str='<object type="application/x-shockwave-flash" data="/player/vcastr3.swf" width="544" height="404" id="vcastr3" wmode="opaque" ><param name="movie" value="/player/vcastr3.swf" /><param name="allowFullScreen" value="true" /><param name="wmode" value="opaque" /><param name="FlashVars" value="xml=<vcastr><channel><item><source>'+url+'</source><duration></duration><title></title></item></channel><config><controlPanelBgColor>0x000000</controlPanelBgColor><buffertime>4</buffertime><contralpanelalpha>0.75</contralpanelalpha><controlpanelbgcolor>0xff6600</controlpanelbgcolor><controlpanelbtncolor>0xffffff</controlpanelbtncolor><contralpanelbtnglowcolro>0xffff00</contralpanelbtnglowcolro><controlpanelmode>float</controlpanelmode><defautVolume>0.7</defautVolume><isAutoPlay>true</isAutoPlay><isLoadBegin>true</isLoadBegin><isshowabout>true</isshowabout><scaleMode>exactFit</scaleMode></config></vcastr> "></object>'
};
Lb.prototype.alertBox=function(){
	var _this = this;
	$(this._obj).click(function(){
		getVcastr().pause();
		$('body').append('<div id="bg"></div>');
		$('body').append('<div id="alert_jh"><div id="close"></div>'+_this.str+'</div>');  //<iframe id="v_iframe" src="http://zengke.dev.ztgame.com:94/sindex_video.html" frameborder="0" scrolling="No" allowtransparency="true"></iframe>

		
		$('#bg').css({background:'#000',width:'100%',height:Math.max(document.documentElement.scrollHeight, document.documentElement.clientHeight)+'px',position:'absolute','z-index':'1001',left:'0',top:'0',opacity:'0.6',display:'none'});	
		$('#bg').fadeIn(300);
		
		$(document).keyup(function(event){
			if(event.keyCode == 27&&$('#alert_jh').size()){
				$('#close').click();
			}
		});
			
		$('#close').live('click',function(){			
			$('#bg').remove();	
			$('#alert_jh').remove();
			getVcastr().videoPlay();			
		})
	})	
}

function getVcastr() {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window["vcastr3"];
	} else {
		return document["vcastr3"];
	 }
} 




$(function(){
	var isIE6 = window.XMLHttpRequest?false:true;	
	new  Lb('.video_a','http://xt.ztgame.com/swf/xt_110829_03.flv');
	
	$('.video_a').click(function(){
		
		$('.video_a object').click();
	})



	new Tab('.dl .tab_h a','.dl .tab_con li','mouseover')	
	txt_slide('mask',3000,-1);
	
	$('#mask li:even').addClass('even');
	


})


