//评论+1
function dianzan(obj)
 {
	obj.unbind('click'); //不能重复点赞
	var left = parseInt(obj.offset().left) + 4,
	top = parseInt(obj.offset().top) - 10;
	obj.append('<div id="zhan"><b>+1<\/b></\div>');
	$('#zhan').css({
		'position': 'absolute',
		'z-index': '1',
		'color': '#C30',
		'left': left + 'px',
		'top': top + 'px'
	}).animate({
		top: top - 10,
		left: left + 4
	},
	'slow',
	function() {
		$(this).fadeIn('fast').remove();
		var Num = parseInt(obj.find('span').text());
		Num++;
		obj.find('span').text(Num);
	});
	obj.removeClass("zhan");
	obj.addClass("zhan-1");
	$.ajax({
	  url: "/public/ajax.aspx?action=newsadd&id="+obj.attr("rel")+"&cc=0&t="+obj.attr("t"),
	  cache: false,
	  success:function(data)
	  {}
	});
	return false; 
 }
$(function() {
	$(".sp-2 content img").each(function(i){
		$(this).css("max-width","100%");								 
	})
    $(".plun-list ul li a#w").each(function(i) {
        $(this).bind('click',function() {
            dianzan($(this));
        });
    });
	$("#newspostsubmit").click(function(){
		var content = $.trim($("#AntUserContent").val());
		var Code = $.trim($("#AntUserCode").val());
		if(Code.length==0)
		{
			alert("对不起，请输入验证码！");
			return false;
		}
		if(content.length==0)
		{
			alert("对不起，请输入内容！");
			return false;
		}
		var InfoIDS=$("#Newsidhidden").val();
		var curl="/public/ajax.aspx?action=addnewscomment&niming=1";
		curl +="&Code="+escape(Code);
		curl +="&content="+escape(content);
		curl +="&NewsID="+escape(InfoIDS);
		$.ajax({
			  url: curl,
			  cache: false,
			  success:function(data)
			  {
				  curl = window.location.href;
				  if( curl.indexOf("#")!= -1 )
				  	curl = curl.substring(0,curl.indexOf("#"));
				  if(data=="0")
				  {	
				  	 alert("\u606d\u559c\u60a8\uff0c\u53d1\u5e03\u6210\u529f\uff0c\u8bf7\u7b49\u5f85\u5ba2\u670d\u5ba1\u6838\uff01");
					 $("#AntUserContent").val("");
					 $("#AntUserCode").val("");
				  }
				  else if(data=="1")
				  {	
					 alert("\u606d\u559c\u60a8\uff0c\u7559\u8a00\u6210\u529f\uff01");//SUCCESS
					 window.location.href=curl;
				  }
				  else{
					  alert(data);
				  }
			  }
		});	
		return false;
	})
	$("#picpostsubmit").click(function(){
		var content = $.trim($("#AntUserContent").val());
		var Code = $.trim($("#AntUserCode").val());
		if(Code.length==0)
		{
			alert("对不起，请输入验证码！");
			return false;
		}
		if(content.length==0)
		{
			alert("对不起，请输入内容！");
			return false;
		}
		var InfoIDS=$("#Newsidhidden").val();
		var curl="/public/ajax.aspx?action=addnewscomment&typeid=1&niming=1";
		curl +="&Code="+escape(Code);
		curl +="&content="+escape(content);
		curl +="&NewsID="+escape(InfoIDS);
		$.ajax({
			  url: curl,
			  cache: false,
			  success:function(data)
			  {
				  curl = window.location.href;
				  if( curl.indexOf("#")!= -1 )
				  	curl = curl.substring(0,curl.indexOf("#"));
				  if(data=="0")
				  {	
				  	 alert("\u606d\u559c\u60a8\uff0c\u53d1\u5e03\u6210\u529f\uff0c\u8bf7\u7b49\u5f85\u5ba2\u670d\u5ba1\u6838\uff01");
					 $("#AntUserContent").val("");
					 $("#AntUserCode").val("");
				  }
				  else if(data=="1")
				  {	
					 alert("\u606d\u559c\u60a8\uff0c\u7559\u8a00\u6210\u529f\uff01");//SUCCESS
					 window.location.href=curl;
				  }
				  else{
					  alert(data);
				  }
			  }
		});	
		return false;
	})
	$("#infopostsubmit").click(function(){
		var content = $.trim($("#AntUserContent").val());
		var Code = $.trim($("#AntUserCode").val());
		if(Code.length==0)
		{
			alert("对不起，请输入验证码！");
			return false;
		}
		if(content.length==0)
		{
			alert("对不起，请输入内容！");
			return false;
		}
		var InfoIDS=$("#Infoidhidden").val();
		var curl="/public/ajax.aspx?action=addinfocomment&niming=1";
		curl +="&Code="+escape(Code);
		curl +="&content="+escape(content);
		curl +="&InfoID="+escape(InfoIDS);
		$.ajax({
			  url: curl,
			  cache: false,
			  success:function(data)
			  {
				  curl = window.location.href;
				  if( curl.indexOf("#")!= -1 )
				  	curl = curl.substring(0,curl.indexOf("#"));
				  if(data=="0")
				  {	
				  	 alert("\u606d\u559c\u60a8\uff0c\u53d1\u5e03\u6210\u529f\uff0c\u8bf7\u7b49\u5f85\u5ba2\u670d\u5ba1\u6838\uff01");
					 $("#AntUserContent").val("");
					 $("#AntUserCode").val("");
				  }
				  else if(data=="1")
				  {	
					 alert("\u606d\u559c\u60a8\uff0c\u7559\u8a00\u6210\u529f\uff01");//SUCCESS
					 window.location.href=curl;
				  }
				  else{
					  alert(data);
				  }
			  }
		});	
		return false;
	})
	
	$("#videopostsubmit").click(function(){
		var content = $.trim($("#AntUserContent").val());
		var Code = $.trim($("#AntUserCode").val());
		if(Code.length==0)
		{
			alert("对不起，请输入验证码！");
			return false;
		}
		if(content.length==0)
		{
			alert("对不起，请输入内容！");
			return false;
		}
		var InfoIDS=$("#Newsidhidden").val();
		var curl="/public/ajax.aspx?action=addvideocomment&niming=1";
		curl +="&Code="+escape(Code);
		curl +="&content="+escape(content);
		curl +="&VideoID="+escape(InfoIDS);
		$.ajax({
			  url: curl,
			  cache: false,
			  success:function(data)
			  {
				  curl = window.location.href;
				  if( curl.indexOf("#")!= -1 )
				  	curl = curl.substring(0,curl.indexOf("#"));
				  if(data=="0")
				  {	
				  	 alert("\u606d\u559c\u60a8\uff0c\u53d1\u5e03\u6210\u529f\uff0c\u8bf7\u7b49\u5f85\u5ba2\u670d\u5ba1\u6838\uff01");
					 $("#AntUserContent").val("");
					 $("#AntUserCode").val("");
				  }
				  else if(data=="1")
				  {	
					 alert("\u606d\u559c\u60a8\uff0c\u7559\u8a00\u6210\u529f\uff01");//SUCCESS
					 window.location.href=curl;
				  }
				  else{
					  alert(data);
				  }
			  }
		});	
		return false;
	})
});