//nav sub menu
var isNavHover=false;

//focus img player
var t = n = 0;
var count = 0;

function copy_code(text) {
  if (window.clipboardData) {
    window.clipboardData.setData("Text", text)
	alert("已经成功复制到剪贴板！");
  } else {
	var x=prompt('你的浏览器可能不能正常复制\n请你手动进行：',text);
  }
  //return false;
}


$(document).ready(function(){
/*disabled
$("#postlist img,#rc_avatar img,.entry-content img,.avatar").lazyload({
     placeholder:"plus/images/grey.gif",       
     effect:"fadeIn"
 });*/

count = $("#play_list a").size();

//nav sub menu
$('.nav_sub,.nav_sub_div').hover(
	function() {
		if(isNavHover==false ){$('.nav_sub_div').hide();}//fadeOut(500);}
		isNavHover=true;
		$(this).children('.nav_sub_div').fadeIn(500);
	},
	function() {
		setTimeout(
			function () {
			if(!isNavHover){
				$('.nav_sub_div').hide();//fadeOut(500);
			}}
		,750);
		isNavHover=false;
	}
);

//1st post show
$('#section_show_post').hover(
	function() {
		$("#post_show_link_l,#post_show_link_r").stop(true,true);
		$("#post_show_link_l,#post_show_link_r").fadeIn();
	},
	function() {
		$("#post_show_link_l,#post_show_link_r").stop(true,true);
		$("#post_show_link_l,#post_show_link_r").fadeOut();
	}
);

$("#post_show_link_l,#post_show_link_r").click(function(){
	// if($(this).attr("rel")=="0")return;
	 $.ajax({
	   type: "POST",
	   url: "plus/api/ajax_getposts.php",
	   data: "type=post_show&post_show_id="+$(this).attr('rel'),
	   error: function (XMLHttpRequest, textStatus, errorThrown) {
			alert ("通信失败...");
		},
		beforeSend:function(){
		 $("#show_post_entry").html('<div id="post_show_loading"><img src="plus/images/loading.gif" /><br/><br/>主人稍等耶，我给你老人家找文章去...</div>');
		},
	   success: function(msg){
		 $("#show_post_entry").hide();
		 var str=msg.split('songlecn');
		 $("#show_post_entry").html(str[0]);
		 $("#post_show_link_l").attr("rel",str[1]);
		 $("#post_show_link_r").attr("rel",str[2]);
		 $("#show_post_entry").fadeIn();
	   }
	 });
});

//Hot Tab Index
var isTabRndHover;
var isTabDivHover;
isTabRndHover=true;isTabDivHover=false;
$("#hot_tab_year_view,#hot_tab_month_view,#hot_tab_year,#hot_tab_month,#hot_tab_rnd,#hot_tab_comment,#hot_tab_new").click(function(){
	 $("#hot_tab_list").html('<div class="hot_tab_loading"><img src="plus/images/loading.gif" /></div>');
	 $(".current_tab").removeClass("current_tab");
	 $(this).addClass("current_tab");
	 $("#hot_tab_list").load("/plus/api/ajax_getposts.php",{"type":$(this).attr("id")});
	 return false; 
});
$("#hot_tab_list").mouseover(function(){isTabDivHover=true;})
$("#hot_tab_list").mouseout(function(){isTabDivHover=false;})

		
/*setInterval(function() {
	if(isTabRndHover&&(!isTabDivHover)){  
		$("#hot_tab_list").html('<div class="hot_tab_loading"><img src="'+themeUrl+'/images/loading.gif" /></div>');
		$("#hot_tab_list").load(themeUrl+"/js/ajax.php",{"type":"hot_tab_rnd"});
	}
} ,8000)
*/

$("#hot_tab_ctl_l,#hot_tab_ctl_r").click(function(){
alert("囧rz..  这个小东西真的什么功能都没有的，别再点啦……");
});

$('.comment_body').hover(
	function() {
		$(this).find('.commentmetadata').stop(true,true).show();
	},
	function() {
		$(this).find('.commentmetadata').stop(true,true).hide();
	}
);


$('.entry').hover(
	function() {
		$(this).find('.meta_view_link').stop(true,true).fadeIn();
	},
	function() {
		$(this).find('.meta_view_link').stop(true,true).fadeOut();
	}
);
});
