﻿// JScript 文件

// 点击数更新获取
function  getclick(newsid,object)
{    
   $.ajax({ type:"Get", url:"../ajax.aspx", data:"action=click", dataType:"html", error:function(){alert('出现异常错误！请联系管理员！');},success:function(clicknum){$(object).html(clicknum);} });
}


function  updateclick(newsid)
{    
   $.ajax({ type:"Get", url:"/ajax.aspx", data:"action=Nu&newsid=" + newsid +"&s=" + Math.random(), dataType:"html", error:function(){},success:function(clicknum){} });
}

// 用户投票

function GetVoteNum(newsid)
{
      $.ajax({ type:"Get", url:"/ajax.aspx", data:"action=GV&newsid=" + newsid +"&s=" + Math.random(), dataType:"html", error:function(){alert('出现异常错误！请联系管理员！');},
      success:function(voteNum)
	  {
		 var vote = voteNum.split('$');
		  for(i=0; i<=2; i++)
		 {			
			 $("#vote_"+ i).html(vote[i]);
		 }		 
	  } 
	  });
}

function GetSellerNum(newsid)
{
      $.ajax({ type:"Get", url:"/ajax.aspx", data:"action=SV&newsid=" + newsid +"&s=" + Math.random(), dataType:"html", error:function(){alert('出现异常错误！请联系管理员！');},
      success:function(voteNum)
	  {
		 var vote = voteNum.split('$');
		  for(i=0; i<=1; i++)
		 {			
			 $("#vote_"+ i).html(vote[i]);			
		 }		 
	  } 
	  });
}


function VoteUser(newsid,type,object)
{
	
      $.ajax({ 
	  	type:"Get", url:"/ajax.aspx?action=Vote&type="+type + "&newsid="+ newsid + "&s=" + Math.random(), 
		dataType:"html", error:function(){alert('出现异常错误！请联系管理员！');},
      	success:function(voteNum)
		{
			//alert(voteNum);
				if(voteNum!='0001' && voteNum!=''){					
					alert("投票成功，感谢您的参与！");							
					document.getElementById(object).innerHTML = voteNum;			
				}
				else
				{
					alert("你已经投过票了！");
				}
	  } });
}


function voteSeller(newsid,entiron,service,artificer)
{

      $.ajax({ 
	  	type:"Get", url:"/ajax.aspx?action=VoteS&entiron="+entiron + "&newsid="+ newsid + "&service="+ service + "&artificer="+ artificer + "&s=" + Math.random(), 
		dataType:"html", error:function(){alert('出现异常错误！请联系管理员！');},
      	success:function(voteNum)
		{
			//alert(voteNum);
				if(voteNum!='001' && voteNum!=''){					
					alert("投票成功，感谢您的参与！");	
				}
				else
				{
					alert("你已经投过票了！");
				}
	  } });
}