var WebAppPath="http://www.fccs.com";function VoteGroupGetList(c,b,a){$.getJSON(WebAppPath+"/vote/VoteAction.do?method=getVoteListToJSON&directoryId="+b+"&jsoncallback=?",function(f){var e="";var l=f.list;var g="";var h=1;for(j in l){g+=l[j].voteId+","}e='<div class="'+c+'_directory">'+f.directory.name+"</div>";e+='<table width="100%" border="0" cellspacing="0" cellpadding="0">';for(j in l){e+="<tr>";e+='<td id="title_'+l[j].voteId+'" class="'+c+'_td"><div class="'+c+'_title">'+(h++)+"、"+l[j].title+"</div>";var k=l[j].optionList;for(i in k){var d=l[j].voteType==1?"radio":"checkbox";e+="<label>";e+='<input type="'+d+'" name="vote_'+l[j].voteId+'" value="'+k[i].voteOptionId+'" />';e+='<span class="'+c+'_option">'+k[i].optionName+"</span>&nbsp;&nbsp;";e+="</label>";e+="<br/>"}e+="</td>";e+="</tr>"}e+="</table>";e+='<div class="'+c+'_buttons">';e+='<div id="'+c+'_submit" class="'+c+'_submit" onclick="javascript:VoteGroupSubmitLoading(-'+b+", '"+c+"');\"></div>";e+='<div class="'+c+'_result" onclick="javascript:VoteResult(-'+b+');"></div>';e+="</div>";$("#"+a).html(e)})}function VoteGet(e,d,a,c,b){$.getJSON(WebAppPath+"/vote/VoteAction.do?method=getVoteToJSON&id="+d+"&jsoncallback=?",function(h){var g="";var n=h;var k="";var l=0;g="";g+='<table width="100%" border="0" cellspacing="0" cellpadding="0">\n';g+="<tr>\n";g+='<td id="title_'+n.voteId+'" class="'+e+'_td">\n';if(b==true){g+='<div class="'+e+'_title">'+n.title+"</div>\n"}var m=n.optionList;for(i in m){l++;var f=n.voteType==1?"radio":"checkbox";g+="<label>";g+='<input type="'+f+'" name="vote_'+n.voteId+'" value="'+m[i].voteOptionId+'" />';g+='<span class="'+e+'_option">'+m[i].optionName+"</span>";g+="</label>\n";if(l%c==0){g+="<br/>\n"}}g+="</td>\n";g+="</tr>\n";g+="</table>\n";g+='<div class="'+e+'_buttons">\n';g+='<div id="'+d+'_submit" class="'+e+'_submit" onclick="javascript:VoteGroupSubmitLoading('+d+", '"+e+"');\"></div>\n";g+='<div class="'+e+'_result" onclick="javascript:VoteResult('+d+');"></div>\n';g+="</div>\n";$("#"+a).html(g)})}function VoteGroupSubmitLoading(a,d){var c=VoteGroupGetData();if(c.length==0){alert("请选择数据！");return}var b=VotePostActionUrl(a,c);$("#"+d+"_submit").removeClass();$("#"+d+"_submit").addClass(d+"_submit_loading");$.getJSON(b,function(e){alert(e.msg);$("#"+d+"_submit").removeClass();$("#"+d+"_submit").addClass(d+"_submit")})}function VoteGroupSubmitSimple(a){a=-a;var c=VoteGroupGetData();if(c.length==0){alert("请选择数据！");return}var b=VotePostActionUrl(a,c);$.getJSON(b,function(d){alert(d.msg)})}function VoteGroupFormSubmitSimple(a,b){a=-a;var c=VoteGroupGetData();if(c.length==0){alert("请选择数据！");return}$.getJSON(WebAppPath+"/vote/VoteAction.do?method=VoteSubmitToJSON&voteId="+a+"&jsoncallback=?",{voteOptionIdList:c.join("-"),name:encodeURIComponent(isEmpty($("#name").attr("value"))),address:encodeURIComponent(isEmpty($("#address").attr("value"))),card:encodeURIComponent(isEmpty($("#card").attr("value"))),phone:encodeURIComponent(isEmpty($("#phone").attr("value")))},function(d){b(d)})}function VoteSubmitSimple(c){var b=VoteGroupGetData();if(b.length==0){alert("请选择数据！");return}var a=VotePostActionUrl(c,b);$.getJSON(a,function(d){alert(d.msg)})}function VoteGroupGetData(){var d=document.getElementsByTagName("INPUT");var e="";var g=new Array();for(var b=0;b<d.length;b++){if(e!=d[b].name){e=d[b].name;if(e.indexOf("vote_")!=-1){g.push(e)}}}var f=new Array();for(var b=0;b<g.length;b++){var h=document.getElementsByName(g[b]);var c=false;for(var a=0;a<h.length;a++){if(h[a].checked==true){f.push(h[a].value);c=true}}}return f}function VotePostActionUrl(b,a){return WebAppPath+"/vote/VoteAction.do?method=VoteSubmitToJSON&voteId="+b+"&voteOptionIdList="+a.join("-")+"&jsoncallback=?"}function VoteResult(a){window.open(WebAppPath+"/vote/common/vote_result.jsp?id="+a)}function VoteResultSimple(a){VoteResult(-a)}function isEmpty(a){if(typeof(a)=="undefined"){return""}return a}function CommentSubmit(){$("#anonymity").attr("value",$("#anonymity").attr("checked")==false?0:1);$.getJSON(WebAppPath+"/comment/CommentAction.do?method=SaveToJSON&jsoncallback=?",{type:$("#type").val(),dataId:$("#dataId").attr("value"),userId:$("#userId").attr("value"),userCount:$("#userCount").attr("value"),anonymity:$("#anonymity").attr("value"),nickname:encodeURIComponent(isEmpty($("#nickname").attr("value"))),comment:encodeURIComponent($("#comment").attr("value")),data1:encodeURIComponent(isEmpty($("#data1").attr("value"))),data2:encodeURIComponent(isEmpty($("#data2").attr("value"))),data3:encodeURIComponent(isEmpty($("#data3").attr("value"))),data4:encodeURIComponent(isEmpty($("#data4").attr("value"))),data5:encodeURIComponent(isEmpty($("#data5").attr("value"))),data6:encodeURIComponent(isEmpty($("#data6").attr("value"))),data7:encodeURIComponent(isEmpty($("#data7").attr("value"))),data8:encodeURIComponent(isEmpty($("#data8").attr("value"))),data9:encodeURIComponent(isEmpty($("#data9").attr("value")))},function(a){alert(a.msg);if(a.msg=="提交成功，谢谢您的参与！"){window.location.reload()}})}$(document).ready(function(){$("#comment_submit").click(function(){if($("#nickname").val()==""&&$("#anonymity").attr("checked")==false){alert("请填写您的昵称！");$("#nickname").focus();return}if($("#comment").val()==""){alert("请填写您的评论！");$("#comment").focus();return}if($("#comment").val().length>=100){alert("您填写的评论太长了，不能超过100个字符！");$("#comment").focus();return}CommentSubmit()})});
