<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title>二手房运营管理系统</title>

<link id="dwz_themes" href="../../script/dwz/themes/default/style.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="../../script/dwz/themes/css/core.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="../../script/dwz/themes/css/print.css" rel="stylesheet" type="text/css" media="print"/>
<link href="../../script/dwz/uploadify/css/uploadify.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="../../script/My97DatePicker/skin/WdatePicker.css" rel="stylesheet" type="text/css" media="screen"/>
<!--[if IE]>
<link href="../../script/dwz/themes/css/ieHack.css" rel="stylesheet" type="text/css" media="screen"/>
<![endif]-->
<script src="../../script/dwz/js/jquery-1.7.1.js"></script>
<script src="../../script/dwz/js/jquery.cookie.js"></script>
<script src="../../script/dwz/js/dwz.theme.js"></script>
<script src="../../script/My97DatePicker/WdatePicker.js"></script>


</head>
<body scroll="no">
	<div id="container">
		<div id="navTab" class="tabsPage">
			<div class="tabsPageHeader">
				<div class="tabsPageHeaderContent"><!-- 显示左右控制时添加 class="tabsPageHeaderMargin" -->
					<ul class="navTab-tab">
						<li tabid="main" class="main selected"><a href="javascript:history.go(-1);"><span><span class="home_icon">新建兑换礼品</span></span></a></li>
					</ul>
				</div>
			</div>
			<div class="navTab-panel tabsPageContent layoutBox">
				<div class="page unitBox"><form action="" id="search_form"  target='form_submit' onsubmit='return check();' name="search_form" method="POST">
<input name='do' value='giftInsert' type='hidden'/>
<div style="width:100%;">
	<!--主体页面开始-->
	<div class="grid">
		<!--数据部分-->
		<div class="gridScroller">
			<div class="gridTbody">
			 <table style="width:70%;">
				<tbody>
					<tr>
						<td style="width: 10%;">名称：</td>
						<td style="width: 60%;text-align:left;"><input id='name' name='name' type='text' value=''/></td>
					</tr>
					<tr>
						<td style="width: 10%;">数量：</td>
						<td style="width: 60%;text-align:left;"><input id='num' name='num' type='text' value=''/>个</td>

					</tr>
					<tr>
						<td style="width: 10%;">截止日期：</td>
						<td style="width: 60%;text-align:left;"><input  onClick="WdatePicker({minDate:'%y-%M-{%d+1}',dateFmt:'yyyy-MM-dd HH:mm:ss'})" id='etime' readonly name='etime' type='text' value=''/></td>

					</tr>
					<tr>
						<td style="width: 10%;">图片：</td>
						<td style="width: 60%;text-align:left;"><span id="spanButtonPlaceholder"></span>
					    <font style="color:red;"><b>支持JPG,PNG，上传大小3M以下(最佳尺寸405*285)</b></font></td>
					</tr>
					<tr height="28" > 
					<td align="center">图片预览</td>
				    <td   align="left" height="100px">
						<span class="wenjsc">
							 <ul id="thumbnails" class="clearfix">
							 
							</ul>
						</span>
					 </td>
				    </tr>
					<tr>
						<td style="width: 10%;">参与要求：</td>
						<td style="width: 60%;text-align:left;">1.经纪人最低级别：
						   <input type="radio" name="level"  value="LV1"  >LV1 <input type="radio" name="level"  value="LV2"  >LV2 <input type="radio" name="level"  value="LV3"  >LV3 <input type="radio" name="level"  value="LV4"  >LV4 <input type="radio" name="level"  value="LV5"  >LV5 <input type="radio" name="level"  value="LV6"  >LV6 <input type="radio" name="level"  value="LV7"  >LV7 <input type="radio" name="level"  value="LV8"  >LV8 <input type="radio" name="level"  value="LV9"  >LV9 <input type="radio" name="level"  value="LV10"  >LV10 <input type="radio" name="level"  value="LV11"  >LV11 <input type="radio" name="level"  value="LV12"  >LV12 <input type="radio" name="level"  value="LV13"  >LV13 <input type="radio" name="level"  value="LV14"  >LV14 <input type="radio" name="level"  value="LV15"  >LV15</br>
						  2.兑换积分<input id='credit_score' name='credit_score' type='text' value=''/>
						</td>
					</tr>
					<tr>
						<td style="width: 10%;">兑换开启状态：</td>
						<td style="width: 60%;text-align:left;">未开启<input type='radio' name='open_flag' checked value='0'/>  &nbsp;&nbsp;&nbsp;&nbsp;开启<input type='radio' value='1' name='open_flag'/>&nbsp;&nbsp;&nbsp;&nbsp;说明：1.设置为开启状态后租售宝后台才可同步开放兑换。 2.开启状态下仅可修改“数量”、“是否开启”字段，其余字段不可修改。</td>
					</tr>
				     <tr>
						<td style="width: 10%;" colspan=2><input type='submit' name='make_sure' value='确定' /></td>
					</tr>
					 
				</tbody>
				</table>
			</div>
		</div><!--数据部分-->
	 
	 
	</div>

	<!--主体页面结束-->
</div>
</form>
<iframe name='form_submit' frameborder="0" style="display: none;"></iframe>
<script>
function check(){
	var pic ,level = ''; 
	var i = 0;
    $('input[name="p_filename[]"]').each(function(){    
       pic = $(this).val();
	   i++;
    }); 
	var name =  $.trim($('#name').val());
	var num = $.trim($('#num').val());
	var check_num = /^\d+$/;
	var credit_score =  $.trim($('#credit_score').val());
	var etime = $.trim($('#etime').val())
    
	//检查数据
	var regex = /^[a-zA-Z0-9\u4e00-\u9fa5]*$/;
	var ret = regex.test(name);

	if(!name) {
		alert('礼品名称不能为空！');return false;
	}else if(!ret){
		alert("礼品名称只能为中文、英文字母或数字");return false;
	}else if(!check_num.test(num)){
		alert('礼品数量数据为空或不合法！');return false;
	}else if(!etime){
		alert('礼品截止日期不能为空！');return false;
	}else if(i > 1){
		alert('礼品图片只能上传一张！');return false;
	}else if(i < 1){
		alert('礼品图片不能为空！');return false;
	}else if(null==$('input:radio[name="level"]:checked').val()){
		alert('分配的经纪人级别不能为空！');return false;
    }else if(!check_num.test(credit_score)){
		alert('礼品所需积分数据为空或不合法！');return false;
	}
}
</script>
<script type="text/javascript" src="/script/My97DatePicker/WdatePicker.js"></script>
<script type='text/javascript' src='/script/js/swf/swfupload.js'></script>
<script type='text/javascript' src='/script/js/handlers.js'></script>
<script>
window.onload = function () {
    var url = "http://esfadmin.house365.com/script/";

	swfu = new SWFUpload({
		// Backend Settings
		upload_url:  "http://zsb.house365.com/module/upload3.php",
		//post_params: {"PHPSESSID": "5onmcek5m1qsu5e5nor2tiq325"},
		//post_params: {"postion" : position},
		// File Upload Settings
		file_size_limit : "3 MB",	// 2MB
		file_types : "*.jpg;*.png",
		file_types_description : "Web Images",
		file_upload_limit : "5",
		file_queue_limit : "1",
		button_action:SWFUpload.BUTTON_ACTION.SELECT_FILE,

		file_queue_error_handler : fileQueueError,
		file_dialog_start_handler : fileDialogStart,
		file_dialog_complete_handler : fileDialogComplete,
		upload_progress_handler : uploadProgress,
		upload_error_handler : uploadError,
		upload_success_handler : uploadSuccess,
		upload_complete_handler : uploadComplete,

		// Button Settings
		button_image_url : url + "js/swf/btn61x22.png",
		button_placeholder_id : "spanButtonPlaceholder",
		button_width: 61,
		button_height: 22,
		button_cursor: SWFUpload.CURSOR.HAND,
		
		// Flash Settings
		flash_url : url + "js/swf/swfupload.swf",

		custom_settings : {
			upload_target : "divFileProgressContainer",
			upload_limit  : 0
		},
		
		// Debug Settings
		debug: false
	});
	
};
</script>
 				</div>
			</div>
		</div>
	</div>

<script>
$(document).ready(function(){
	var clientHeight = document.documentElement.clientHeight - 30;
	$(".tabsPageContent").css("height", clientHeight + "px");
	var clientWidth = document.documentElement.clientWidth - 2;
	$(".tabsPageContent").css("width", clientWidth + "px");
	$("#dwz_themes").attr("href","../../script/dwz/themes/default/style.css");
});
$(window).resize(function() {
	var clientHeight = document.documentElement.clientHeight - 30;
	$(".tabsPageContent").css("height", clientHeight + "px");
	var clientWidth = document.documentElement.clientWidth - 2;
	$(".tabsPageContent").css("width", clientWidth + "px");
});
</script>
</body>
</html>