var xmlHttp;
var xmlNewHttp;
var xmlUserHttp; 
function createXMLHttpRequest() {
  if (window.ActiveXObject) {
      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  }
  else if (window.XMLHttpRequest) {
      xmlHttp = new XMLHttpRequest();                
  }
  if (!xmlHttp) { // 异常，创建对象实例失败
	window.alert("不能创建XMLHttpRequest对象实例.");
	return false;
  }
}

function createNewXMLHttpRequest() {
  if (window.ActiveXObject) {
      xmlNewHttp = new ActiveXObject("Microsoft.XMLHTTP");
  }
  else if (window.XMLHttpRequest) {
      xmlNewHttp = new XMLHttpRequest();                
  }
  if (!xmlNewHttp) { // 异常，创建对象实例失败
	window.alert("不能创建XMLHttpRequest对象实例.");
	return false;
  }
}

function createNewUserXMLHttpRequest() {
  if (window.ActiveXObject) {
      xmlUserHttp = new ActiveXObject("Microsoft.XMLHTTP");
  }
  else if (window.XMLHttpRequest) {
      xmlUserHttp = new XMLHttpRequest();                
  }
  if (!xmlUserHttp) { // 异常，创建对象实例失败
	window.alert("不能创建XMLHttpRequest对象实例.");
	return false;
  }
}

function createXMLHttpRequestByObject(xmlObject) {
  if (window.ActiveXObject) {
      xmlObject = new ActiveXObject("Microsoft.XMLHTTP");
  }
  else if (window.XMLHttpRequest) {
      xmlObject = new XMLHttpRequest();                
  }
  if (!xmlObject) { // 异常，创建对象实例失败
	window.alert("不能创建XMLHttpRequest对象实例.");
	return false;
  }
  
  return xmlObject;
}

function ajaxvalidTest() {
 	var city = document.getElementById("city").value.Trim();
		if(title.indexOf("/")!=-1||city.indexOf("%")!=-1||city.indexOf("+")!=-1||city.indexOf("!")!=-1||city.indexOf("@")!=-1||city.indexOf("#")!=-1
		||city.indexOf("$")!=-1||city.indexOf("^")!=-1||city.indexOf("&")!=-1||city.indexOf("*")!=-1||city.indexOf("{")!=-1||city.indexOf("}")!=-1||
		city.indexOf("<")!=-1||city.indexOf(">")!=-1||city.indexOf("[")!=-1||city.indexOf("]")!=-1||city.indexOf("(")!=-1||city.indexOf(")")!=-1)
	{
		alert("标题中不能含有 /,%,+等特殊字符！");
		document.EditInfoForm.city.focus();
		return false;
	} 
	if(city=="")return;
	return true;
}

 function   coder(str)   
  {   
        var   s   =   "";   
        if   (str.length   ==   0)   return   "";   
        for   (var   i=0;   i<str.length;   i++)   
        {   
              switch   (str.substr(i,1))   
              {   
                      case   "<"     :   s   +=   "&lt;";       break;   
                      case   ">"     :   s   +=   "&gt;";       break;   
                      case   "&"     :   s   +=   "&amp;";     break;   
                      case   "   "     :   s   +=   "&nbsp;";   break;   
                      case   "\""   :   s   +=   "&quot;";   break;   
                      case   "\n"   :   s   +=   "<br>";       break;   
                      default       :   s   +=   str.substr(i,1);   break;   
              }   
        }   
        return   s;   
  }   

