function disvote(id)
{
    var obj = document.getElementById("Li_"+id);
    var obj1 = document.getElementById("Li_t_"+id);
    var Action = "t=disvote&id="+id;
	var  options={  
					   method:'get',  
					   parameters:Action,  
					   onComplete:function(transport)
						{  
						    obj1.style.display="none";
						    obj.style.display="";
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							    obj.innerHTML="投票时发生错误";
							else
							    obj.innerHTML=returnvalue;
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/Vote/Vote.aspx?no-cache='+Math.random(),options);
}

function tovote(id)
{
    var obj = document.getElementById("Li_"+id);
    var obj1 = document.getElementById("Li_t_"+id);

    var comm = document.getElementById("Comm_"+id).value
    if(comm=="发表你的意见..."){comm="";}
    var cs = document.getElementsByName("Option_"+id);
    var v = ""
    for(var i=0;i<cs.length;i++){
        if(cs[i].checked)
            v+=','+cs[i].value;
    }
    v = v.replace(/^,/g,"");
    if(comm==""&& v=="")
    {
        alert('请选择投票项或者填写评论');
        return ;
    }
    var Action = "t=tovote&id="+id+"&option="+v+"&comm="+escape(comm);
	var  options={  
					   method:'get',  
					   parameters:Action,  
					   onComplete:function(transport)
						{  
						    obj1.style.display="none";
						    obj.style.display="";
							var returnvalue=transport.responseText;
							var arr  = returnvalue.split('|');
							if (returnvalue.indexOf("??")>-1)
							    obj.innerHTML="投票时发生错误";
							else
							    obj.innerHTML=arr[1];
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/Vote/Vote.aspx?no-cache='+Math.random(),options);
}

function govote(id)
{
    var comm = document.form1["Comm_"+id].value;
    if(comm=="发表你的意见..."){comm="";}
    var cs = document.getElementsByName("Option_"+id);
    var v = ""
    for(var i=0;i<cs.length;i++){
        if(cs[i].checked)
            v+=','+cs[i].value;
    }
    v = v.replace(/^,/g,"");
    if(comm==""&& v=="")
    {
        alert('请选择投票项或者填写评论');
        return ;
    }
    var Action = "t=tovote&id="+id+"&option="+v+"&comm="+escape(comm);
	var  options={  
					   method:'get',  
					   parameters:Action,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							var arr  = returnvalue.split('|');
							if (returnvalue.indexOf("??")>-1)
							{
							    alert("投票时发生错误");return false;
						   }
							else
							{
							    if(arr[0]=="0")
							    {
							        alert(arr[1]);return false;
							    }
							    else
							    {
							        alert(arr[1]);
							    }
							    self.location="vote.aspx?r="+id;
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/Vote/Vote.aspx?no-cache='+Math.random(),options);
}
function getvcomm(id,t)
{
    var obj = document.getElementById("answerinput");
    var Action = "t=getcomm&id="+id;
	var  options={  
					   method:'get',  
					   parameters:Action,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							    obj.innerHTML="发生错误";
							else
							{
							    var temp="";
							    if(t=="g")
							        temp =" <textarea id=\"commContent\" class=\"f-text\" style=\"height:50px;width:200px;\" />"+returnvalue+"</textarea><br /><input name=\"yes\" type=\"button\" value=\"确 定\" class=\"f-button\" onclick=\"savevcomm("+id+")\" /> <input name=\"no\" type=\"button\" value=\"取消\" onclick=\"getvcomm("+id+",'u');\" class=\"f-reset\"/>";
				                else
				                    temp = " "+returnvalue +" [<a href=\"javascript:void(0);\" onclick=\"getvcomm("+id+",'g');\">修改</a>]";
				                    
				                obj.innerHTML=temp;
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/Vote/Vote.aspx?no-cache='+Math.random(),options);
}
function savevcomm(id)
{
    var obj = document.getElementById("answerinput");
    var Action = "t=savecomm&comm="+escape(document.form1.commContent.value)+"&id="+id;
	var  options={  
					   method:'get',  
					   parameters:Action,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							    obj.innerHTML="发生错误";
							else
							{
							     var temp = "<span class=\"blue pstr padding10\">"+returnvalue +"</span> [<a href=\"javascript:void(0);\" onclick=\"getvcomm("+id+",'g');\">修改</a>]";
				                 obj.innerHTML=temp;
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/Vote/Vote.aspx?no-cache='+Math.random(),options);
}
function vreply(id,pid,uid)
{
    var obj  = document.getElementById("hffrom_"+pid);
    var obj1 = document.getElementById("htfrom_"+pid);
    obj.style.display="";
    obj1.innerHTML="<a href=\"javascript:void(0);\" style=\"float: right;\" onclick=\"hidevreply("+id+","+pid+",'"+uid+"')\">收起回复</a>";    
    var Action = "t=replylist&id="+id+"&uid="+uid+"&pid="+pid;
	var  options={  
					   method:'get',  
					   parameters:Action,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							    obj.innerHTML="发生错误";
							else
							{
                                 obj.innerHTML=returnvalue+"<span><input name=\"reply"+pid+"\" class=\"f-text s50\" type=\"text\" /> <input type=\"button\" value=\"回复\"  class=\"f-button\" onclick=\"vgoreply("+pid+","+id+",'"+uid+"')\" /></span>";
                            }
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/Vote/Vote.aspx?no-cache='+Math.random(),options);
}

function hidevreply(id,pid,uid)
{
    var obj  = document.getElementById("hffrom_"+pid);
    var obj1 = document.getElementById("htfrom_"+pid);
    obj.style.display="none";
    obj1.style.display="";
    obj1.innerHTML="<a href=\"javascript:void(0);\" style=\"float: right;\" onclick=\"vreply("+id+","+pid+",'"+uid+"')\">回复</a>";
}

function vgoreply(pid,id,uid)
{
    var obj  = document.getElementById("hffrom_"+pid);
    var comm = document.form1["reply"+pid].value;
    if(comm=="")
    {
        alert("内容不能为空");
        return;
    }
 
    var Action = "t=goreply&pid="+pid+"&uid="+uid+"&id="+id+"&comm="+escape(comm);
	var  options={  
					   method:'get',  
					   parameters:Action,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							    obj.innerHTML="发生错误";
							else
							{
                                 obj.innerHTML=returnvalue+"<input name=\"reply"+pid+"\" class=\"f-text s50\" type=\"text\" /> <input type=\"button\" value=\"回复\"  class=\"f-button\" onclick=\"vgoreply("+pid+","+id+",'"+uid+"')\" />";
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/Vote/Vote.aspx?no-cache='+Math.random(),options);
}

function delvreply(id)
{
    var obj = document.getElementById("sapnreply_"+id);
    var obj1 = obj.parentElement;
    var Action = "t=delreply&id="+id
	var  options={  
					   method:'get',  
					   parameters:Action,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							    obj.innerHTML="发生错误";
							else
							{
							    obj1.removeChild(obj);
							    closeConfirm();
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/Vote/Vote.aspx?no-cache='+Math.random(),options);
}
function delvote(id,userid)
{
    var Action = "t=delvote&id="+id
	var  options={  
					   method:'get',  
					   parameters:Action,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							    alert("发生错误");
							else
							    self.location=RootDir+'/home/vote/?r='+userid;
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/Vote/Vote.aspx?no-cache='+Math.random(),options);
}