$(function(){
  var i=1,turnbigpic,turnsmallpic
  $.fn.turnimg=function(i,time){
	var j=1,px="71",bigstr;
	this.each(function()
	{ 
	  if(i==j)
	  {
		if($(this).html()=="")
		{
		  bigstr='<a href="'+$(this).attr("href")+'" title="'+$(this).attr("title")+'">\
					<img src="'+$(this).attr("src")+'" alt="'+$(this).attr("title")+'"/>\
				  </a>\
				  <div class="foucebox_bg"></div>\
				  <span class="playico"></span>\
				  <h4 class="foucebox_h4">\
					<a href="'+$(this).attr("href")+'" title="'+$(this).attr("title")+'">《'+$(this).attr("title")+'》'+$(this).attr("note")+'（高清首播）</a>\
				  </h4>'
		  $(this).html(bigstr);
		}
		$(".foucebox .fouceR").fadeOut(time);
		$(this).fadeIn(time);
	  }
	  j++
	});
	$(".scrollimg2_tigger_hoverbg").animate({left:px*i-71+7+"px"},500);
  }
  $.fn.fnturnpic=function()
  {
	if(i<10){i++;}else{i=1;}
	$(this).turnimg(i,300)
  }
  $(".scrollimg2_tigger ul li a img").mouseover(function()
  {
	clearTimeout(turnsmallpic);clearTimeout(turnbigpic);i=$(this).attr("id")
	turnsmallpic=setTimeout("$('.foucebox .fouceR').turnimg("+i+",150)",300)
  });
  $(".scrollimg2_tigger ul li a img").mouseout(function()
  {
	clearTimeout(turnbigpic)
	turnbigpic=setInterval("$('.foucebox .fouceR').fnturnpic()",3000)
  });
  turnbigpic=setInterval("$('.foucebox .fouceR').fnturnpic()",3000);
  $(".box_fouce .tabbox li").mouseover(function()
  {
    if($(this).html()=="热播榜")
	{
	  $(".box_fouce .tabbox li:first").attr("class","on")
	  $(".box_fouce .tabbox li:last").attr("class","")
	  $(".box_fouce .ranklist:first").attr("class","ranklist ranklist_fouce")  
	  $(".box_fouce .ranklist:last").attr("class","ranklist ranklist_fouce none")
    }
	else
	{
	  $(".box_fouce .tabbox li:first").attr("class","")
	  $(".box_fouce .tabbox li:last").attr("class","on")
	  $(".box_fouce .ranklist:first").attr("class","ranklist ranklist_fouce none")
	  $(".box_fouce .ranklist:last").attr("class","ranklist ranklist_fouce")
	}
  });
  $.fn.ranklist=function(id)
  {
	if(!$("List_"+id).html())
	{
	  str='<li class="show top" id="List_'+id+'">\
			  <a href="'+$("#"+id+" a").attr("href")+'" title="'+$("#"+id+" a").attr("title")+'" class="pic">\
				<img src="'+$(this).attr("src")+'" alt="'+$("#"+id+" a").attr("title")+'" width="64" height="90">\
			  </a>\
			  <span class="score">7.1</span>\
			  <p class="title"><a href="'+$("#"+id+" a").attr("href")+'" title="'+$("#"+id+" a").attr("title")+'" target="_blank">'+$("#"+id+" a").attr("title")+'</a></p>\
			  <span class="em">'+$("#"+id+" .em").html()+'</span>\
			  <p>'+$(this).attr("note")+'</p>\
			  <p>720P</p>\
			  <a href="'+$("#"+id+" a").attr("href")+'" class="playbtn">播放</a>\
			  <a href="'+$(this).attr("link")+'" class="detaillink">详情</a>\
			</li>'
	  $(this).after(str)
	}
  }
  $(".rebo_S").mouseover(function()
  {
	var str,id=$(this).attr("id")
	$(this).ranklist(id);
	$(".ranklist:first .show").hide()
	$("#List_"+id).show();
	$(".rebo_S").show()
	$(this).hide()
  });
  $(".rebo_H").mouseover(function()
  {
	var str,id=$(this).attr("id")
	$(this).ranklist(id);
	$(".ranklist:last .show").hide()
	$("#List_"+id).show();
	$(".rebo_H").show()
	$(this).hide()
  });
});