function createXMLHttplvfen() {
	if (window.XMLHttpRequest) {
		var objXMLHttplvfen = new XMLHttpRequest();
		if (objXMLHttplvfen.readyState == null) {
			objXMLHttplvfen.readyState = 0;
			objXMLHttplvfen.addEventListener(
			"load",
			function () {
				objXMLHttplvfen.readyState = 4;
				if (typeof(objXMLHttplvfen.onreadystatechange) == "function") {
					objXMLHttplvfen.onreadystatechange();
				}
			},
			false
			);
		}
		return objXMLHttplvfen;
	} else if (s_XMLHttpNameCachelvfen != null) {
		return new ActiveXObject(s_XMLHttpNameCachelvfen);
	} else {
		var MSXML = [
			'MSXML2.XMLHTTP.6.0',
			'MSXML2.XMLHTTP.5.0',
			'MSXML2.XMLHTTP.4.0',
			'MSXML2.XMLHTTP.3.0',
			'MsXML2.XMLHTTP.2.6',
			'MSXML2.XMLHTTP',
			'Microsoft.XMLHTTP.1.0',
			'Microsoft.XMLHTTP.1',
			'Microsoft.XMLHTTP'
		];
		var n = MSXML.length;
		for (var i = 0; i < n; i++) {
			try {
				objXMLHttplvfen = new ActiveXObject(MSXML[i]);
				s_XMLHttpNameCachelvfen = MSXML[i];
				return objXMLHttplvfen;
			}
			catch(e) {}
		}
		return null;
	}
}
var http_requestlvfen = null;
var s_XMLHttpNameCachelvfen = null;
function send_requestlvfen(url,sh,help_id){
    http_requestlvfen = createXMLHttp();
	if (typeof(http_requestlvfen) == 'undefined') {
		window.alert("Can't creat XMLHttpRequest Object.");
		return false;
	}
	if (typeof(data) == 'undefined') {
		http_requestlvfen.open('GET',url,true);
		http_requestlvfen.send(null);
	} else {
		var requestlvfen = data;
		http_requestlvfen.open('POST',url,true);
		http_requestlvfen.setRequestHeader('Content-Length', request.length);
		http_requestlvfen.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
		http_requestlvfen.send(request);
	}
	if (typeof(callbacklvfen) == 'function') {
					   if (sh == "gift"){
					   	    document.getElementById('ajax_gift').innerHTML = "<img src='images/login_loading.gif'>请稍后..";
					   }	
					   if (sh == "article"){
							document.getElementById('ruanhaiqiu').innerHTML = "加载中,请稍后..";
					   }
					   if (sh == "code_div"){
							document.getElementById('code_div').innerHTML = "正在查找中,请稍后..";
					   }	
					   if (sh == "code_div_1"){
							document.getElementById('code_div').innerHTML = "请稍后..";
					   }								   
		    http_requestlvfen.onreadystatechange = function () {
			if (http_requestlvfen.readyState == 4) {	
					   if (sh == "gift"){
					   	    document.getElementById('ajax_gift').innerHTML = "";
					   }	
					   if (sh == "article"){
					   	    document.getElementById('ruanhaiqiu').innerHTML = "";
					   }	
					   if (sh == "code_div"){
					   	    document.getElementById('code_div').innerHTML = "";
					   }					   
				if (http_requestlvfen.status == 200 || http_requestlvfen.status == 304) {
					callbacklvfen(http_requestlvfen,sh,help_id);//调用显示函数//////
				} else {
					alert("Error loading page\n" + http_requestlvfen.status + ':' + http_requestlvfen.statusText);
				}
			}
		}
	}
}
function ajax_help(help_id){
   var sh   = "ajax_help";
   var url  = "ajax_help.php?sh="+sh+"&class_id="+help_id+"&Random="+Math.random();
   send_requestlvfen(url,sh,help_id);	
}
function love_array(){//找我所爱
  var sh  =  "love";
  var url =  "ajax_comments_list.php?sh=love&Random="+Math.random();
  send_requestlvfen(url,sh,1); 
}
function article(id,page){//
  var sh   =  "article";
  var url  =  "ajax_help.php?sh="+sh+"&id="+id+"&page="+page+"&Random="+Math.random();
  if (page>1){
	  document.getElementById('anhui_taihu').style.display = "none";
  }
  else{
	  document.getElementById('anhui_taihu').style.display = "block";
  }
  send_requestlvfen(url,sh,1); 
}
function advice(page){
  var sh   =  "advice";
  var url  =  "ajax_help.php?sh="+sh+"&page="+page+"&Random="+Math.random();
  send_requestlvfen(url,sh,1); 
}
function show_heat(id){
  var sh   =  "heat";
  var url  =  "ajax_help.php?sh="+sh+"&id="+id+"&Random="+Math.random();
  send_requestlvfen(url,sh,1); 
}
function clears(){
  var sh   =  "clear";
  var url  =  "ajax_help.php?sh="+sh+"&Random="+Math.random();
  send_requestlvfen(url,sh,1); 	
}
function code_div(code){//商品货号搜索
  var sh   =  "code_div";
  var url  =  "ajax_help.php?sh="+sh+"&code="+code+"&Random="+Math.random();
  send_requestlvfen(url,sh,1); 
}
function code_div_1(){//商品货号搜索
  var sh   =  "code_div_1";
  var url  =  "ajax_help.php?sh="+sh+"&Random="+Math.random();
  send_requestlvfen(url,sh,1); 
}
function send_play_msg(active_id){
  var sh   =  "send_play_msg";
  var url  =  "ajax_help.php?sh="+sh+"&active_id="+active_id+"&Random="+Math.random();
  send_requestlvfen(url,sh,1); 	
}
function callbacklvfen(http_request,sh,help_id){
	if (sh == "ajax_help"){
	  var error = http_request.responseText;
	   document.getElementById('help_'+help_id).innerHTML = error;
	}
	if (sh == "love"){
	    var error = http_request.responseText;
	   document.getElementById('ajax_gift_'+help_id).innerHTML = error;
	}	
	if (sh == "article"){
	    var error = http_request.responseText;
	   document.getElementById('ruanhaiqiu').innerHTML = error;
	}
	if (sh == "advice"){
	    var error = http_request.responseText;
	   document.getElementById('ajax_advice').innerHTML = error;		
	}
	if (sh == "heat"){
	    var error = http_request.responseText;
	    document.getElementById('ajax_heat').innerHTML = parseInt(error);				
	}
	if (sh == "clear"){
	    document.getElementById('ajax_heat').innerHTML = 0;				
	}	
	if (sh == "code_div"){
	    var error = http_request.responseText;
	    document.getElementById('code_div').innerHTML = error;				
	}	
	if (sh == "code_div_1"){
	    var error = http_request.responseText;
	    document.getElementById('code_div').innerHTML = error;				
	}
	if (sh  == 'send_play_msg'){
	    var msg = http_request.responseText;
	    document.getElementById('bm_msg').innerHTML = msg;				
	}
}
