{#include file="sys/admin_header.htm"#}
<div class="admin_main_nr_dbox">
<div class="pagetit">
	<div class="ptit">{#$pageheader#}</div>
	{#include file="promotion/admin_promotion_nav.htm"#}
  <div class="clear"></div>
</div>
<div class="toptip">
<h2>提示：</h2>
<p>
系统将自动取消到期的企业推广。<br />
</p>
</div>  
 <div class="toptit">新增推广</div>
 <script type="text/javascript" src="js/jquery.iColorPicker.js"></script>
 <script type="text/javascript">
$(document).ready(function()
{

	$("input.getinfo").focus(function()
	{
	$(".trcolor").css("background-color","");
	$(this).parent().parent().find("td").filter(".trcolor").css("background-color","#E3F3FB");
	});
	
	
	$("#get_id,#get_jobname,#get_comname,#get_uid").keyup(function(){	
		if($(this).val())
		{
			var tsTimeStamp= new Date().getTime();
		 	$.get("admin_ajax.php", {"act":"get_jobs","tstime":tsTimeStamp,"key":$(this).val(),"type":$(this).attr("id")},
			function (data,textStatus)
			 {	
			 	if (data)
				{
					html="<table width=\"100%\" border=\"0\" cellpadding=\"4\" cellspacing=\"0\" style=\"margin-bottom:10px;\" >";
					html+="<tr>";
					html+="<td width=\"25%\" height=\"28\" bgcolor=\"#EBF7FC\"  >&nbsp;&nbsp;&nbsp;&nbsp;<strong>职位名称<\/strong><\/td>";
					html+="<td bgcolor=\"#EBF7FC\"  ><strong>公司名称<\/strong><\/td>";
					html+="<td width=\"13%\" align=\"center\" bgcolor=\"#EBF7FC\"  ><strong>发布时间<\/strong><\/td>";
					html+="<td width=\"13%\" align=\"center\" bgcolor=\"#EBF7FC\"  ><strong>到期时间<\/strong><\/td>";
					html+="<td width=\"13%\" align=\"center\" bgcolor=\"#EBF7FC\"  ><strong>刷新时间<\/strong><\/td>";
					html+="<\/tr>";
					var str=data.split("@@@");
					var i=1;
				 	for (x in str)
					{
					var val=str[x].split("%%%");
					html+="<tr>";
					html+="<td height=\"20\" style=\"border-bottom:1px #B4E0ED dashed\" >&nbsp;";
					html+="<label>";
					html+="<input type=\"radio\" name=\"jobid\" value=\""+val[0]+"\" \/>";
					html+="<\/label>";
					html+="<a href=\""+val[2]+"\" target=\"_blank\">"+val[1]+"<\/a><\/td>";
					html+="<td  style=\"border-bottom:1px #B4E0ED dashed\"><a href=\""+val[4]+"\" target=\"_blank\">"+val[3]+"<\/a><\/td>";
					html+="<td align=\"center\"  style=\"border-bottom:1px  #B4E0ED dashed\">"+val[5]+"<\/td>";
					html+="<td align=\"center\"  style=\"border-bottom:1px #B4E0ED dashed\">"+val[6]+"<\/td>";
					html+="<td align=\"center\"  style=\"border-bottom:1px #B4E0ED dashed\">"+val[7]+"<\/td>";
					html+="<\/tr>";
					i++;
					}
					html+="<\/table>";
					$("#showtd").html(html);
					
				}
				else
				{
				html="<div style=\"padding:15px; color:#0066CC\">没有找到对应的职位。</div>";
				$("#showtd").html(html);
				}
			 })
		}	
	});	
	
	
	
	
	$("#promotionid").change(function()
	{
		if ($(this).val()=="4")
		{
		$(".showColor").show();
		}	
		else
		{
		$(".showColor").hide();
		}
	});

	
	
	//点击批量取消	
	$("#ADD").click(function(){	
	 var flag = false;
        $("input[name='jobid']").each(function(index)
		{
            if($(this).attr("checked") == true){
                flag = true;
            }
        });
        if(!flag){
          alert("请选择要推广的职位");
          return false;
        };
		if ($("#promotionid").val()=='-1')
		{
			alert("请选择要推广方案");
			$("#promotionid").focus();
          	return false;
		}
		else if ($("#promotionid").val()=='4')
		{
			if ($("#val").val()=="")
			{
			alert("请选择颜色");
			return false;
			}          	
		}
		else if ($("#days").val()=="")
		{
			alert("请填写推广天数");
			$("#days").focus();
			return false;       	
		}
		$("form[name=form1]").submit();
	    });
	
	
	
}); 
</script>
    <form id="form1" name="form1" method="post" action="?act=promotion_save">
	{#$inputtoken#}
  <table width="100%" border="0" cellspacing="0" cellpadding="0" class="link_lan">
    <tr>
      <td width="350" valign="top"><table width="100%" border="0" cellpadding="3" cellspacing="0" bgcolor="#F4FDFF"   class="link_lan"  style="border-bottom:1px #B4E0ED solid;border-top:1px #B4E0ED solid;border-left:1px #B4E0ED solid;">
        <tr>
          <td height="32" align="right"  class="trcolor" >请输入职位ID：</td>
          <td width="215"  class="trcolor" ><input name="admin_name" type="text" class="input_text_200 getinfo" id="get_id" maxlength="25" value=""/></td>
        </tr>
        <tr>
          <td height="32" align="right"  class="trcolor"  >或职位名称：</td>
          <td class="trcolor"  ><input name="admin_name" type="text" class="input_text_200 getinfo" id="get_jobname" maxlength="25" value=""/></td>
        </tr>
        <tr>
          <td height="32" align="right" class="trcolor"  >或企业名称：</td>
          <td   class="trcolor"  ><input name="admin_name" type="text" class="input_text_200 getinfo" id="get_comname" maxlength="25" value=""/></td>
        </tr>
        <tr>
          <td height="32" align="right" class="trcolor"  >或会员ID：</td>
          <td   class="trcolor"  ><input name="admin_name" type="text" class="input_text_200 getinfo" id="get_uid" maxlength="25" value=""/></td>
        </tr>
		</table>
		<table width="100%" border="0" cellspacing="0" cellpadding="3" class="link_lan">
        
        <tr>
          <td height="35" align="right" >推广期限(天)：</td>
          <td ><input name="days"  id="days" type="text" class="input_text_200"   maxlength="3" value=""/></td>
        </tr>
		<tr>
          <td height="35" align="right"  >推推方案：</td>
          <td width="215"    >
              <select name="promotionid" id="promotionid">
                <option value="-1">请选择推广方案</option>
               
                
				{#foreach from=$cat item=li#}
				 <option value="{#$li.cat_id#}">{#$li.cat_name#}</option>
				{#/foreach#}
              
              </select>          </td>
		</tr>
		<tr>
          <td height="35" align="right"  class="showColor" style="display:none">推广颜色：</td>
          <td class="showColor" style="display:none">
		  <input id="val" name="val" type="text" value="" class="iColorPicker input_text_150"  onclick="iColorShow('val','icp_val')"/>		  </td>
        </tr>
        <tr>
          <td height="35" align="right"  >&nbsp;</td>
          <td height="60"  ><input name="submit3" type="button" class="admin_submit"   id="ADD"  value="确定"/>
            <input name="submit22" type="button" class="admin_submit"    value="返回" onclick="Javascript:window.history.go(-1)"/></td>
        </tr>
        <tr>
          <td height="35" align="right"  >&nbsp;</td>
          <td height="60"  >&nbsp;</td>
        </tr>
      </table>
	  
	  </td>
      <td valign="top" >
	  
	  
			  <table width="100%" border="0" cellspacing="0" cellpadding="0" >
		  <tr>
			<td style="border:1px  #B4E0ED solid; height:152px;" id="showtd"  bgcolor="#FFFFFF"  valign="top">
			<div style="padding:15px; color: #0066CC">请在左侧表单中输入你要查找的值。</div>
			
			</td>
			</tr>
		</table>

	  
	  </td>
    </tr>
  </table>

    </form>
</div>
{#include file="sys/admin_footer.htm"#}
</body>
</html>