﻿// JavaScript Document
function SetFilterValue(to,obj){
	document.getElementById(to).value = obj.value;
}
function GetFilterValue(){
	this.GetId = function(id){
		return document.getElementById(id)
	}
	v_gender = GetId("F_gender").value;
	v_s_age = GetId("F_s_age").value;
	v_e_age = GetId("F_e_age").value;
	v_order = GetId("F_order").value;
	return "&view="+v_gender+"&s_age="+v_s_age+"&e_age="+v_e_age+"&order="+v_order;
}
function filterpeople(ac){
	var what = GetFilterValue();
	MaskLoadBox();
	ajaxDatePostFilter(ac,what);
}
function p_ajaxPage(ac,what,page){
	MaskLoadBox();
	ajaxDatePostFilter(ac,what,page);
}
function MaskLoadBox()
{
var sWidth=$("#people_list").width(); 
var sHeight=$("#people_list").height(); 
var bgObj=document.createElement("div");
var loadingimg='<img src="css/large_blue_dashes_circle.gif" alt="加载中" style="margin:25px 120px;">';
bgObj.setAttribute('class','portlet portlet-');
bgObj.setAttribute('id','bg');
bgObj.style.position="absolute";
bgObj.style.background="#FFFFFF";
bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
bgObj.style.opacity="0.6";
bgObj.style.width=sWidth + "px";
bgObj.style.height=sHeight + "px";
bgObj.style.zIndex = "1000";
var loadingObj=document.createElement("div");
loadingObj.setAttribute('id','loading');
loadingObj.style.position="absolute";
loadingObj.style.background="#FFFFFF";
loadingObj.style.border="1px #AAAAAA solid";
loadingObj.style.margin="140 170";
loadingObj.style.border="1px #AAAAAA solid";
loadingObj.style.width="320px";
loadingObj.style.height="110px";
loadingObj.style.zIndex = "1001";
loadingObj.innerHTML=loadingimg;
$("#people_list").before(bgObj);
$("#people_list").before(loadingObj);
}
function ajaxDatePostFilter(ac,what,page){
	//alert('people.php?ac='+ac+what+'&page='+page);
	$.post('people_refresh.php?ac='+ac+what+'&page='+page,function(data){
		if(data){
			//alert(data);
			document.getElementById("people_list").innerHTML = data;
			init();
			$("#bg").remove();
			$("#loading").remove();
		}
		else {
			alert('通信失败，请检查网络');
			$("#bg").remove();
			$("#loading").remove(); 
		}
	});
}