<?php require_once 'nsoconfig.php';?>
<?php include_once '_cake_top.php';?>
<script type="text/javascript" src="javascripts/jquery/jquery.form.js"></script>
<script type="text/javascript">
$(function(){
    var options = { 
        beforeSubmit:  formSubmit,  // pre-submit callback 
        //success:       saveFeeback  // post-submit callback 
    }; 
    $('#form').ajaxForm( options );
	
});

function formSubmit(formData, jqForm, options) { 
	$('#submit').hide();
	alert('提交成功!');
    return true; 
}
</script>
    <?php include_once '_cake_header.php';?>
    <div id="main-content">
        <?php include_once'_cake_searchbar.php'?>
        <div id="contain">
            <table cellspacing="0" cellpadding="0" border="0">
                <tbody>
                    <tr>
                        <td align="center"><form style="width:950px;" id="form" action="saveguestbook.php" method="post" name="form1">
                                <table height="10" cellspacing="0" cellpadding="0" border="0">
                                    <tbody>
                                        <tr>
                                            <th scope="col"></th>
                                        </tr>
                                    </tbody>
                                </table>
                                <table style="text-align:left;width:950px;" class="tab3">
                                    <tbody>
                                        <tr bgcolor="#006699">
                                            <td bgcolor="#EDF2F8" colspan="4"><font color="#000000"><img width="32" height="32" align="absbottom" src="img/ly.gif">请您留言：</font></td>
                                        </tr>
                                        <tr bgcolor="#ffffff">
                                            <td width="160" bgcolor="#ffffff" style="text-align:right">姓名：</td>
                                            <td width="300" bgcolor="#ffffff"><input type="text" maxlength="20" name="name">
                                                <font color="#ff0000">* </font></td>
                                            <td width="90" bgcolor="#ffffff"><div align="center">标题：</div></td>
                                            <td width="400" bgcolor="#ffffff"><input type="text" maxlength="49" name="title">
                                                <font color="#ff0000"> * </font></td>
                                        </tr>
                                        <tr bgcolor="#ffffff">
                                            <td style="text-align:right">电子邮件：</td>
                                            <td><input type="text" maxlength="49" name="email"></td>
                                            <td rowspan="3"><div align="center">内容：</div></td>
                                            <td rowspan="3"><textarea rows="5" cols="60" name="content"></textarea>
                                                <font color="#ff0000">* </font></td>
                                        </tr>
                                        <tr bgcolor="#ffffff">
                                            <td style="text-align:right">联系电话：</td>
                                            <td><input type="text" maxlength="33" name="phone"></td>
                                        </tr>
                                        <tr bgcolor="#ffffff">
                                            <td style="text-align:right">地址：</td>
                                            <td><select name="addr">
                                                    <option value="其它">其它 </option>
                                                    <option value="上海">上海 </option>
                                                    <option value="北京">北京 </option>
                                                    <option value="香港">香港 </option>
                                                    <option value="澳门">澳门 </option>
                                                    <option value="台湾">台湾 </option>
                                                    <option value="上海">上海 </option>
                                                    <option value="广东">广东 </option>
                                                    <option value="山东">山东 </option>
                                                    <option value="四川">四川 </option>
                                                    <option value="福建">福建 </option>
                                                    <option value="江苏">江苏 </option>
                                                    <option value="浙江">浙江 </option>
                                                    <option value="天津">天津 </option>
                                                    <option value="重庆">重庆 </option>
                                                    <option value="河北">河北 </option>
                                                    <option value="河南">河南 </option>
                                                    <option value="黑龙江">黑龙江 </option>
                                                    <option value="吉林">吉林 </option>
                                                    <option value="辽宁">辽宁 </option>
                                                    <option value="内蒙古">内蒙古 </option>
                                                    <option value="海南">海南 </option>
                                                    <option value="山西">山西 </option>
                                                    <option value="陕西">陕西 </option>
                                                    <option value="安徽">安徽 </option>
                                                    <option value="江西">江西 </option>
                                                    <option value="甘肃">甘肃 </option>
                                                    <option value="新疆">新疆 </option>
                                                    <option value="湖北">湖北 </option>
                                                    <option value="湖南">湖南 </option>
                                                    <option value="云南">云南 </option>
                                                    <option value="广西">广西 </option>
                                                    <option value="宁夏">宁夏 </option>
                                                    <option value="贵州">贵州 </option>
                                                    <option value="青海">青海 </option>
                                                    <option value="西藏">西藏</option>
                                                </select></td>
                                        </tr>
                                        <tr bgcolor="#ffffff" id="submit">
                                            <td colspan="4"><div align="center">
                                                    <input type="submit" value="提      交" name="submit">
                                                    &#12288;&#12288;&#12288;&#12288;
                                                    <input type="reset" value="重      置" name="submit2">
                                                </div></td>
                                        </tr>
                                    </tbody>
                                </table>
                                <br>
                            </form>
                            <?php
							require_once NSO_INC_PATH . 'Pager.php';
							
							$sql = "SELECT * FROM qa 
									WHERE answer IS NOT NULL 
									ORDER BY date DESC";
							$pager = new Pager($nsodb, $sql, 15);
							$rs = $pager->getResults();
							if ($rs): foreach ($rs as $row):
							?>
                            <table width="950" style="text-align:left" class="tab3">
                                <tbody>
                                    <tr align="left">
                                        <td width="573" valign="middle" height="17" bgcolor="#ffffff"><font color="#000000"><b class="gray">标题</b> ：<b><?php echo $row['title']?></b> </font></td>
                                        <td width="188" valign="bottom" height="17" bgcolor="#ffffff"><font color="#000000"><img width="32" height="32" align="absbottom" src="img/0046.gif">留言人姓名：<?php echo $row['name']?></font></td>
                                    </tr>
                                    <tr align="left">
                                        <td height="50" bgcolor="#ffffff" colspan="2"><?php echo $row['question']?></td>
                                    </tr>
                                    <tr bgcolor="#e8e8e8" align="left">
                                        <td height="20" bgcolor="#EDF2F8" colspan="2"><span class="style9">专家解答：</span><br>
                                            <?php echo $row['answer']?></td>
                                    </tr>
                                    <tr>
                                        <td height="20" bgcolor="#ffffff" colspan="2"><div align="right"><font color="#000000"><img width="20" height="20" align="absbottom" src="img/0030.gif">发表时间：<?php echo $row['date']?>&#12288;&#12288;地区：<?php echo $row['address']?><img width="20" height="20" align="absbottom" src="img/0135.gif">&#12288;&#12288;编号：<?php echo $row['id'];?></font></div></td>
                                    </tr>
                                </tbody>
                            </table>
                            <table width="99%" cellspacing="0" cellpadding="0" border="0">
                                <tbody>
                                    <tr>
                                        <td height="40"></td>
                                    </tr>
                                </tbody>
                            </table>
                            <?php endforeach; endif;?>
                         </td>
                    </tr>
                </tbody>
            </table>
            <div><?php echo $pager->getNavigation();?></div>
        </div>
    </div>
    <?php include_once '_cake_footer.php';?>