﻿var xmlHttp;
function createXMLHttpRequest()
{
	if(window.ActiveXObject)
	{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if(window.XMLHttpRequest)
	{
		xmlHttp=new XMLHttpRequest();
	}
}
function startRequest(che,domainName,URL,type)
{
	var hiddenimg=document.getElementById("typeimg").value;
	var stufstr=document.getElementById("sutfstr").value;
	createXMLHttpRequest();
	xmlHttp.open("POST",URL,true);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	var postStr="username=" + escape(domainName) + "&endimg=" + escape(che) + "&imgtype=" + escape(hiddenimg) + "&stufstr=" + escape(stufstr);
	xmlHttp.send(postStr)
	xmlHttp.onreadystatechange=handleStateChange;
}
function handleStateChange()
{
	if(xmlHttp.readyState==4)
	{
		if(xmlHttp.status==200)
		{
			var errorajax=document.getElementById("error");
			var trueteeimg=document.getElementById("teeimg");
			var result=xmlHttp.responseText;
			//alert(result);
			if(result==1)
			{
				errorajax.style.display="";
				errorajax.innerHTML="* 服务器忙，请您重新尝试!";
			}
			else
			{
				trueteeimg.src=result;
				errorajax.style.display="none";
			}
		}
	}
}