function load(){
	$.ajax({
			url:'././vsManageAction.do?action=getVsData&r='+Math.random(),
			type:'GET',
			error:function(){alert('网络连接异常！！！')},
			success:function(vs_list){
				var vs_item=eval("("+vs_list+")");
				var items=vs_item.items;
				for(var i=0;i<items.length;i++){
					var tempTime=pageDate(items[i].fsstopTime);
					var _input="";
					if(items[i].isJd.toString()=="1"){
						_input="<input type='checkbox' checked='checked'/>";
					}else{
						_input="<input type='checkbox'/>";
					}
					var tr="<tr id='"+items[i].gameId+"'>"+
							"<td align='center' class='tab_content'>"+(i+1)+"</td>"+
							"<td align='center' class='tab_content'>"+items[i].gameNum+"</td>"+
							"<td align='center' class='tab_content'>"+items[i].gameName+"</td>"+
							"<td align='center' class='tab_content'>"+items[i].hostTeam+"</td>"+
							"<td align='center' class='tab_content'>"+items[i].concedeNum+"</td>"+
							"<td align='center' class='tab_content'>"+items[i].visitingTeam+"</td>"+
							"<td align='center' class='tab_content'>"+items[i].stopSellDate+"</td>"+
							"<td align='center' class='tab_content'>"+
								"<input type='text' id='stopTime' value='"+tempTime+"'/>"+
								"<select id='"+(i+1)+"' onchange='setFsstopTime(this)'>"+
									"<option>30</option>"+
									"<option>40</option>"+
									"<option>50</option>"+
									"<option>60</option>"+
								"</select>"+
							"</td>"+
							"<td align='center' width='40' class='tab_content'>"+_input+"</td>"+
							"<td align='center' width='40' class='tab_content'><input type='button' onclick='saveData(this)' value='保存' style='padding-top:2px;'/></td>"+
						"</tr>";
					$('.center_context_tab').append(tr);	
				}
			}
	});
}
//取出数据库时间处理
function pageDate(_dateTime){
	var year=_dateTime.substr(0,4);
	var month=_dateTime.substr(4,2);
	var day=_dateTime.substr(6,2);
	var hours=_dateTime.substr(8,2);
	var minutes=_dateTime.substr(10,2);
	var seconds=_dateTime.substr(12,2);
	var _pageDate=year+'-'+month+'-'+day+' '+hours+':'+minutes+':'+seconds;
	return _pageDate;
}
//插入数据库时间处理
function dataDate(_dateTime){
	var year=_dateTime.substr(0,4);
	var month=_dateTime.substr(5,2);
	var day=_dateTime.substr(8,2);
	var hours=_dateTime.substr(11,2);
	var minutes=_dateTime.substr(14,2);
	var seconds=_dateTime.substr(17,2);
	var dataDate=year+month+day+hours+minutes+seconds;
	return dataDate;
}
//设置复式停售时间
function setFsstopTime(_this){
	var _dateTime=$(_this).parent().find('input').val();
	var _val=parseInt($(_this).val());
	var year=_dateTime.substr(0,4);
	var month=_dateTime.substr(5,2);
	var day=_dateTime.substr(8,2);
	var hours=_dateTime.substr(11,2);
	var minutes=_dateTime.substr(14,2);
	var seconds=_dateTime.substr(17,2);
	var date=new Date(year,month,day,hours,minutes,seconds);
	date.setMinutes(date.getMinutes()-_val);
	if(parseInt(date.getMonth())<10){
		month="0"+date.getMonth();
	}else{
		month=date.getMonth();
	}
	if(parseInt(date.getDate())<10){
		day="0"+date.getDate();
	}else{
		day=date.getDate();
	}
	if(parseInt(date.getHours())<10){
		hours="0"+date.getHours();
	}else{
		hours=date.getHours();
	}
	if(parseInt(date.getMinutes())<10){
		minutes="0"+date.getMinutes();
	}else{
		minutes=date.getMinutes();
	}
	var pageDate=year+'-'+month+'-'+day+' '+hours+':'+minutes+':'+seconds;
	$(_this).parent().find('input').val(pageDate);
}
//保存数据
function saveData(_this){
	var isJd="";
	var _id=$(_this).parent().parent().attr('id');
	var dateTime=dataDate($(_this).parent().parent().find('input').eq(0).val());
	if($(_this).parent().parent().find('input').eq(1).attr('checked')){
		isJd=1;
	}else{
		isJd=0;
	}
	$.ajax({
		url:'././vsManageAction.do?action=setJdStatus&gameId='+_id+'&fsstopTime='+dateTime+'&isJd='+isJd+'',
			type:'GET',
			error:function(){alert('网络连接异常！！！')},
			success:function(){
				alert("设置成功！！！");
			}
	})
}
//全部保存数据
function AllSaveDate(){
	var str_id='';
	var time=$('#all_time').val();
	for(var i=1;i<$('.center_context_tab').find('tr').length;i++){
		if(i==$('.center_context_tab').find('tr').length-1){
			str_id=str_id+$('.center_context_tab').find('tr').eq(i).attr('id');
		}else{
			str_id=str_id+$('.center_context_tab').find('tr').eq(i).attr('id')+",";
		}
		
	}
	$.ajax({
		url:'././vsManageAction.do?action=allTime&gameId='+str_id+'&time='+time+'',
			type:'GET',
			error:function(){alert('网络连接异常！！！')},
			success:function(){
				alert("设置成功！！！");
			}
	});
}
