﻿var xhr;
var cityHT=0;
function getXHR()
{
	try {
		xhr=new ActiveXObject("Msxml2.XMLHTTP");
		} 
	catch (e) {
		try {
			xhr=new ActiveXObject("Microsoft.XMLHTTP");
			} 
		catch (e) {
			xhr=false;
			}
		}
	if(!xhr&&typeof XMLHttpRequest!='undefined')
		{
		xhr=new XMLHttpRequest();
		}
	return xhr;
}

function openXHR(method,url,callback)
{
	getXHR();
	xhr.open(method,url);
	xhr.onreadystatechange=function()
	{
	if(xhr.readyState!=4)return;
	callback(xhr);
	}
	xhr.send(null);
}

function loadXML(method,url,callback)
{
	getXHR();
	xhr.open(method,url);
	xhr.setRequestHeader("Content-Type","text/xml");
	xhr.setRequestHeader("Content-Type","GBK");
	xhr.onreadystatechange=function()
	{
	if(xhr.readyState!=4)return;
	callback(xhr);
	}
	xhr.send(null);
}

function getCookie(objName){//获取指定名称的cookie的值
			var arrStr = document.cookie.split("; ");
			for(var i = 0;i < arrStr.length;i ++){
				var temp = arrStr[i].split("=");
				if(temp[0] == objName) return unescape(temp[1]);
			} 
		} 

    function rv(){if(typeof(added)!='undefined'&&added){returnValue=1;}}

//用于地图查询城市选择在界面显示-------------------------
function CityIMT(c)
{
	if (cityHT==c&&citymaptab.style.display=="block")//修改将半判断条件||改为&&
		{cityHT=0;}
	else
		{ 
		if (c>4){cityHT=c-4;}
		else{cityHT=c;}
		citymaptab.style.display="block";
		divid=2;
		
		divwin();
		}
}
function divwin()
{
	document.getElementById("citymaptab").style.top=document.body.scrollTop+(document.body.clientHeight-document.getElementById("citymaptab").offsetHeight)/2+10;
 document.getElementById("citymaptab").style.left=document.body.scrollLeft+(document.body.clientWidth-document.getElementById("citymaptab").offsetWidth)/2;
}

function CityIMD()
{
	citymaptab.style.display="none";
	document.all["overDiv"].style.display="none";
}

//用于城市信息填充
function SetCityTxt(c)
{
	eval('document.all.querycard1_tb_city').value=c;
	changemakeunit(c,'ddl_clinicfullname');
	citymaptab.style.display="none";
	document.all["overDiv"].style.display="none";
}

function SelectCityMon(c)	//地图鼠标放入得到全省城市
{
	c.style.backgroundColor="#D6F1EC";
	c.style.color='red';
}
function SelectCityMou(c)	//地图鼠标放入得到全省城市
{
	c.style.backgroundColor='';
	c.style.color='';
}
function setfullname()	//地图鼠标放入得到全省城市
{
	document.all["querycard1_tb_fullname"].value=document.all["ddl_clinicfullname"].value;
}



















var XmlHttp = null;
function $(val)
{
    return document.getElementById(val);
}

function GetXmlHttpObj()
{
	var XmlHttpObj = null;
	try
	{ 
		if(window.ActiveXObject)
		{ 
			for(var i = 5;i;i--)
			{ 
				try
				{
					if( i == 2 )
					{ 
						XmlHttpObj = new ActiveXObject( "Microsoft.XMLHTTP" ); 
					}
					else
					{ 
						XmlHttpObj = new ActiveXObject( "Msxml2.XMLHTTP." + i + ".0" ); 
					} 
					XmlHttpObj.setRequestHeader("Content-Type","text/xml"); 
					XmlHttpObj.setRequestHeader("Content-Type","utf-8"); 
					break;
				}
				catch(e)
				{}
			}
		}
		else if( window.XMLHttpRequest )
		{ 
			XmlHttpObj = new XMLHttpRequest(); 
			if (XmlHttpObj.overrideMimeType) 
			{
				XmlHttpObj.overrideMimeType('text/xml');
			}
		}
	}
	catch(e)
	{}
	return XmlHttpObj
}


function XmlHttpGetMethod(uri)
{
	XmlHttp = GetXmlHttpObj();
	if(XmlHttp == null)
	{
		alert('很抱歉，你的浏览器版本不支持，操作终止');
		return;
	}
	XmlHttp.open("GET",uri,false);
	XmlHttp.send();
}


function XmlHttpPostMethod(uri,parmsStr)
{
	XmlHttp = GetXmlHttpObj();
	if(XmlHttp == null)
	{
		alert('很抱歉，你的浏览器版本不支持，操作终止');
		return;
	}
	XmlHttp.open("POST",uri,false);	
	XmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	XmlHttp.send(parmsStr);
}

function XmlHttpGetMethodText(uri)
{
	XmlHttpGetMethod(uri);
	return XmlHttp.responseText;
}

function XmlHttpPostMethodText(uri,parmsStr)
{
	XmlHttpPostMethod(uri,parmsStr);
	return XmlHttp.responseText;
}

function XmlHttpGetMethodXml(uri)
{
	XmlHttpGetMethod(uri);
	return XmlHttp.responseXML;
}

function XmlHttpPostMethodXml(uri,parmsStr)
{
	XmlHttpPostMethod(uri,parmsStr);
	return XmlHttp.responseXML;
}
