<?php
	if( !is_array($active) ){
		ob_clean();
		header("Location: index.php?id=".$fid);	
	}
?>

<?php
		
	foreach( $VICACHE["mod.forms"]["groups"] as $gid => $group ){
		
		$item = '';				
		$temp = 'G-'.$gid;
		$config = json_decode($group["config"],true);
		
		$tr .= '
			<tr class="title">
				<td class="tag-id"></td>
				<td class="tag-option"><strong>'.$group["name"].'</strong></td>
				<td class="tag-scale">'.$Modules[$appid]["groups"][$group["type"]].'</td>
			</tr>
		';
		
		
		$js .= 'var G = new P.Group('.$gid.');';		
			
		//子选项
		$x = 1;
		foreach( $VICACHE["mod.forms"]["options"] as $oid => $option ){
			
			if( $gid == $option["gid"] && $option["status"] ){
				
				$tr .= '<tr class="line">
							<td>'.$x.'</td>
							<td>'.$option["name"].'</td>
							<td>
								<span class="count">'.($option["stat"]).' 票</span>
								<span id="percent-'.$oid.'">0%</span>
								<div class="ratio"><span id="option-'.$oid.'" style="background:'.rand_color().';" /></div>
							</td>
						</tr>
						';
						
				$js .= 'G.Option('.$oid.','.$option["stat"].');';
				
				$x ++;
			}				
		}				
		$tr .= '</tr>';
		
	}
	
	
	echo '<fieldset><legend>表单结果</legend>';
	echo '
	<table id="result" border="0" cellpadding="3" cellspacing="1">
		'.$tr.'
	</table>	
	';
	
	echo '</fieldset>';
	
	echo "
	<div id='send'>
		<p>
		<input type='button' class='submit' name='button' onclick='location.href=\"?mode=$mode&id=".$VICACHE["mod.forms"]["id"]."\";' value='返回活动' />
		<input type='button' class='submit' name='button' onclick='window.close();' value='关闭窗口' />
		</p>
	</div>
	";
	
	echo '<script type="text/javascript">var P = new VeryIDE.Process();'.$js.'P.Show();</script>';

?>