/**
 * 作用：无刷新获取记录
 * 作者：张新庭
 */
var xmlHttp

function createXMLHttp(){
	try{
		xmlHttp=new XMLHttpRequest();
	}catch (e){
		try{
			  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }catch (e){
			  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
    }
  return xmlHttp;
}

//执行Ajax
function sendAjax(getType,sUrl,stitle,sName,stype){
	createXMLHttp(); 
	var sName
  var send_string = "userName="+sName+"&stype="+stype;
	xmlHttp.open(getType,sUrl,false);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.send(send_string);
	var ajaxVar = xmlHttp.responseText;
//	document.getElementById(stitle).style.display ="block";
	document.getElementById(stitle).innerHTML=ajaxVar;

}

//执行Ajax
function cardAjax(getType,sUrl,sName){
	createXMLHttp(); 
	var sName
  var send_string = "userName="+sName;
	xmlHttp.open(getType,sUrl,false);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.send(send_string);
	var ajaxVar = xmlHttp.responseText;

	return ajaxVar;
}

function Userreply(getType,sUrl,CatiId,igid,contents,eMail,stitle,replayId){
	createXMLHttp(); 
	var sName

  var send_string = "menuId="+CatiId+"&gid="+igid+"&contents="+contents +"&eMail="+eMail;
	xmlHttp.open(getType,sUrl,false);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.send(send_string);
	var ajaxVar = xmlHttp.responseText;
	 var  pattern2  =  /\<\/div\>$/;  
 // rs  =  pattern2.test(ajaxVar);//
	if(!pattern2.test(ajaxVar))
	{
		alert(ajaxVar);
	}else
	{
			document.getElementById(replayId).innerHTML=ajaxVar+document.getElementById(replayId).innerHTML;
			document.getElementById(stitle).value="";
	}

}

//执行Ajax
function wetherDay(getType,sUrl,wetherUrl){
	createXMLHttp(); 
  var send_string = "wetherUrl="+ wetherUrl;
	xmlHttp.open(getType,sUrl,false);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.send(send_string);
	var ajaxVar = xmlHttp.responseText;
	return ajaxVar;
}

//执行Ajax
function AjaxEverDay(getType,sUrl,sDay,isBaby,chDay){
	createXMLHttp();
  var send_string = "babyDay="+sDay+"&isBaby="+isBaby+"&chDay="+ chDay +"";
	xmlHttp.open(getType,sUrl,false);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.send(send_string);
	var ajaxVar = xmlHttp.responseText;
	return ajaxVar;
}

//执行Ajax
function publicAjax(getType,sUrl,listPost){
	createXMLHttp();

  var send_string = listPost;

	xmlHttp.open(getType,sUrl,false);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.send(send_string);

	var ajaxVar = xmlHttp.responseText;
	return ajaxVar;
}