<?php
require("conn.php");
ob_start();
session_start(); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>预约家教</title>
<link href="css/css.css" rel="stylesheet" type="text/css"> 
<style type="text/css">
<!--
body { 
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style></head> 
<script language="javascript">
function refresh_code() { login_form.imgcode.src="verifycode.php?a="+Math.random(); }
function onfocus_check(id) { id.style.border='2px #FF0000 solid'; }
function onblur_check(id) { id.style.border='1px #6CB5FF solid'; }
var xmlHttp
function sort_list(id,city_id)
{
var url='city_select.php?submit_action=1&id='+id+'&city_id='+city_id;
if (window.ActiveXObject)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")	
}
else if (window.XMLHttpRequest)
{
xmlHttp=new XMLHttpRequest()
}
xmlHttp.open("GET",url,true)
xmlHttp.onreadystatechange=stateChanged
xmlHttp.send(null)
}

function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("city_sort").innerHTML=xmlHttp.responseText
}
}

var subject_xmlHttp
function subject_list(id)
{
var url='subject_select.php?submit_action=1&id='+id;
if (window.ActiveXObject)
{
subject_xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")	
}
else if (window.XMLHttpRequest)
{
subject_xmlHttp=new XMLHttpRequest()
}
subject_xmlHttp.open("GET",url,true)
subject_xmlHttp.onreadystatechange=subject_stateChanged
subject_xmlHttp.send(null)
}

function subject_stateChanged()
{
if (subject_xmlHttp.readyState==4 || subject_xmlHttp.readyState=="complete")
{
document.getElementById("subject_sort").innerHTML=subject_xmlHttp.responseText
}
}

function select_option_add(select_value,id) {
for (i=0;i<=user_form.subject_name.options.length-1;i++) { if (user_form.subject_name.options[i].selected==true) { subject_option_1=user_form.subject_name.options[i].text; } }
subject_option_2=select_value.substr(select_value.indexOf(',')+1,select_value.length-(select_value.indexOf(',')+1));
if (subject_option_2=='--------选择--------') { exit; }
for (k=0;k<=user_form.subject_name_2.options.length-1;k++) { if (user_form.subject_name_2.options[k].text==subject_option_1+'（'+subject_option_2+'）') { alert(subject_option_1+'（'+subject_option_2+'）不能重复选择!'); exit; } }
var option_value=document.createElement('option');
option_value.value=user_form.subject_name.options[0].value;
option_value.text=subject_option_1+'（'+subject_option_2+'）';
user_form.subject_name_2.add(option_value);
for (k=0;k<=user_form.subject_name_2.options.length-2;k++) { user_form.subject_name_2.options[k].selected=false; }
user_form.subject_name_2.options[user_form.subject_name_2.options.length-1].selected=true;
user_form.subject_content.value=user_form.subject_content.value+subject_option_1+'（'+subject_option_2+'）,'; }

function select_option_del() { var option_length=user_form.subject_name_2.options.length-1; for (i=0;i<=option_length;i++) { if (user_form.subject_name_2.options[i].selected==true) { id=i; subject_option=user_form.subject_name_2.options[i].text+','; } user_form.subject_name_2.options[i].selected=false; } user_form.subject_name_2.remove(id); user_form.subject_content.value=user_form.subject_content.value.replace(subject_option,''); id=-1; }
function on_off(id) { if (id=='1') { student_number_table.style.display=''; user_form.student_number[0].checked=true; } else { student_number_table.style.display='none'; } }

function user_form_check() { 
if (user_form.username.value=='') { alert('请输入您的姓名!'); user_form.username.focus(); return false; }
if (user_form.sex.value=='') { alert('请选择您的性别!'); user_form.sex.focus(); return false; }
if (user_form.occupation_value.value=='') { alert('请选择教员身份!'); user_form.occupation_value.focus(); return false; }
if (user_form.province_name.value=='') { alert('请选择所在区域!'); user_form.province_name.focus(); return false; }
if (user_form.tel.value=='') { alert('请输入联系电话!'); user_form.tel.focus(); return false; }
if (user_form.email.value=='') { alert('请输入电子邮箱!'); user_form.email.focus(); return false; }
if (user_form.address.value=='') { alert('请输入授课地址!'); user_form.address.focus(); return false; }
if (user_form.subject_content.value=='' || user_form.subject_content.value==',') { alert('请选择可辅导课程!'); user_form.subject_name_2.focus(); return false; }
}

function table_on() { search_table.style.display=''; search_on.style.display='none'; search_off.style.display=''; }

function table_off() {
search_table.style.display='none';
search_on.style.display='';
search_off.style.display='none';

var option_length=user_form.subject_name.options.length-2; for (i=1;i<=option_length;i++) { user_form.subject_name.options[i].selected=false; }
subject_list(0);
user_form.subject_name.options[0].selected=true;

var option_length=user_form.subject_name_2.options.length-1; for (i=0;i<=option_length;i++) { user_form.subject_name_2.remove(0); user_form.subject_content.value=',';
}
for (i=0;i<=20;i++) { user_form.service_time[i].checked=false; }
user_form.school.value='';
user_form.professional.value='';
user_form.state_value.value=''; 
user_form.effective_value.value='';
user_form.class_value.value='';
for (i=0;i<=5;i++) { user_form.student_number[i].checked=false; }
student_number_table.style.display='none';
}

function select_width_check(id,length_value) {
if (navigator.userAgent.indexOf('Firefox')==-1) {
for(i=0;i<=id.options.length-1;i++) {
var option_length=0;
for (k=0;k<=length_value*2;k++) {
if (id.options[i].text.substr(k,1)!='') { if (id.options[i].text.charCodeAt(k)>200) { option_length=option_length+2; } else { option_length=option_length+1; } }
}
if (option_length>length_value*2) { id.style.width='auto'; exit; } } } }
</script>
<?php
 if ($_POST['province_name']!='') { $province_name=str_sql($_POST['province_name']); } else { $province_name=str_sql($_GET['province_name']); } 
	   if ($_POST['subject_name']!='') { $subject_name=str_sql($_POST['subject_name']); } else { $subject_name=str_sql($_GET['subject_name']); }?><body onLoad="javascript:<?php if ($province_name=='' && trim(strpos($_COOKIE['area_id'],','))=='') { ?>sort_list('','');<?php } if ($subject_name=='') { ?>subject_list('');<?php } ?>"><div align="center">
<?php require('top.php'); ?>
<table width="970" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td width="220" align="left" valign="top"><table width="210" border="0" cellpadding="0" cellspacing="0" style="border:1px #BCDFFF solid;">
        <tr>
          <td height="30" background="images/sort_top.jpg"><table width="210" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td width="156" align="left" style="font-size:14px;font-weight:bold;">　课程分类</td>
                <td width="54" style="font-size:12px;">&nbsp;</td>
              </tr>
          </table></td>
        </tr>
        <tr>
          <td style="height:20px;"></td>
        </tr>		
        <tr>
          <td valign="top"><table width="210" border="0" cellpadding="0" cellspacing="0" style="font-size:12px;">
              <tr>
                <td height="40" valign="top" class="sort_css">　<a href="teacher_list.php">所有</a></td>
                <td>&nbsp;</td>
              </tr>
              <?php 
			  $sort_check="select * from sort_info_manage where sort_id='subject' order by order_id";
			  $rs_sort_check=mysql_query ($sort_check);
			  while ($rs_sort_list=mysql_fetch_object ($rs_sort_check)) {
			  $id=$rs_sort_list->id;
			  ?>
              <tr><td height="30" style="font-size:14px;">　<?=$rs_sort_list->sort_title?></td><td>&nbsp;</td></tr>
			  <?php $sort_check_1="select * from sort_info_manage where sort_id='$id' order by order_id";			  
			  $rs_sort_check_1=mysql_query ($sort_check_1);
			  if (intval(mysql_num_rows($rs_sort_check_1)/2)==mysql_num_rows($rs_sort_check_1)/2) { $rows_number=mysql_num_rows($rs_sort_check_1)/2; } else { $rows_number=intval(mysql_num_rows($rs_sort_check_1))/2+1; }			  
			  for ($i=1;$i<=$rows_number;$i++) {
			  ?>	  
              <tr>		
				<?php for ($k=1;$k<=2;$k++) { if ($rs_sort_list_1=mysql_fetch_object ($rs_sort_check_1)) { ?><td height="20" class="news_css">　<a href="teacher_list.php?subject_content=,<?=$rs_sort_list->sort_title?>（<?=$rs_sort_list_1->sort_title?>）,&subject_off=1"><?=$rs_sort_list_1->sort_title?></a></td><?php } } ?>             </tr>
			  <?php } ?>			  
              <tr>
                <td height="20" colspan="2">&nbsp;</td>
                </tr>
              <?php } ?>
          </table></td>
        </tr>
        <tr>
          <td style="height:10px;"></td>
        </tr>
      </table>
        <table width="210" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td style="height:10px;"></td>
          </tr>
          <?php $ad_check="select * from ad_info_data where sort_id='3'";		  
		  $rs_ad_check=mysql_query ($ad_check);
		  $rs_ad_list=mysql_fetch_object ($rs_ad_check); ?>
          <tr>
            <td style="border:1px #BCDFFF solid;"><!--<a href="<? //$rs_ad_list->url_info?>" target="_blank"><img src="<? //$rs_ad_list->pic_url?>" width="210" height="450" border="0"></a>--><iframe src="tg/ad.php?submit_action=1" width="210" height="450" scrolling="no" frameborder="0"></iframe></td>
          </tr>		  
        </table></td>
		

<td width="750" align="left" valign="top"><form name="user_form" method="post" action="order_action.php?type_action=add" onSubmit="return user_form_check()"><table width="750" border="0" cellpadding="0" cellspacing="0" style="border:1px #9DC3EA solid;" class="news_css">
          <tr>
            <td height="60" colspan="3" align="center" style="font-size:16px;font-weight:bold;">快速预约家教</td>
          </tr>
          <tr valign="top">
            <td height="70" colspan="3" align="center"><table width="700" height="50" border="0" cellpadding="0" cellspacing="0" style="border:1px #BCDFFF solid;">
              <tr>
                <td width="20" bgcolor="#E8F8FF">&nbsp;</td>
                <td width="660" align="left" bgcolor="#E8F8FF">如果您没有太多时间在本站查找您想要的教员或学员，您可以在下面填写好您的需要和联系方式，我们会根据您的需要，提供给您需要的教员或学员。</td>
                <td width="20" bgcolor="#E8F8FF">&nbsp;</td>
              </tr>
            </table></td>
          </tr>
          <tr>	  
            <td width="25" height="30"> </td>
            <td width="725" colspan="2"><font color="#FF0000">*</font> 您的姓名：<input name="username" type="text" id="username" style="width:60px;font-size:12px;">                  　
              <font color="#FF0000">*</font> 您的性别：<select name="sex" id="sex" style="height:21px;"><option value="男">男</option><option value="女">女</option></select>
               　 <font color="#FF0000">*</font> 您的身份：<select name="occupation_value" style="height:21px;"><option value="教员">教员</option><option value="学员">学员</option></select>
               　 <font color="#FF0000">* </font>所在区域：<select name="province_name" onChange="javascript:sort_list(this.value);" style="height:21px;">
                <option value="">辅导区域</option>
                <?php $sort_check="select * from sort_info_manage where sort_id='province' order by order_id";
				  $rs_sort_check=mysql_query ($sort_check);
				  while ($rs_sort=mysql_fetch_object ($rs_sort_check)) { ?>
            <option value="<?=$rs_sort->id?>"<?php if ($rs_sort->id==$province_name || trim(strpos($area_name,','.$rs_sort->id.','))!='') { $sort_id=$rs_sort->id; ?> selected<?php } ?>><?=$rs_sort->sort_title?></option><?php } ?></select> <span id="city_sort"></span></td>
          </tr>
          <tr>
            <td align="center">&nbsp;</td>
            <td height="40" colspan="2"><font color="#FF0000">*</font> 联系电话：<input name="tel" type="text" id="tel" style="width:260px;font-size:12px;">　　　 
              QQ 号码：<input name="qq_number" type="text" id="qq_number" style="width:260px;font-size:12px;"></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td height="30" colspan="2"><font color="#FF0000">*</font> 电子邮箱：<input name="email" type="text" id="email" style="width:260px;font-size:12px;">　　<font color="#FF0000">*</font> 授课地址：<input name="address" type="text" id="address" style="width:260px;font-size:12px;"></td>
          </tr>
          <tr align="center">
            <td height="320" colspan="3"><table width="700" height="290" border="0" cellpadding="0" cellspacing="0" class="news_css">
              <tr>
                <td height="50" colspan="5" align="center" bgcolor="#F4FAFF" style="border-top:1px #9DC3EA solid;border-left:1px #9DC3EA solid;border-right:1px #9DC3EA solid;"> <font color="#FF0000">*</font> 需要辅导的课程</td>
              </tr>
              <tr>
                <td width="200" align="center" bgcolor="#F4FAFF" style="border-left:1px #9DC3EA solid;"><select name="subject_name" size="15" multiple onChange="javascript:subject_list(this.value);" style="width:160px;height:220px;">
                    <option value="">--------选择--------</option>
                    <?php $sort_check="select * from sort_info_manage where sort_id='subject' order by order_id";
				  $rs_sort_check=mysql_query ($sort_check);				  
				  while ($rs_sort=mysql_fetch_object ($rs_sort_check)) { ?>
                    <option value="<?=$rs_sort->id?>"<?php if ($subject_name==$rs_sort->id) { ?> selected<?php } ?>>
                    <?=$rs_sort->sort_title?>
                    </option>
                    <?php } ?>
                  </select>
                    <?php if ($subject_name!='') { ?>
                    <script language="javascript">subject_list(<?=$subject_name?>);</script>
                    <?php } ?></td>
                <td width="180" bgcolor="#F4FAFF"><span id="subject_sort"></span></td>
                <td width="200" bgcolor="#F4FAFF"><select name="subject_name_2" size="15" multiple style="width:200px;height:220px;">
                    <?php
if ($subject_content!='' && $subject_content!=',') {
$subject_count=0; 
for ($i=0;$i<=20;$i++) {
$subject_content=substr($subject_content,strpos($subject_content,',')+1,strlen($subject_content));
if (trim(strpos($subject_content,','))!='') {
$subject_count=$subject_count+1; }
}
if ($_POST['subject_content']!='') { $subject_content=str_sql($_POST['subject_content']); } else { $subject_content=str_sql($_GET['subject_content']); }
if ($subject_count==0) { $subject_count=1; }
for ($k=1;$k<=$subject_count;$k++) {
$subject_content=substr($subject_content,strpos($subject_content,',')+1,strlen($subject_content));
$subject_value=substr($subject_content,0,strpos($subject_content,','));?>
                    <option value="<?=$subject_value?>">
                    <?=$subject_value?>
                    </option>
                    <?php } } 
if ($_POST['subject_content']!='') { $subject_content=str_sql($_POST['subject_content']); } else { $subject_content=str_sql($_GET['subject_content']); }
?>
                  </select>
                    <input name="subject_content" type="hidden" value="<?php if ($subject_content!='') { ?><?=$subject_content?><?php } else { ?>,<?php } ?>"></td>
                <td width="100" align="center" bgcolor="#F4FAFF" style="border-right:1px #9DC3EA solid;"><a href="javascript:select_option_del();"><img src="images/del.jpg" width="60" height="26" border="0"></a><br>
                    <br>
      最多选20个</td>
              </tr>
              <tr>
                <td colspan="5" bgcolor="#F4FAFF" style="height:20px;border-left:1px #9DC3EA solid;border-right:1px #9DC3EA solid;border-bottom:1px #9DC3EA solid;">　</td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td width="25">&nbsp;</td>
            <td width="65">预约留言：</td>
            <td width="660"><textarea name="content" id="content" style="width:630px;height:150px;font-size:12px;"></textarea></td>
          </tr>
          <tr align="center">
            <td height="70" colspan="3"><input name="imageField" type="image" src="images/order_button.jpg" width="90" height="30" border="0"></td>
          </tr></table>
</form></td>
		
		
		
    </tr>
  </table>  
  <?php require('bottom.php'); ?>
  </div>
</body></html>