$(function(){
  var turnpic,turnsmallpic,haibaoI=1,i=1;
  $.fn.htmlimg=function()
  {
	var bigstr
	if($(this).html()=="")
	{
	  this.each(function()
	  { 
		bigstr='<a href="'+$(this).attr("href")+'" class="playlink" target="_blank" title="'+$(this).attr("title")+'">\
				  <img src="'+$(this).attr("src")+'" width="100" height="136"/>\
				</a>\
				<p class="title">\
				  <a href="'+$(this).attr("link")+'" title="点击查看影片信息" class="movinfo" target="_blank"></a>\
				  <a href="'+$(this).attr("href")+'" title="'+$(this).attr("title")+'">'+$(this).attr("title")+'</a>\
				</p>\
				<span class="bg"></span>\
				<span class="txt">'+$(this).attr("state")+'</span>\
				<p class="note">'+$(this).attr("note")+'</p>'
		$(this).html(bigstr);
		$(this).show();
	  });
	}
	$(this).children(".playlink").each(function()
	{ 
	  $(this).html($(this).html());
	});
  }
  $(".yn_list_pager a").mouseover(function()
  {
	var id=$(this).attr("id"),picobj=$("#List_recommend_"+id+" li")
	$(".yn_list_pager a").attr("class","")
	$(this).attr("class","upH2")
	$(".huanying .box .rendielist").hide()
	picobj.htmlimg();
	$("#List_recommend_"+id).show();
  });
  $(".tabbox2 li").mouseover(function()
  {
	var id=$(this).attr("id"),picobj=$("#List_m_"+id+" li")
    $(".tabbox2 li").attr("class","");$(this).attr("class","on")
	$(".moviebox .rendielist").hide()
	picobj.htmlimg();
	$("#List_m_"+id).show();
  });
  $.fn.turnimg=function(i,time){
	var j=1,px="-312",bigstr;
	  this.each(function(){ 
		if(i==j)
		{
		  if($(this).html()=="")
		  {
			bigstr='<img alt="'+$(this).attr("title")+'" src="'+$(this).attr("src")+'"/><span class="iText">《'+$(this).attr("title")+'》'+$(this).attr("note")+'</span>'
			$(this).html(bigstr);
		  }
		}
		j++
	  });
	$(".turnpic a").animate({top:px*i+312+"px"},time);
	$(".focus ul li a").attr("class","");
	$(".focus ul li #"+i).attr("class","on");
  }
  $.fn.fnturnpic=function()
  {
	if(i<6){i++;}else{i=1;}
	$(this).turnimg(i,500)
  }
  $(".focus ul li a").mouseover(function()
  {
	clearTimeout(turnpic);
	clearTimeout(turnsmallpic);
	i=$(this).attr("id");
	turnsmallpic=setTimeout("$('.turnpic a').turnimg("+i+",300)",100)
  });
  $(".focus ul li a").mouseout(function()
  {
	clearTimeout(turnpic);
	turnpic=setInterval("$('.turnpic a').fnturnpic()",3000);
  });
  turnpic=setInterval("$('.turnpic a').fnturnpic()",3000)
  $(".pageturn2,.pageturn3").click(function()
  {
	if($(this).html()=="上一张"){haibaoI--;}else{haibaoI++;}
	if(haibaoI>1)
	{
	  $(".boxR_tt .pageturn2:last").attr("class","pageturn2 on");
	  $(".boxR_tt .pageturn3:first").attr("class","pageturn3 pageturn3_L");
	}
	else
	{
	  $(".boxR_tt .pageturn2:last").attr("class","pageturn2")
	  $(".boxR_tt .pageturn3:first").attr("class","pageturn3 pageturn3_L none");
	  haibaoI=1;
	}
	if(haibaoI<5)
	{
	  $(".boxR_tt .pageturn2:first").attr("class","pageturn2 on");
	  $(".boxR_tt .pageturn3:last").attr("class","pageturn3 pageturn3_R");
	}
	else
	{
	  haibaoI=5;
	  $(".boxR_tt .pageturn2:first").attr("class","pageturn2")
	  $(".boxR_tt .pageturn3:last").attr("class","pageturn3 pageturn3_R none");
	}
	var str,obj=$("#List_haibao_"+haibaoI)
	  $(".bigmovie").hide()
	  if(obj.html()=="")
	  {
		str='<a href="'+obj.attr("href")+'" title="'+obj.attr("title")+'" class="bigpic">\
				  <img src="'+obj.attr("src")+'" alt="'+obj.attr("title")+'" width="210" height="295"/>\
				<span class="bigmovie_ico"></span>\
			  </a>\
			  <div class="bigmovie_tt">\
				<h3><a href="'+obj.attr("href")+'" title="'+obj.attr("title")+'">'+obj.attr("title")+'</a></h3>\
				<a href="'+obj.attr("href")+'" title="'+obj.attr("title")+'" class="bigmovie_play">欣赏影片</a>\
			  </div>\
			  <ul class="bigmovie_ul">\
				<li><strong>标签:</strong>'+obj.attr("area")+'</li>\
				<li class="p2"><strong>解读:</strong>'+obj.attr("des")+'</li>\
			  </ul>'
		obj.html(str)
	  }
	  obj.show()
  });
  $(".tabbox3 li").mouseover(function()
  {
	var id=$(this).attr("id"),tabL=id.substring(0,1),tabR=id.substring(1,id.length); 
	if(tabL==1)
	{
	  $(".tabbox3 #1"+tabR).attr("class","tabbox3_1 on");
	  $(".tabbox3 #2"+tabR).attr("class","tabbox3_2");
	  $("#List_1"+tabR).show()
	  $("#List_2"+tabR).hide()
	}
	else
	{
	  $(".tabbox3 #1"+tabR).attr("class","tabbox3_1");
	  $(".tabbox3 #2"+tabR).attr("class","tabbox3_2 on");
	  $("#List_1"+tabR).hide()
	  $("#List_2"+tabR).show()
	}
  });
  $(".sideL h2 a").click(function()
  {
	var str,bool=new Array(),j=0
	for(var k=0;k<26;k++){bool[k]=k;}
	for(var k=0;k<8;k++){bool[k]=bool.splice(Math.floor(Math.random()*bool.length),1);}
	$(".sideL .jingdian li").each(function()
	{
	  if((j==bool[0])||(j==bool[1])||(j==bool[2])||(j==bool[3])||(j==bool[4])||(j==bool[5])||(j==bool[6])||(j==bool[7])||(j==bool[8]))
	  {
		if($(this).html()=="")
		{
		  str='<a href="'+$(this).attr("href")+'" title="点击播放&#13;'+$(this).attr("title")+$(this).attr("year")+'">\
          <img alt="点击播放&#13;'+$(this).attr("title")+$(this).attr("year")+'" src="'+$(this).attr("src")+'" width="68" height="90"/>\
          </a>';
		 $(this).html(str)
		}
		$(this).html($(this).html());
		$(this).show();
	  }else{$(this).hide();}
	  j++;
	});				
  });
});
