//nav sub menu
var isNavHover=false;
function checkNavHover() {
	if(!isNavHover){
		$('.nav_sub_div').hide();//fadeOut(500);
	}
}

//focus img player
var t = n = 0, count = $("#play_list a").size();



function copy_code(text) {
  if (window.clipboardData) {
    window.clipboardData.setData("Text", text)
	alert("已经成功复制到剪贴板！");
  } else {
    var flashcopier = 'flashcopier';
    if(!document.getElementById(flashcopier)) {
      var divholder = document.createElement('div');
      divholder.id = flashcopier;
      document.body.appendChild(divholder);
    }
    document.getElementById(flashcopier).innerHTML = '';
    var divinfo = '<embed src="/plus/images/_clipboard.swf" FlashVars="clipboard='+encodeURIComponent(text)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
    document.getElementById(flashcopier).innerHTML = divinfo;
	var x=prompt('你的浏览器可能不能正常复制\n请你手动进行：',text);
  }
  //return false;
}


$(document).ready(function(){

//nav sub menu
$('.nav_sub,.nav_sub_div').hover(
	function() {
		if(isNavHover==false )
		{$('.nav_sub_div').hide();}//fadeOut(500);}
		isNavHover=true;
		$(this).find('.nav_sub_div').fadeIn(500);
		
	},
	function() {
		setTimeout("checkNavHover()",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/function/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();
		 $("#show_post_entry").html(msg);
		 $("#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");
	 if($(this).attr("id")=="hot_tab_rnd"){isTabRndHover=true;}else{isTabRndHover=false;}
	 if($(this).attr("id")=="hot_tab_new"){
		$("#hot_tab_list").load("/plus/output/newposts_for_hotab.html");
	 } else
	{
		$("#hot_tab_list").load("/plus/function/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();
	}
);
});