$(function(){
	$('.detail').mouseover(function(){
		$(this).find('div').css('display','block');
	}).mouseout(function(){
		$(this).find('div').css('display','none');;
	});


});
function vote3(id,kind){
	$.ajax({
	   type: "POST",
	   url: "/index.php/Reply/checkVote2",
	   data: "id="+id+"&kind="+kind,
	   success: function(msg){
			if(msg=='+1+'){
				showLoginForm();
			}else if(msg=='-1-'){
				if(kind>0){
					$("#yes-"+id).removeAttr('href');
					$("#no-"+id).removeAttr('href');
					$("#yes-"+id).css("background","#F3EFE7 url(/Public/source/web.png) -0px -60px no-repeat");
					$("#yes-"+id).css("color","#BF4131");
					$("#yes-"+id).css("border","1px solid #CABDB0");
					$("#yes-"+id).css("box-shadow","0 1px 2px #D6C9BC inset;");
				}else{
					$("#yes-"+id).removeAttr('href');
					$("#no-"+id).removeAttr('href');
					$("#no-"+id).css("background","#F3EFE7 url(/Public/source/web.png) -80px -60px no-repeat");
					$("#no-"+id).css("color","#BF4131");
					$("#no-"+id).css("border","1px solid #CABDB0");
					$("#no-"+id).css("box-shadow","0 1px 2px #D6C9BC inset;");
				}
			}else if(msg=='+1'){
				var yes = parseInt($("#yes-"+id).html());
				$("#yes-"+id).html(yes+1);
				$("#yes-"+id).removeAttr('href');
				$("#no-"+id).removeAttr('href');
				$("#yes-"+id).css("background","#F3EFE7 url(/Public/source/web.png) -0px -60px no-repeat");
				$("#yes-"+id).css("color","#BF4131");
				$("#yes-"+id).css("border","1px solid #CABDB0");
				$("#yes-"+id).css("box-shadow","0 1px 2px #D6C9BC inset;");
			}else if(msg=='-1'){
				var no = parseInt($("#no-"+id).html());
				$("#no-"+id).html(no+1);
				$("#yes-"+id).removeAttr('href');
				$("#no-"+id).removeAttr('href');
				$("#no-"+id).css("background","#F3EFE7 url(/Public/source/web.png) -80px -60px no-repeat");
				$("#no-"+id).css("color","#BF4131");
				$("#no-"+id).css("border","1px solid #CABDB0");
				$("#no-"+id).css("box-shadow","0 1px 2px #D6C9BC inset;");
			}
	   }
	});
}
function showReply(id){
	if($("#reply-"+id).html()== null){
		var showReply = $("#showReply-"+id).html();
		$("#showReply-"+id).html('...');
		$.ajax({
			type: "POST",
			url: "/index.php/Reply/showReply",
			data: "id="+id,
			success: function(msg){
				$("#qiushi-"+id).append(msg);
				$("#showReply-"+id).html(showReply);
			}
		});
	}else{
		$("#reply-"+id).toggle('fast');
	}
}
function checkReply2(id){
	var arcontent = $('#arcontent-'+id).val();
	var anoymous = 0 ;
	if($('#anonymous-'+id+':checked').val()=='1')	anoymous = 1;
	$.ajax({
		type: "POST",
		url: "/index.php/Reply/checkReply2",
		data: "pid="+id+"&arcontent="+arcontent+"&anonymous="+anoymous,
		success: function(msg){
			if(msg=='0'){
				alert('回复就得有内容嘛!');
			}else if(msg=='-1'){
				$('#arcontent-'+id).val('');
			}else if(msg=='1'){
				var reply = parseInt($("#showReply-"+id).html());
				if(isNaN(reply)) reply = 0;
				$("#showReply-"+id).html(reply+1);
				$('#arcontent-'+id).val('');
				$('#reply-'+id).remove();
				$('#arcontent-'+id).focus();
				showReply(id);
			}else{
				alert(msg);
			}
		}
	});
}
function replyBest(rid,id){
	$.ajax({
		type: "POST",
		url: "/index.php/Reply/checkBest",
		data: "rid="+rid+"&id="+id,
		success: function(msg){
			$('#arcontent-'+id).val('');
			$('#reply-'+id).remove();
			$('#arcontent-'+id).focus();
			showReply(id);
		}
	});
}
function sharetoqzone(id){
	var title = $('#content-'+id).html();
	var url   = 'http://'+document.domain+$('#title-'+id).attr('href');
	var summary = $('#content-'+id).html();
	window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+url);
}
function sharetosina(id){
	var title = $('#content-'+id).html();
	title = title.substr(0,125);
	var url   = 'http://'+document.domain+$('#title-'+id).attr('href');
	var pic   = $('#img-'+id).attr('src');
	if(pic){
		var _u = 'http://service.weibo.com/share/share.php?title='+title+'&pic='+pic+'&url='+url;
	}else{
		var _u = 'http://service.weibo.com/share/share.php?title='+title+'&url='+url;
	}	
	window.open( _u,'转播到新浪微博', 'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no' );
}
function sharetotqq(id){
	var title = $('#content-'+id).html();
	title = title.substr(0,125);
	var url   = 'http://'+document.domain+$('#title-'+id).attr('href');
	var site = 'http://'+document.domain;
	var pic   = $('#img-'+id).attr('src');
	var _u = 'http://v.t.qq.com/share/share.php?title='+title+'&pic='+pic+'&url='+url+'&site='+site;
	window.open( _u,'转播到腾讯微博', 'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no' );
}