document.write('<div id="LPSS_0" name="LPSS_" style="background:#000; filter:alpha(opacity=80); opacity: 0.8; width:0px; height:0px; z-index: 99999; position: absolute; left: 0px; top: 0px; display: none;"></div>');
$(window).resize(function(){
  filmMode(1);
});

var li_w = 130;
var ul_w = 780;							//650
var ul_ml = 0;
var mo_g = 75;
var li_p = 0;
var mo_l = 4;
var isgd = false;

var ul_obj = jQuery('#ul_list');
var li_len = jQuery('li',ul_obj).length;
var ul_leftMin = (ul_leftMin = ul_w - (li_len * li_w))>0 ? 0 : ul_leftMin;
var is_m = false;

function gethtmlurl()
{
    return window.location.href;
}

function nextplaynocss(obj)
{
	//alert(obj);
	var indexid=0;	
	var i=0;	
	var boolnextplay=true;	
	$('li',ul_obj).each(function (){
		++i;		
		if(obj == $(this).attr('name'))
		{
			
			if(i==$('li',ul_obj).length)
			{
				
				boolnextplay=false
				
			}
			else 
			{
				
				boolnextplay=false
				indexid=$(this).next("li").attr('name');				
				return false;		
				
			}
			
		}
		
	});	
	if(boolnextplay)
	{
		
		indexid=$('#ul_list li').eq(0).attr('name');		
		//alert(indexid);		
		
	}
	return indexid;	
	
}
function nextplay(obj)
{
	
	//alert(obj);

	var indexid=0;	
	var i=0;	
	var boolnextplay=true;	
	$('li',ul_obj).each(function (){
		
		++i;
		if(obj == $(this).attr('name'))
		{
			
			if(i==$('li',ul_obj).length)
			{
				
				boolnextplay=false
				
			}
			else 
			{
				
				boolnextplay=false
				$(this).removeClass("expli");				
				$(this).next("li").addClass("expli");				
				if(i>6)
				{
					
					mo_list(1);					
					
				}
				else 
				{
					
					mo_list(-1);					
					
				}
				indexid=$(this).next("li").attr('name');
				return false			
				
			}
			
		}
		
	});	
	if(boolnextplay)
	{
		
		$('#ul_list li').eq(0).addClass("expli");		
		indexid=$('#ul_list li').eq(0).attr('name');		
		//alert(indexid);		
		
	}
	return indexid;	
	
}
function ul_mo(index){
	
	if(index<0){
		
		index=0;		
		
	}else if(index>li_len-5){
		
		index=li_len-5;		
		
	}
	if(index==li_p)return ;	
	var _l=index*li_w*-1;	
	if(_l>0)_l=0;	
	else if(_l<ul_leftMin)_l=ul_leftMin;	
	if(!is_m){
		
		is_m=true;		
		ul_ml=_l;		
		ul_obj.animate({
			marginLeft:(_l+'px')
		},'slow',function (){
			is_m=false
		});		
		li_p=index;		
		
	}
	
}
function on_gd(){
	
	_mleft=parseInt(jQuery('#hd').css('margin-left'));	
	var val=Math.floor(_mleft/(ul_w-mo_g)*(li_len-5));	
	ul_mo(val);	
	
}
function move_bgclick(event){
	
	if(isgd)return false;	
	var mo_left=getAbsLeft(document.getElementById('move_bg'));	
	mo_left=(event.pageX||event.screenX)-mo_left;	
	if(mo_left>(ul_w-mo_g))mo_left=ul_w-mo_g;	
	jQuery('#hd').css('margin-left',mo_left);	
	setTimeout('on_gd()',20);	
	
}
function getAbsLeft(e){
	
	var x=e.offsetLeft;	
	while(e=e.offsetParent){
		
		x+=e.offsetLeft;		
		
	}
	return x;	
	
}
function mo_list(val,g){
	
	g=g||mo_l;	
	ul_mo(li_p+(val*g));	
	if(ul_leftMin!=0){
		
		_l=Math.ceil(ul_ml/ul_leftMin*(ul_w-mo_g));		
		jQuery('#hd').css('margin-left',_l);		
		
	}
	
}
function ani(obj,o,p,fun){
	
	var duration=p.duration||p;	
	var s=duration/30;	
	var step={
		
	};	
	var n=[];	
	for(var i in o){
		
		if(!obj.style[i])obj.style[i]=0;		
		step[i]=(o[i]-parseFloat(obj.style[i]))/s;		
		n.push(i);		
		
	}
	var m=n[0];	
	if(p.buffer)var d0=Math.abs((o[m]-parseFloat(obj.style[m]))/3);	
	var l=n.length;	
	var timer=setInterval(function (){
		
		var u=parseFloat(obj.style[m]);		
		var d=o[m]-u;		
		if(d<0)d=-d;		
		if(step[m]>0&&d<step[m]||step[m]<0&&d<-step[m]){
			
			clearInterval(timer);			
			for(var k=0;k<l;k++){
				
				obj.style[n[k]]=o[n[k]]+"px";				
				
			}
			if(fun)fun();			
			timer=null;			
			return false;			
			
		}
		for(var j=0;j<l;j++){
			
			m=n[j];			
			u=parseFloat(obj.style[m]);			
			if(d<=d0)step[m]=step[m]*p.buffer;			
			obj.style[m]=u+step[m]+"px";			
			
		}
		
	},30);	
	return timer;	
	
}

function slideItemEvents(){
	
	var timer=0;	
	function overSlideItem(){
		
		var img=this.getElementsByTagName('DIV')[0];		
		var pic=this.getElementsByTagName('IMG')[0];		
		if(timer)clearInterval(timer);		
		timer=ani(img,{
			
			marginTop:0
			
		},100);		
		
	}
	function outSlideItem(){
		
		var src=this;		
		var img=src.getElementsByTagName('DIV')[0];		
		if(timer)clearInterval(timer);		
		timer=ani(img,{
			
			marginTop:-65
			
		},100);		
		
	}
	
	this.onmouseover=overSlideItem;	
	this.onmouseout=outSlideItem;	
	
}
function cssSet(obj)
{
	
	$('#ul_list li').removeClass("expli");	
	$(obj).parent("li").addClass("expli");	
	
}
var isLoad=true
function ajaxNew()
{
	
	
	if(isLoad)
	{
		
		isLoad=false;
		
		ul_obj.html("");
		jQuery.getJSON("http://playerwebservice.jsbc.com/VideoNew.aspx?jsonpCallback=?",      
                    function(json){   
                      $.each(json, function(i){   
                       
					var file_id = json[i].file_id;
					
					var VVCount=json[i].VVCount;
					
					var PLCount=json[i].PLCount;
					
					var DingCount=json[i].DingCount;
					
					var Name=json[i].Name;
					
					var Duration=parseInt(json[i].Duration/60)+'分'+json[i].Duration%60+'秒';
					
					var CreateDate=json[i].CreateDate;

					var BcDate=json[i].BcDate;
					
					var Keyword=json[i].Keyword;
					
					var Actor=json[i].Actor;
					
					var SmallPosterUrl=json[i].SmallPosterUrl.replace('.jpg','_small.jpg');
					
					var VideoPlayUrl=json[i].VideoPlayUrl;
					
					var progID=json[i].progID;
					
					var progName=json[i].progName;

					var director=json[i].Director;
					
					var Wap=0; 
					
					
					var html='<li name="'+file_id+'"><a title="'+Name+'" href="#" ';
					
					html+='onclick="swfjs(this,\''+file_id+'\',\''+Name+'\',\''+CreateDate+'\',\''+VideoPlayUrl+'\',\''+VideoPlayUrl+'\',\''+VVCount+'\',\''+DingCount+'\',\''+Keyword+'\', \''+progName+'\',\''+VideoPlayUrl+'\',\''+progID+'\',\''+progID+'\',\''+progName+'\',\''+Actor+'\', \''+SmallPosterUrl+'\',\''+SmallPosterUrl+'\',\''+progID+'\',\''+Wap+'\',\''+director+'\',\''+BcDate+'\');">';
					
					html+='<div class="anniu" style="margin-top: -65px; cursor: pointer; position: relative; height: 65px" >';
					
					html+='<img class="img" height="22" src="http://www.jstv.com/v/fplayer/play.gif" width="22"';
					
					html+=' border="0">';
					
					html+='<img style="padding-right: 0pt; padding-left: 6px; padding-bottom: 0pt; padding-top: 7px"';
					
					html+='height="58" src="'+SmallPosterUrl+'" width="117">';
					
					html+='<div class="cover">';
					
					html+='</div>';
					
					html+='</div>';
					
					html+='<div class="title">'+Name.substring(0,25)+'</div>';
					
					html+='<div class="clear">';
					
					html+='</div>';
					
					html+='<div class="time">'+Duration+'</div>';
					
					html+='</a></li>';
					
					//alert(curDivId.innerHTML);
					
					ul_obj.append(html);
                      });   
					  
				li_len=jQuery('li',ul_obj).length;
				
				ul_leftMin=(ul_leftMin=ul_w-(li_len*li_w))>0?0:ul_leftMin;
				
				
				jQuery('li a',ul_obj).each(slideItemEvents);
				
				
				mo_list(-2,1);
                });   
		
		
		isLoad=true;
		
	}
	
	
}

function ajaxHot()
{
	
	
	if(isLoad)
	{
		
		
		
		isLoad=false;
		
		ul_obj.html("");
		
		
		jQuery.getJSON("http://playerwebservice.jsbc.com/VideoHit.aspx?jsonpCallback=?",      
                    function(json){   
                      $.each(json, function(i){   
                       
					var file_id = json[i].file_id;
					
					var VVCount=json[i].VVCount;
					
					var PLCount=json[i].PLCount;
					
					var DingCount=json[i].DingCount;
					
					var Name=json[i].Name;
					
					var Duration=parseInt(json[i].Duration/60)+'分'+json[i].Duration%60+'秒';
					
					var CreateDate=json[i].CreateDate;
					
					var BcDate=json[i].BcDate;
					
					var Keyword=json[i].Keyword;
					
					var Actor=json[i].Actor;
					
					var SmallPosterUrl=json[i].SmallPosterUrl.replace('.jpg','_small.jpg');
					
					var VideoPlayUrl=json[i].VideoPlayUrl;
					
					var progID=json[i].progID;
					
					var progName=json[i].progName;

					var director=json[i].Director;
					
					var Wap=0; 
					
					
					var html='<li name="'+file_id+'"><a title="'+Name+'" href="#" ';
					
					html+='onclick="swfjs(this,\''+file_id+'\',\''+Name+'\',\''+CreateDate+'\',\''+VideoPlayUrl+'\',\''+VideoPlayUrl+'\',\''+VVCount+'\',\''+DingCount+'\',\''+Keyword+'\', \''+progName+'\',\''+VideoPlayUrl+'\',\''+progID+'\',\''+progID+'\',\''+progName+'\',\''+Actor+'\', \''+SmallPosterUrl+'\',\''+SmallPosterUrl+'\',\''+progID+'\',\''+Wap+'\',\''+director+'\',\''+BcDate+'\');">';
					
					html+='<div class="anniu" style="margin-top: -65px; cursor: pointer; position: relative; height: 65px" >';
					
					html+='<img class="img" height="22" src="http://www.jstv.com/v/fplayer/play.gif" width="22"';
					
					html+=' border="0">';
					
					html+='<img style="padding-right: 0pt; padding-left: 6px; padding-bottom: 0pt; padding-top: 7px"';
					
					html+='height="58" src="'+SmallPosterUrl+'" width="117">';
					
					html+='<div class="cover">';
					
					html+='</div>';
					
					html+='</div>';
					
					html+='<div class="title">'+Name.substring(0,25)+'</div>';
					
					html+='<div class="clear">';
					
					html+='</div>';
					
					html+='<div class="time">'+Duration+'</div>';
					
					html+='</a></li>';
					
					//alert(curDivId.innerHTML);
					
					ul_obj.append(html);
                      });   
					li_len=jQuery('li',ul_obj).length;
					
					ul_leftMin=(ul_leftMin=ul_w-(li_len*li_w))>0?0:ul_leftMin;
					
					
					jQuery('li a',ul_obj).each(slideItemEvents);
					
					
					mo_list(-2,1);
                });   
		isLoad=true;		
		
		
		
		
	}
	
	
} 
function ajaxPro(obj)
{
	
	
	if(isLoad&&obj)
	{
		
		
		
		isLoad=false;
		
		ul_obj.html("");
		
		jQuery.getJSON("http://playerwebservice.jsbc.com/VideoPro.aspx?vid="+ obj +"&jsonpCallback=?",      
                    function(json){   
                      $.each(json, function(i){   
                       
					var file_id = json[i].file_id;
					
					var VVCount=json[i].VVCount;
					
					var PLCount=json[i].PLCount;
					
					var DingCount=json[i].DingCount;
					
					var Name=json[i].Name;

					var ShortName=Name.substring(0,20);
					
					var Duration=parseInt(json[i].Duration/60)+'分'+json[i].Duration%60+'秒';
					
					var CreateDate=json[i].CreateDate;

					var BcDate=json[i].BcDate;

					var Keyword=json[i].Keyword;
					
					var Actor=json[i].Actor;
					
					var SmallPosterUrl=json[i].SmallPosterUrl.replace('.jpg','_small.jpg');
					
					var VideoPlayUrl=json[i].VideoPlayUrl;
					
					var progID=json[i].progID;
					
					var progName=json[i].progName;

					var director=json[i].Director;
					
					var Wap=0; 
					
					
					var html='<li name="'+file_id+'"';
					
					if(obj==file_id){
						html += ' class ="expli"';

						document.getElementById("video_tit").innerHTML=Name;
						document.getElementById("video_key").innerHTML=Keyword+" "+director;
						document.getElementById("bcprogramme").innerHTML=Actor;//这个是所属栏目，已经加好
						document.getElementById("bcchannel").innerHTML=VVCount;//【频道名，比如“江苏卫视”】;
						//var d = new Date(Date.parse(CreateDate.replace(/-/g, "/")));
						document.getElementById("bcdate").innerHTML=BcDate;
						AddNewUrl();	//增加所属链接
						AddKeyUrl();	//增加关键词链接
					}
					
					html +='><a title="'+Name+'" href="#" ';
					
					html+='onclick="swfjs(this,\''+file_id+'\',\''+Name+'\',\''+CreateDate+'\',\''+VideoPlayUrl+'\',\''+VideoPlayUrl+'\',\''+VVCount+'\',\''+DingCount+'\',\''+Keyword+'\', \''+progName+'\',\''+VideoPlayUrl+'\',\''+progID+'\',\''+progID+'\',\''+progName+'\',\''+Actor+'\', \''+SmallPosterUrl+'\',\''+SmallPosterUrl+'\',\''+progID+'\',\''+Wap+'\',\''+director+'\',\''+BcDate+'\');">';
					
					html+='<div class="anniu" style="margin-top: -65px; cursor: pointer; position: relative; height: 65px" >';
					
					html+='<img class="img" height="22" src="http://www.jstv.com/v/fplayer/play.gif" width="22"';
					
					html+=' border="0">';
					
					html+='<img style="padding-right: 0pt; padding-left: 6px; padding-bottom: 0pt; padding-top: 7px"';
					
					html+='height="58" src="'+SmallPosterUrl+'" width="117">';
					
					html+='<div class="cover">';
					
					html+='</div>';
					
					html+='</div>';
					
					html+='<div class="title">'+Name.substring(0,25)+'</div>';
					
					html+='<div class="clear">';
					
					html+='</div>';
					
					html+='<div class="time">'+Duration+'</div>';
					
					html+='</a></li>';
					
					//alert(curDivId.innerHTML);
					
					ul_obj.append(html);
                      });   
		li_len=jQuery('li',ul_obj).length;
				
				ul_leftMin=(ul_leftMin=ul_w-(li_len*li_w))>0?0:ul_leftMin;
				
				
				jQuery('li a',ul_obj).each(slideItemEvents);
				
				
				mo_list(-2,1);
                });   
		isLoad=true;		
		
		
		
		
	}
	
	
} 
function GetPro()
{
	document.getElementById("fplay").SetPro();
}
var isReady = "false";
function bodyReady()
{
	isReady = "true";
}
function swfjs(obj,file_id,Name,CreateDate,VideoPlayUrl,VideoPlayUrl,VVCount,DingCount,Keyword, progName,VideoPlayUrl,progID,progID,progName,Actor, SmallPosterUrl,SmallPosterUrl,progID,Wap,director,bcdate)
{
	if(isReady == "true")
	{
		cssSet(obj);
		document.getElementById("video_tit").innerHTML=Name;
		document.getElementById("video_key").innerHTML=Keyword+" "+director;
		document.getElementById("bcprogramme").innerHTML=Actor;//这个是所属栏目，已经加好
		document.getElementById("bcchannel").innerHTML=VVCount;//【频道名，比如“江苏卫视”】;
		//var d = new Date(Date.parse(CreateDate.replace(/-/g, "/")));
		document.getElementById("bcdate").innerHTML=bcdate;
		document.getElementById("fplay").JsPlayFlv(file_id,Name,CreateDate,VideoPlayUrl,VideoPlayUrl,VVCount,DingCount,Keyword,progName,VideoPlayUrl,progID,progID,progName,Actor, SmallPosterUrl,SmallPosterUrl,progID,Wap);
		AddNewUrl();	//增加所属链接
		AddKeyUrl();	//增加关键词链接
	}
}

//默认“同期”显示红色
function setTongQiDefault(n){
	for(var i=1;i<4;i++){
		document.getElementById("btnVideoType"+i).src="http://www.jstv.com/v/fplayer/btnVideoType"+i+".jpg";
	}
	document.getElementById("btnVideoType"+n).src="http://www.jstv.com/v/fplayer/btnVideoType"+n+"_r.jpg";
}

var pdimglistul = jQuery('#relatev_cnt');
function getInterfix(vid)
{
		
		
					pdimglistul.html("");
		jQuery.getJSON("http://playerwebservice.jsbc.com/VideoInterfix.aspx?vid="+ vid +"&jsonpCallback=?",      
                    function(json){   
                      $.each(json, function(i){   
                       
					var file_id = json[i].file_id;
					
					var VVCount=json[i].VVCount;
					
					var PLCount=json[i].PLCount;
					
					var DingCount=json[i].DingCount;
					
					var Name=json[i].Name;
					
					var Duration=parseInt(json[i].Duration/60)+'分'+json[i].Duration%60+'秒';
					
					var CreateDate=json[i].CreateDate;

					var BcDate=json[i].BcDate;
					
					var Keyword=json[i].Keyword;
					
					var Actor=json[i].Actor;
					
					var SmallPosterUrl=json[i].SmallPosterUrl;
					
					var VideoPlayUrl=json[i].VideoPlayUrl;
					
					var progID=json[i].progID;
					
					var progName=json[i].progName;

					var director=json[i].Director;
					
					var Wap=0; 
					
					var html = '<div class="per"><a title="' + Name+ '" href="#" ';
					html+='onclick="swfjs(this,\''+file_id+'\',\''+Name+'\',\''+CreateDate+'\',\''+VideoPlayUrl+'\',\''+VideoPlayUrl+'\',\''+VVCount+'\',\''+DingCount+'\',\''+Keyword+'\', \''+progName+'\',\''+VideoPlayUrl+'\',\''+progID+'\',\''+progID+'\',\''+progName+'\',\''+Actor+'\', \''+SmallPosterUrl+'\',\''+SmallPosterUrl+'\',\''+progID+'\',\''+Wap+'\',\''+director+'\',\''+BcDate+'\');">';
					
					html+='<img alt="'+ Name +'" onerror=img_onerr(this) src="'+SmallPosterUrl+'" width=145 height=82 ignoreapd="1" />'
					
					html+='</a>';
					
					html+='<h3><a title="' + Name+ '" href="#" ';
					html+='onclick="swfjs(this,\''+file_id+'\',\''+Name+'\',\''+CreateDate+'\',\''+VideoPlayUrl+'\',\''+VideoPlayUrl+'\',\''+VVCount+'\',\''+DingCount+'\',\''+Keyword+'\', \''+progName+'\',\''+VideoPlayUrl+'\',\''+progID+'\',\''+progID+'\',\''+progName+'\',\''+Actor+'\', \''+SmallPosterUrl+'\',\''+SmallPosterUrl+'\',\''+progID+'\',\''+Wap+'\',\''+director+'\',\''+BcDate+'\');">';
					
					html+=Name;
					
					html+='</a></h3></div>';
					
					pdimglistul.append(html);
                      }); 
                });  
}

	var hotul = jQuery('#fsb_cnt_info');
function GetHot()
{
		
		
					hotul.html("");
		jQuery.getJSON("http://playerwebservice.jsbc.com/VideoHot.aspx?jsonpCallback=?",      
                    function(json){   
                      $.each(json, function(i){   
                       
					var file_id = json[i].file_id;
					
					var VVCount=json[i].VVCount;
					
					var PLCount=json[i].PLCount;
					
					var DingCount=json[i].DingCount;
					
					var Name=json[i].Name;
					
					var Duration=parseInt(json[i].Duration/60)+'分'+json[i].Duration%60+'秒';
					
					var CreateDate=json[i].CreateDate;

					var BcDate=json[i].BcDate;
					
					var Keyword=json[i].Keyword;
					
					var Actor=json[i].Actor;
					
					var SmallPosterUrl=json[i].SmallPosterUrl.replace('.jpg','_small.jpg');
					
					var VideoPlayUrl=json[i].VideoPlayUrl;
					
					var progID=json[i].progID;
					
					var progName=json[i].progName;

					var director=json[i].Director;
					
					var Wap=0; 
					
					var html = '<div class="per"><strong>'+(i+1)+'</strong><span class="info2"><a title="' + Name+ '" href="#" ';
					html+='onclick="swfjs(this,\''+file_id+'\',\''+Name+'\',\''+CreateDate+'\',\''+VideoPlayUrl+'\',\''+VideoPlayUrl+'\',\''+VVCount+'\',\''+DingCount+'\',\''+Keyword+'\', \''+progName+'\',\''+VideoPlayUrl+'\',\''+progID+'\',\''+progID+'\',\''+progName+'\',\''+Actor+'\', \''+SmallPosterUrl+'\',\''+SmallPosterUrl+'\',\''+progID+'\',\''+Wap+'\',\''+director+'\',\''+BcDate+'\');">';
					
					html+='<img alt="'+ Name +'" src="'+SmallPosterUrl+'" onerror="img_onerr(this)" class="sv" ignoreapd="1" />'
					
					html+='</a>';
					
					html+='<a title="' + Name+ '" href="#" ';

					html+='onclick="swfjs(this,\''+file_id+'\',\''+Name+'\',\''+CreateDate+'\',\''+VideoPlayUrl+'\',\''+VideoPlayUrl+'\',\''+VVCount+'\',\''+DingCount+'\',\''+Keyword+'\', \''+progName+'\',\''+VideoPlayUrl+'\',\''+progID+'\',\''+progID+'\',\''+progName+'\',\''+Actor+'\', \''+SmallPosterUrl+'\',\''+SmallPosterUrl+'\',\''+progID+'\',\''+Wap+'\',\''+director+'\',\''+BcDate+'\');"  class="fsb_a">';
					
					html+=Name;
					
					html+='</a></span><span class="info3"><span class="newpro">零距离</span></span><span class="info4">100</span><span class="info5"><span class="newk">关键词</span></span></div>';
					
					hotul.append(html);
                      }); 
                });  
}