<?php
	if( !is_array($active) ){
		ob_clean();
		header("Location: index.php?id=".$fid);	
	}
?>
<script type="text/javascript">
addLoadEvent(
	function(){		
		
		//vote
		var ul=$("select-vote").getElementsByTagName("li");
		
		var len=ul.length;
		for(var i=0;i<len;i++){
	
			(function(){
				var self=ul;
				var li=self[i];
				
				li.onclick=function(){
					
					for(var j=0;j<len;j++){
						self[j].className=self[j].className.replace(" active","");
					}
					
					this.className+=" active";
					//this.getElementsByTagName("input")[0].checked = true;
					
					$("OBJECT").value = this.getAttribute("rel");
				}
				
			})();
		}
		
		$("form").onsubmit=function(){
			var result= VeryIDE.VerifyForm(this,function(i){
				/*未加载 Effect 组件*/
				if(!VeryIDE.script["effect"]){
					alert(i);
				}else{
					VeryIDE.Message('error','error',i,3);
				}

			});
			return result;
		}
	}
);
</script>

<?php
	echo "<form id='form' name='form' method='post' action='?action=post&id=".$VICACHE["mod.forms"]["id"]."'>";
	
	echo "<input type='hidden' value='".rand_string(10)."' name='verify' />";
	
	//var_dump($config);
	
	//正反方
	echo '
		<ul id="select-vote">
			<li id="posi-box" class="positive" rel="POSITIVE">'.ubb_basic($config["POSITIVE_POINT"]).'<b id="posi-vote">'.($config["POSITIVE_RESULT"]?$config["POSITIVE_RESULT"]:0).'('.$config["POSITIVE"].')</b> </li>
			<li id="nega-box" class="negative" rel="NEGATIVE">'.ubb_basic($config["NEGATIVE_POINT"]).'<b id="nega-vote">'.($config["NEGATIVE_RESULT"]?$config["NEGATIVE_RESULT"]:0).'('.$config["NEGATIVE"].')</b> </li>
		</ul>
	';
	
		//表单可用
		if( $config["HIDE_MESSAGE"]=="N" ){
	
		echo "
			<div id='message'>
			
				<p>我的评论：</p>
				<p>
					<textarea name='MESSAGE' id='MESSAGE' cols='50' rows='4' fix_name='我的评论' fix_null='yes'></textarea>
				</p>
			
				<p id='form-smile' class='smile'></p>
				
				<input type='hidden' name='OBJECT' id='OBJECT' value='' class='radio' fix_name='正反方' fix_null='yes' />
			
			</div>
		";
		
		}
	
		//使用匿名扩展模式
		if( $config['USER_MODE'] == "ANY" && ( array_key_exists( "ANY_ACCOUNT", $config ) || array_key_exists( "ANY_NAME", $config ) || array_key_exists( "ANY_IDCARD", $config ) || array_key_exists( "ANY_PHONE" , $config ) ) ){
		
			$member = $_SESSION["Member"]["id"] ? passport_member( $_SESSION["Member"]["id"] ) : array();
			
			$extra = '
			<p>
				'.( $config["ANY_ACCOUNT"] ? '用户名：<input type="text" size="20" name="ACCOUNT" class="text" value="'.$member["account"].'" fix_name="您的用户名" fix_null="yes" />' : '' ).'
				'.( $config["ANY_NAME"] ? '姓名：<input type="text" size="20" name="NAME" class="text" value="'.$member["name"].'" fix_name="您的姓名" fix_null="yes" />' : '' ).'
				'.( $config["ANY_PHONE"] ? '电话：<input type="text" size="20" name="PHONE" class="text" value="'.$member["phone"].'" fix_name="您的电话" fix_null="yes" fix_number="yes" />' : '' ).'
				'.( $config["ANY_IDCARD"] ? '身份证：<input type="text" size="20" name="IDCARD" class="text" value="'.$member["idcard"].'" fix_name="您的身份证" fix_card="yes" />' : '' ).'
			</p>
			';
		}
	
		echo "
		<div id='send'>
			".$extra."
			<p>
			".( ( $VICACHE["mod.forms"]["start"]<time() && $VICACHE["mod.forms"]["expire"]>time() && $VICACHE["mod.forms"]["status"] ) ?"<input type='submit' class='submit' value='提交表单' />": "<input type='submit' class='submit' value='".($VICACHE["mod.forms"]["start"]>time()?"暂未启用":"表单过期")."' disabled='disabled' />") ."			
			
			".(!$config["HIDE_RESULT"]?"<input type='button' class='submit' name='button' onclick='location.href=\"?mode=$mode&action=result&id=".$VICACHE["mod.forms"]["id"]."&skin=".$skin."#top\";' value='查看结果' />":"")."			
			</p>
		</div>";
		
	echo "</form>";

?>