// JavaScript Document

function xmlHttp()
{
	var kaolahttp=null;
	try
	{
		kaolahttp=new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			kaolahttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			if (typeof XMLHttpRequest != "undefined" );
			{
				kaolahttp=new XMLHttpRequest();
			}
		}
	}			
	return kaolahttp;
}

/**
发送请求的js
**/
function sendHttpStr(httpUrl,postStr,next,str)
{	
	var kaolaHttp = new xmlHttp();
	var httpStr='';
 	try 
	{   
		kaolaHttp.open("POST", httpUrl, true);
		kaolaHttp.setRequestHeader("content-type", "application/x-www-form-urlencoded");
		kaolaHttp.onreadystatechange = function() 
		{
			//alert(kaolaHttp.status);
			if (kaolaHttp.readyState == 4 && kaolaHttp.status == 200) 
			{   
				 httpStr=kaolaHttp.responseText;
				 //alert('ffffffff');
				 //加一个注入函数
				 managerHttpStr(next,httpStr,str);
				 var i=90;
			}
		}
		kaolaHttp.send(postStr);	
	} catch (e) {
		alert(e.message);
	}
}

/**
	读取内容的js
**/
function getHttpStr(httpUrl,postStr,id)
{	
	var kaolaHttp = new xmlHttp();
	var httpStr='';
	if(postStr==''){
		postStr='kaola=v20';	
	}
 	try 
	{   
		kaolaHttp.open("POST", httpUrl, true);
		kaolaHttp.setRequestHeader("content-type", "application/x-www-form-urlencoded");
		kaolaHttp.onreadystatechange = function() 
		{	//alert(httpUrl+'----'+kaolaHttp.status);
			if (kaolaHttp.readyState == 4 && kaolaHttp.status == 200) 
			{   
				 httpStr=kaolaHttp.responseText;
				 try{
					document.getElementById(id).innerHTML=httpStr;	
				    var isTest=0; 
				 }catch(eaw){
					 
				 }
				 
			}
		}
		kaolaHttp.send(postStr);	
	} catch (e) {
		alert(e.message);
	}
}



//发送的请求
function sendAllHttp(httpUrl,postStr,fun,str)
{	
	var kaolaHttp = new xmlHttp();
	var httpStr='';
 	try 
	{   
		kaolaHttp.open("POST", httpUrl, true);
		kaolaHttp.setRequestHeader("content-type", "application/x-www-form-urlencoded");
		kaolaHttp.onreadystatechange = function() 
		{
			//alert(kaolaHttp.status);
			if (kaolaHttp.readyState == 4 && kaolaHttp.status == 200) 
			{    
				 httpStr=kaolaHttp.responseText;
				 //alert(httpStr);
				 httpStr=httpStr.replace(/[\r\n]+/gmi,"");
				// httpStr=httpStr.replace(/\"+/gmi,"\\\"");
				 httpStr=httpStr.replace(/\'+/gmi,"\\\'");
				 var i=90;
				 var vs=fun+"('0','-','"+str+"','"+httpStr+"')";
				 eval(vs);
			}
		}
		kaolaHttp.send(postStr);	
	} catch (e) {
		alert(e.message);
	}
}


