
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>poll</title>
<link rel="stylesheet" type="text/css" href="skin/default/jooyea/css/row_menus.css">
<link rel="stylesheet" type="text/css" href="skin/default/jooyea/css/iframe.css">
<link rel="stylesheet" type="text/css" href="skin/default/jooyea/css/user_ico_small.css">
<!--[if lt IE 7]>
<style type="text/css">
.uico_photo_small span { behavior: url(skin/default/jooyea/css/ie_png_fix.htc);}
</style>
<![endif]-->
<SCRIPT language=JavaScript src="servtools/ajax_client/ajax.js"></SCRIPT>
<script type='text/javascript' src='servtools/calendar.js'></script>
<script type='text/javascript' src="skin/default/js/jooyea.js"></script>
<script type='text/javascript'>
	parent.guide("poll");

function CheckForm(){
	if(trim(document.myform.CONTENT.value)==""){
		parent.Dialog.alert("{echo:lp{g_not_null};/}");
		return (false);
	}
		return (true);
}	
	
	function check_form(){
		var checked_num=0;
		var def=0;
		var pol_cho=document.getElementsByName("pol_cho[]");
		for(def=0;def<pol_cho.length;def++){
			if(pol_cho[def].checked){
				checked_num++;
			}
		}
		if(checked_num==0||checked_num>{echo:$poll_row['maxchoice'];/}){
			parent.Dialog.alert('{echo:lp{pol_num_option};/}:1~{echo:$poll_row["maxchoice"];/}');
			return false;
		}
	}
	
	function refuse_poll(){
		parent.Dialog.alert('{echo:$refuse_str;/}');
		return false;		
	}


	function show_set_config(set_option,pid){
		var point=Get_mouse_position('loc');
		var xmlhttp=InitAjax();
		xmlhttp.open("GET","?app=poll_show_config&set_option="+set_option+"&pid="+pid);
		xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4&&xmlhttp.status==200){				
				document.getElementById("set_config").style.display="";
				document.getElementById("set_config").style.top=point[1]-20+"px";
				document.getElementById("set_config").style.left=point[0]-170+"px";
	  	  var return_str=xmlhttp.responseText;
		    var	return_text=return_str.replace(/[\n\r]/g,"");
		    document.getElementById("set_config").innerHTML=return_text;
			}
		}
		xmlhttp.send(null);		
	}
	
	function action_set_config(set_option,pid){
		var xmlhttp=InitAjax();
		xmlhttp.open("POST","do.php?act=poll_set_config&set_option="+set_option+"&pid="+pid);
		xmlhttp.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");
		xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4&&xmlhttp.status==200){
	  	  var return_str=xmlhttp.responseText;
		    var	return_text=return_str.replace(/[\n\r]/g,"");
		    if(return_text=='success'){
			    cancel_window();
					window.location.reload();
		    }else{
		    	parent.Dialog.alert(return_text);
		    }
			}
		}
		var send_str=null;
		switch(set_option){
			case "stop_award":
			send_str=null;
			break;
			
			case "add_award":
			var obj_num=document.getElementById("award_table").rows.length;
			if(obj_num==3){
				var add_award_sing=document.getElementById("add_award_sing").value;
				var add_award_sum=document.getElementById("add_award_sum").value;
				if(!isNaN(add_award_sum)||!isNaN(add_award_sing)){
					send_str="add_award_sum="+add_award_sum+"&add_award_sing="+add_award_sing;
				}
			}
			if(obj_num==2){
				var add_award_sum=document.getElementById("add_award_sum").value;
				if(!isNaN(add_award_sum)){
					send_str="add_award_sum="+add_award_sum;
				}
			}
			break;
						
			case "add_option":
			var add_new_option=document.getElementById("add_new_option").value;
				send_str="add_new_option="+add_new_option;
			break;
			
			case "del_poll":
			send_str=null;
			break;
			
			case "change_date":
			var expiration=document.getElementById("expiration").value;
			send_str="expiration="+expiration;
			break;
			
			case "add_summary":
			var add_summary=document.getElementById("add_summary").value;
				send_str="add_summary="+add_summary;
			break;
						
		}
		xmlhttp.send(send_str);
	}
	
	function cancel_window(){
		document.getElementById("set_config").style.display="none";
	}

</script>
</head>
<body>
  <div class="main_right_title">
     <span class="main_title_dot5"></span>
     <span class="main_title_txt">{echo:lp{pol_title};/}</span>
  </div>
	<!--按钮控制!-->
	<div id="tabsB" class="{echo:$button_show;/}">
		<ul>
			<li><a href="?app=poll_list&m=new" title="{echo:lp{pol_new};/}"{echo:$n_l;/}><span {echo:$n_r;/}>{echo:lp{pol_new};/}</span></a></li>
			<li><a href="?app=poll_list&m=hot" title="{echo:lp{pol_hot};/}"{echo:$h_l;/}><span {echo:$h_r;/}>{echo:lp{pol_hot};/}</span></a></li>
			<li><a href="?app=poll_list&m=reward" title="{echo:lp{pol_reward};/}"{echo:$r_l;/}><span {echo:$r_r;/}>{echo:lp{pol_reward};/}</span></a></li>
			<li><a href="?app=poll_mine" title="{echo:lp{pol_mine};/}"{echo:$m_l;/}><span {echo:$m_r;/}>{echo:lp{pol_mine};/}</span></a></li>
		</ul>
			<div class="div_but" onclick="location.href='?app=poll_send'">{echo:lp{pol_send};/}</div>
	</div>	
	<!--按钮控制!-->
	<div class="iframe_contentbox">
		<div class="poll_initiator {echo:$sendor_info;/}">
			<div class='poll_photo'>
				<a href="home.php?h={echo:$poll_row['user_id'];/}" target="_blank">
				<img src="{echo:$poll_row['user_ico'];/}" onerror="parent.pic_error(this)" alt='{echo:$poll_row['username'];/}' title='{echo:$poll_row['username'];/}' height='43px' width='43px' /></a>
			</div>
			<div class="poll_userinfo">
				<h3>{echo:filt_word($poll_row['username']);/}发起的投票</h3>
				<p><a class="first" href='home.php?h={echo:$poll_row['user_id'];/}' target='_blank'>{echo:str_replace("{name}",filt_word($poll_row['username']),lp{pol_who_home});/}</a><a href="">TA的投票</a><a href='javascript:window.history.go(-1);'>{echo:lp{pol_re_last};/}</a></p>
			</div>
			{sta:if($ses_uid)[exc]}
			<span class="poll_share"><a href='javascript:void(0)' onclick="parent.show_share(4,{echo:$poll_row['p_id'];/},'{echo:filt_word($poll_row['subject']);/}','','');" class='fenxiang {echo:$show_share;/}'>{echo:lp{mn_share};/}</a><a class="jubao" href="javascript:void(0);" onclick="parent.report(4,{echo:$poll_row['user_id'];/},{echo:$poll_row['p_id'];/});">{echo:lp{mn_report};/}</a></span>
			{end:if/}
		</div>
		<div class="clear"></div>
		<dl class="poll_info">
			<dd>{echo:lp{pol_send_date};/}<span>{echo:$poll_row['dateline'];/}</span></dd>
			<dd>{echo:lp{pol_stop_time};/}<span>{echo:$poll_row['expiration'];/}</span><dd>
			<dd>{echo:lp{pol_leave_int};/}<span>{echo:$poll_row['credit'];/}</span><dd>
			<dt>{echo:lp{pol_join_num};/}<span>{echo:$poll_row['voternum'];/}</span><dt>
		</dl>
		{sta:if($poll_row['is_pass']==1 || $is_admin!='' && !empty($poll_row))[exc]}
			{sta:if($ses_uid==$poll_row['user_id'])[exc]}
			<ul class="poll_mag {echo:$show_data;/}">
				<li><a href='javascript:void(0)' onclick='show_set_config("stop_award",{echo:$poll_row["p_id"];/});'>{echo:lp{pol_s_award};/}</a></li>
				<li><a href='javascript:void(0)' onclick='show_set_config("add_award",{echo:$poll_row["p_id"];/});'>{echo:lp{pol_add_award};/}</a></li>
				<li><a href='javascript:void(0)' onclick='show_set_config("add_option",{echo:$poll_row["p_id"];/});'>{echo:lp{pol_add_option};/}</a></li>
				<li><a href='javascript:void(0)' onclick='show_set_config("del_poll",{echo:$poll_row["p_id"];/});'>{echo:lp{pol_del_poll};/}</a></li>
				<li><a href='javascript:void(0)' onclick='show_set_config("change_date",{echo:$poll_row["p_id"];/});'>{echo:lp{pol_c_date};/}</a></li>
				<li><a href='javascript:void(0)' onclick='show_set_config("add_summary",{echo:$poll_row["p_id"];/});'>{echo:lp{pol_write_sum};/}</a></li>
			</ul>
			{end:if/}
		   <div id='set_config' style='display:none;' class='ajax_window'></div>
		   <div class="clear"></div>
		   <div class="poll_title"><span class="main_title_dot5"></span>{echo:filt_word($poll_row['subject']);/}<span class="poll_choice">{echo:str_replace("{s_num}",$poll_row['maxchoice'],lp{pol_s_num});/}</span>
		   </div>
		   <div class='poll_credit {echo:$show_award_int;/}'>{echo:str_replace("{int}",$poll_row['percredit'],lp{pol_award_int});/} {echo:filt_word($poll_row['message']);/}</div>

	<form action='{echo:$action_URL;/}' method='post' onsubmit='return {echo:$check_form;/}' style='margin-left:0px'>
		<input type='hidden' name='credit' value='{echo:$poll_row['credit'];/}' />
		<input type='hidden' name='percredit' value='{echo:$poll_row['percredit'];/}' />
		<input type='hidden' name='subject' value='{echo:$poll_row['subject'];/}' />
	{sta:$default_id=0;/}
	{sta:foreach($p_result_rs as $rs)[loop]}
	
		<div class="poll_area"><input type='{echo:choo_type($poll_row['multiple']);/}' name='pol_cho[]' value="{echo:$rs['oid'];/}" class='{echo:$show_check;/} poll_selbt' />
			<div class="poll_option">{echo:$rs['option'];/}：</div>
			<div class="poll_percent">
				<div id='poll_bg_{echo:$default_id;/}' class="poll_init" style="width:1px;"></div>
			</div>&nbsp;{echo:$rs['votenum'];/}&nbsp;({echo:option_per($rs['votenum'],$sum_poll_num['sum_votenum']);/}%)
		</div>
	{sta:if(!empty($sum_poll_num['sum_votenum']))[exc]}
		<script type='text/javascript'>
			function incr(){
				var width_val=parseInt(document.getElementById("poll_bg_{echo:$default_id;/}").style.width);		
				
				if(width_val>=140*{echo:$rs['votenum']/$sum_poll_num['sum_votenum'];/}){
					window.clearInterval("padding_option_{echo:$default_id;/}");
				}else{
					document.getElementById("poll_bg_{echo:$default_id;/}").style.width=width_val+1+"px";
				}
			}
			var color_type=Array("b1.gif","b2.gif","b3.gif","b4.gif","b5.gif","b6.gif","b7.gif","b8.gif","b9.gif","b10.gif","b1.gif");
			var color_s=Math.round(Math.random()*10);
			var url = "url(skin/default/jooyea/images/vote/"
			document.getElementById("poll_bg_{echo:$default_id;/}").style.backgroundImage = url + color_type[color_s] +')';			
			var padding_option_{echo:$default_id;/}=window.setInterval(incr,30);
			
		</script>
	{end:if/}	
	{sta:$default_id++;/}
	{end:foreach/}
	<div class="poll_button">
		<input type='submit' class='top_button' name='action' value='{echo:lp{pol_title};/}' />&nbsp;&nbsp;<input type='checkbox' value='1' name='anonymity' />{echo:lp{pol_anon};/}
	</div>	
	</form>
<div class="clear"></div>
<!--总结报告!-->
<div class='poll_summary {echo:$show_sumary;/}'>
	{echo:str_replace("{name}",filt_word($poll_row['username']),lp{pol_sumary});/}
	<div class='poll_summary_content'>
		<div class="left_g left"></div><div class="center_g left">{echo:filt_word($poll_row['summary']);/}</div><div class="right_g left"></div>
	</div>
</div>
</div>

<!--最新投票区!-->
<div class="container {echo:$show_poll_info;/}">
	<div class="rs_head">{echo:lp{pol_info};/}</div>
</div>
<ul class="poll_list">
{sta:foreach($p_put_info as $rs)[loop]}
	<li class='poll_credit'>{echo:anon_poll($rs['anony'],$rs['uid'],$rs['username']);/} {echo:str_replace(array("{date}","{option}"),array(format_datetime_txt($rs['dateline']),$rs['option']),lp{pol_input_info});/}</li>
{end:foreach/}
</ul>

<div class="tleft ml20">
		<div class="replytip"></div>
		<div id='show_4_{echo:$poll_row["p_id"];/}'>
			{echo:get_restore($dbo,4,$poll_row["p_id"],0,20);/}
		</div>
		{sta:if($ses_uid!='')[exc]}	
		<div class="reply {echo:$show_i_com;/}">
			<img src='{echo:get_sess_userico();/}' onerror="parent.pic_error(this)" />
			<textarea maxlength="160" onkeyup="return isMaxLen(this)" style="height:50px" id="reply_4_{echo:$poll_row['p_id'];/}_input"></textarea>
			<div class="replybt">
				<input class="left button2" onclick="parent.restore_com({echo:$poll_row['user_id'];/},4,{echo:$poll_row['p_id'];/});show('face_list_menu',200)" type="submit" name="button" id="button" value="{echo:lp{pol_submit};/}" />
				<a id="reply_a_{echo:$poll_row['p_id'];/}_input" class="right" href="javascript:void(0);" onclick=" showFace(this,'face_list_menu','reply_4_{echo:$poll_row['p_id'];/}_input');">{echo:lp{pol_face};/}</a> 
			</div>
			<div class="clear"></div>
		</div>
		{end:if/}
		</div>
{end:if/}
	<!-- face begin -->
	<div id="face_list_menu" class="emBg" style="display:none;z-index:100;">
	</div>
	<!-- face end -->

<!--无数据-->
<div class="pageerr {echo:$show_error;/}">
	{echo:$error_str;/}
</div>

</body>
</html>
