		var url= "getPhysicianXML.cfm";
		var xmlDoc;
		this.agent=navigator.userAgent.toLowerCase();
		var ie = /msie/.test(this.agent);	
		var safari = /safari/.test(this.agent);	
		var mac = (navigator.appVersion.indexOf("Mac") != -1);		
		var failed = false;
		var idList = new Array();
		var lnameList = new Array();		
		var currId = -1;

		function handleChange(evt) {
		 	key = evt.keyCode || evt.which;
			 try{
				 if(document.getElementById&&key==40||key==38||key==13&&!(ie&&mac)&&!safari){
				 	 var chkd = (document.getElementById("physQueryResults").style.display!='none'&&document.getElementById("physQueryResults").innerHTML!='');	
	 				 if(key==40&&chkd){
						for(i=0;i<idList.length;i++){
							document.getElementById(idList[i]).style.backgroundColor = "#3279a3";
							document.getElementById(idList[i]).style.textDecoration = "none";
						}
						(currId<idList.length-1)?currId++:currId=idList.length-1;
						document.getElementById(idList[currId]).style.backgroundColor = "#5c8aab";
						document.getElementById(idList[currId]).style.textDecoration = "underline";
					 }
	 				 else if(key==38&&chkd){
						for(i=0;i<idList.length;i++){
							document.getElementById(idList[i]).style.backgroundColor = "#3279a3";
							document.getElementById(idList[i]).style.textDecoration = "none";
						}
						(currId<=0)?currId=0:currId--;						
						document.getElementById(idList[currId]).style.backgroundColor = "#5c8aab";
						document.getElementById(idList[currId]).style.textDecoration = "underline";
					 }
	 				 else if(key==13&&chkd){
					 	sendTxt(lnameList[currId]);
						return false;
					 }
				 }
				 else {
					 var s = document.physSort.Specialty;
					 var l = document.physSort.nmfld;			 
		    	     if ((window.ActiveXObject||window.XMLHttpRequest)&&!(ie&&mac)&&!safari&&!failed){ 
						url="getPhysicianXML.cfm?special=" + s.options[s.selectedIndex].value + "&str=" + l.value;			
						getContent();
					}	 
					else {//nothing works right in IE mac, others? so redirect
						//DO NOTHING
						//document.location="results_servr.cfm?special=" + s.options[s.selectedIndex].value + "&str=" + l.options[l.selectedIndex].value;			
					}
				}	
			}
			catch(err){}	
		}
		
		function getContent(){
			try{
				if (window.ActiveXObject)
				{	//micro$oft
					xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
				    if (xmlhttp)
				    {
				    xmlhttp.onreadystatechange=xmlhttpChange;
				    xmlhttp.open("GET",url,true);
				    xmlhttp.send();
				    }
				}
				else {//w3cDOM
					xmlhttp=new XMLHttpRequest();
					xmlhttp.onreadystatechange=xmlhttpChange;
					xmlhttp.open("GET",url,true);
					xmlhttp.send(null);
				}
			}
			catch(err){
				//DO NOTHING
				//failed = true;
				//handleChange();
			}	
		} 

		function xmlhttpChange(){
		if (xmlhttp.readyState==4){
		  if (xmlhttp.status==200){
				xmlDoc= xmlhttp.responseXML;
				parseContent();
			}
			else{
				//DO NOTHING
		    	//alert("Problem retrieving XML data");
		    }
		  }
		}		

		function parseContent(){
			var nodes = xmlDoc.documentElement.childNodes;
			var nodesLen = 0;
			for (var i=0; i<nodes.length; i++){if(nodes[i].nodeName=='physician')nodesLen++;} //nodes.length was different in IE vs Firefox
		 	idList = new Array();
			lnameList = new Array();
			var queryResults ='<ul>';
			for (var i=0; i<nodesLen; i++){
				queryResults += '<li><a id="' + xmlDoc.getElementsByTagName("id")[i].firstChild.nodeValue + '" href="#" onclick="sendTxt(\'' + xmlDoc.getElementsByTagName("lname")[i].firstChild.nodeValue + '\');return false;">' + xmlDoc.getElementsByTagName("lname")[i].firstChild.nodeValue + '</a></li>'; 
				idList.push(xmlDoc.getElementsByTagName("id")[i].firstChild.nodeValue);
				lnameList.push(xmlDoc.getElementsByTagName("lname")[i].firstChild.nodeValue);								
			}
			currId=-1;
			queryResults +='</ul>';
			document.getElementById("physQueryResults").innerHTML=queryResults;
			document.getElementById("physQueryResults").style.display = '';
		}
		
		function sendTxt(l){
			blurResults();
			if(typeof(l)!='undefined'){
				document.physSort.nmfld.value = l;
			}	
		}

		function blurResults(){
			document.getElementById("physQueryResults").style.display = 'none';
		}

		function TOblurResults(){
			setTimeout(blurResults, 1000);
		}
		