// JavaScript Document
var xmlHttp;
var viewModel;//需要显示的区块
var xmlDoc;//响应回来的XML文本
var MessageId;
var SearSJId;//查询随机号码
var lqxxqrb;//录取信息确认表
//建立异步处理对象
function createXMLHttpRequest() {
		xmlHttp = false;
		//开始初始化XMLHttpRequest对象
		if(window.XMLHttpRequest) { //Mozilla 浏览器
			xmlHttp = new XMLHttpRequest();
			if (xmlHttp.overrideMimeType) {//设置MiME类别
				xmlHttp.overrideMimeType('text/xml');
			}
		}
		else if (window.ActiveXObject) { // IE浏览器
			try {
				xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {}
			}
		}
		if (!xmlHttp) { // 异常，创建对象实例失败
			window.alert("不能创建XMLHttpRequest对象实例.");
			return false;
		}
}
//请求页面更换
function requestMain(model,url) {
      createXMLHttpRequest();
	  viewModel=model;
      document.getElementById(model).innerHTML="数据正在加载……";
	  url=url+".jsp?time="+new Date().getTime();
	  xmlHttp.open("GET", url, true);
      xmlHttp.onreadystatechange = viewMain;
      xmlHttp.send(null);
}


//直接翻页
function requestInfoListPageChage(model,url,typeId)
{
	var page=document.getElementById("ChangepageId").value;
	if(page=="")
	{
		alert("请输入翻页页码！");
		return;
		}
	requestInfoListMain(model,url,page,typeId);	
}


function requestInfoListMain(model,url,pageId,typeId) {
      createXMLHttpRequest();
	  viewModel=model;
      document.getElementById(model).innerHTML="数据正在加载……";
	  url=url+".jsp?typeId="+typeId+"&page="+pageId+"&time="+new Date().getTime();
	  xmlHttp.open("GET", url, true);
      xmlHttp.onreadystatechange = viewMain;
      xmlHttp.send(null);
}

function viewMain()
{
	 if (xmlHttp.readyState == 4) {
		 
                if (xmlHttp.status == 200) {   
					setTimeout("viewContent()", 800);
                }
    }
}
//显示模块
function viewContent()
{
	document.getElementById(viewModel).innerHTML=xmlHttp.responseText;
	}
//关闭指定模块
function closeModel(mainmodel,closemodel,modelname)
{	
	var main=document.getElementById(mainmodel);
	var childmodel = document.getElementById(closemodel);
    main.removeChild(childmodel);	
}
//请求信息详情
function requestInfo(mainmodel,createModel,InfoId,url)
{
	viewModel=createModel;
	InfoParentModel=document.getElementById(mainmodel);	
	InfoModel=document.createElement("div");
	InfoModel.setAttribute("id",createModel);
	InfoParentModel.insertBefore(InfoModel,InfoParentModel.firstChild);
	InfoId=InfoId;
	createXMLHttpRequest();
	document.getElementById(viewModel).innerHTML="数据正在加载……";
	url=url+".jsp?id="+InfoId+"&time="+new Date().getTime();
	xmlHttp.open("GET", url, true);
    xmlHttp.onreadystatechange = viewInfoDetail;
    xmlHttp.send(null);
	}
function viewInfoDetail()
{
	 if (xmlHttp.readyState == 4) {
		 
                if (xmlHttp.status == 200) {   
					setTimeout("viewContent()", 800);
                }
    }
}
//Html
function getInfoid()
{
	var URLParams = new Array();
	var aParams = document.location.search.substr(1).split('&');
	for (i=0; i < aParams.length ; i++){
		var aParam = aParams[i].split('=');
		URLParams[aParam[0]] = aParam[1];
	}
	//取得传过来的name参数
	var id=URLParams["id"];
	requestInfo('main','Info-'+id,id,'info_detail_window');
}

