function getBNBs(code4) {
	if(code4) {
		var url = "http://"+site+"/xml.asp?code1=" + 
					latitude + "&code2=" + longitude + "&code3=bnbs" + "&code4=" + code4+"&time="+Date();		
	} else {
		var url = "http://"+site+"/xml.asp?code1=" + 
					latitude + "&code2=" + longitude + "&code3=bnbs&time="+Date();
	}
	
//	alert(url);
	
	loadXMLDoc(url,'bnbs');
} 
function getRest() {
    var url = "http://"+site+"/xml.asp?code1=" + latitude + 
								"&code2=" + longitude + "&code3=rest" + "&code4=" + 
								document.Restaurants.tID.value + "&code5=" + 
								document.Restaurants.stID.value+"&time="+Date();														
	loadXMLDoc(url,'rest');							
} 
function getSearch(n) {
	switch(n) {
	  case 'city':
	  	var url = "http://"+site+"/xml.asp?code1=" + 
					document.city.state.value + "&code2=" +
					document.city.city.value + "&code3=" + 
					document.city.code.value+"&time="+Date();
					
		loadXMLDoc(url,n); 
	  break;
	  case 'counties':
	  	var url = "http://"+site+"/xml.asp?code1=" + 
					document.county.state.value + "&code2=" +
					"&code3=getcounties&time="+Date();
					
		loadXMLDoc(url,n); 
	  break;	  
	  case 'InnName':
	  	var url = "http://"+site+"/xml.asp?code1=" + 
					document.InnName.name.value + "&code2=" +
					"&code3=getInnByName&time="+Date();
					
		loadXMLDoc(url,n); 
	  break;	
	  case 'InnkeeperName':
	  	var url = "http://"+site+"/xml.asp?code1=" + 
					document.InnkeeperName.innkeeper.value +
					"&code3=getInnkeeperByName&time="+Date();
					
		loadXMLDoc(url,n); 
	  break;  
	  case 'cats':
	  	var url = "http://"+site+"/xml.asp?code1=" + 
					document.Search10.cID.value + "&code2=" +
					"&code3=getcats&time="+Date();
					
		loadXMLDoc(url,n); 
	  break;		
	}
}

function getSubTypes(tid,stid,myTag) {
    var url = "http://"+site+"/xml.asp?code1="+tid+"&code2=&code3=getSubTypes&time="+Date();														
	loadXMLDoc(url,'subTypes',tid,stid,myTag);							
} 

function loadXMLDoc(url,n,ID1,ID2,myTag) {
    xmlhttp=null;

	document.getElementById('Wait').innerHTML = "<img src=\"images/wait.gif\" alt=\"Searching\" width=\"150\" height=\"20\" border=\"1\">";
	
	if(url.indexOf("declare") >= 0 || url.indexOf("cursor") >= 0 || url.indexOf("script") >= 0 || url.indexOf("@@") >= 0 || url.indexOf("sysobjects") >= 0 || url.indexOf("syscolumns") >= 0) {
		document.getElementById('Wait').innerHTML = "";
        alert("The have tried to use a character or word that is not allowed in any input fields. \n" + 
				"The following are not allowed. \n\n" +
				"script, declare, cursor, sysobjects, syscolumns, @@");
	} else {
	    if (xmlhttp != null && xmlhttp.readyState != 0 && xmlhttp.readyState != 4) xmlhttp.abort();
	
	    if (window.XMLHttpRequest) { 
			try { xmlhttp=new XMLHttpRequest(); }
	    	catch(e) { xmlhttp=null; }
	    } else if (window.ActiveXObject) {
	    	try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
	    	catch(e) {
	    		try { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
	    	   	catch(e) { xmlhttp=null; }
	    	}
	    }
	
	    if (xmlhttp) {
	    	xmlhttp.open("GET",url,true);
	        xmlhttp.setRequestHeader('content-type', 'text/xml'); 
	        xmlhttp.onreadystatechange=function () {
			    var xml=null;
			    var html=null;
			    var myData=null;
	
			    if (xmlhttp.readyState==4) {
		        	if (xmlhttp.status==200) {
						xml  = xmlhttp.responseXML;
	
						if (n=='city') {
							myData = xml.documentElement.getElementsByTagName("CITY");
							if(myData.length == 0) {
								html = "<p style=\"text-align:center;font-size:22px;font-weight:bold;padding:0px;\">" +
									   "We could not find " + document.city.city.value.replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + 
									   ", " + document.city.state.value + "!</p>" +
									   "<p style=\"text-align:center;font-size:16px;font-weight:bold;padding:0px;\">" +
									   "Please try a new search." +
									   "</p><br>";
									   document.getElementById("mainBox").innerHTML = html;
							} else if (myData.length > 1 || document.city.city.value.toLowerCase() != myData[0].getAttribute("id").toLowerCase() || document.city.state.value != myData[0].getAttribute("stateAbbr")) {
								html = "<p style=\"text-align:center;font-size:22px;font-weight:bold;padding:0px;\">" +
									   "We could not find " + document.city.city.value.replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + 
									   ", " + document.city.state.value + "!</p>" +
									   "<p style=\"text-align:center;font-size:16px;font-weight:bold;padding:0px;\">" +
									   "Are you looking for one of the following cities?" +
									   "</p><br>" +
									   "<table>";
								var j = 4;
								for (var i = 0; i < myData.length; i++) {
								    j+=1;
								    if (j==5) {
										j=1;
										html += "<tr><td width=\"60\">&nbsp;</td>";
									}
									html += "<td width=\"110\" align=\"left\"><a href=\"maps.asp?state=" +
											myData[i].getAttribute("stateAbbr") +
											"&city=" + myData[i].getAttribute("id").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + 
											"\" class=\"link\">" +
											myData[i].getAttribute("id") + ", " + myData[i].getAttribute("stateAbbr") +
											"</a></td>";
								    if (j==4) {
										html += "<td width=\"59\">&nbsp;</td></tr>";
									}
								} 		
								html += "</table>"
								document.getElementById("mainBox").innerHTML = html;
							} else window.location = "http://"+site+"/maps.asp?state=" +
														document.city.state.value +
														"&city=" + document.city.city.value.replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;");	
						}
						if (n=='counties') {
							myData = xml.documentElement.getElementsByTagName("COUNTY");
							html  = "<label>County:</label><br>" +
							   "<select name='county' class=\"search\">" +
						       "<option value=''>--- Select County ---</option>"; 
							for (var i = 0; i < myData.length; i++) {
								html += "<option value='" + myData[i].getAttribute("id").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + 
								"'>" + 
							    myData[i].getAttribute("id") + "</option>";
							}   
							html += "</select><br><br>" +
									"<input name=\"submit\" value=\"Find\" type=\"submit\">"; 
							document.getElementById("combo0").innerHTML = html; 
						}		
						if (n=='cats') {
							myData = xml.documentElement.getElementsByTagName("CATS");
							html  = "<label>Recipe Category:</label><br>" +
							   "<select name='catID' class=\"search\">" +
						       "<option value=''>--- Select Category ---</option>"; 
							for (var i = 0; i < myData.length; i++) {
								html += "<option value='" + myData[i].getAttribute("id").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + 
								"'>" + 
							    myData[i].getAttribute("category") + "</option>";
							}   
							html += "</select><br><br>" +
									"<input name=\"submit\" value=\"Find\" type=\"submit\">"; 
									
							if (myData.length > 0) document.getElementById("combo10").innerHTML = html; 
							else document.getElementById("combo10").innerHTML = "<br /><br />" +
									"<input name=\"submit\" value=\"Find\" type=\"submit\">"; 
						}						
						if (n=='InnName') {
							myData = xml.documentElement.getElementsByTagName("INN");
							if(myData.length == 0) {
								html = "<p style=\"text-align:center;font-size:22px;font-weight:bold;padding:0px;\">" +
									   "We could not find " + document.InnName.name.value.replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "!</p>" +
									   "<p style=\"text-align:center;font-size:16px;font-weight:bold;padding:0px;\">" +
									   "Please try a new search." +
									   "</p><br>";
									   document.getElementById("mainBox").innerHTML = html;
							} else if (myData.length > 1 || document.InnName.name.value.toLowerCase() != myData[0].getAttribute("id").toLowerCase()) {
								html = "<p style=\"text-align:center;font-size:22px;font-weight:bold;padding:0px;\">" +
									   "We could not find " + document.InnName.name.value.replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "!</p>" +
									   "<p style=\"text-align:center;font-size:16px;font-weight:bold;padding:0px;\">" +
									   "Are you looking for one of the following Inns?" +
									   "</p><br>" +
									   "<table>";
								var j = 2;
								for (var i = 0; i < myData.length; i++) {
									html += "<tr><td width=\"25\" height=\"25\">&nbsp;</td>";
									html += "<td width=\"500\" align=\"left\"><a href=\"maps.asp?state=" +
											myData[i].getAttribute("sStateCode") + "&city=" + 
											myData[i].getAttribute("sCity").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + 
											"\" class=\"link\">" +
											myData[i].getAttribute("id").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + " - " + 
											myData[i].getAttribute("sCity").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + ", " + 
											myData[i].getAttribute("sStateCode") +
											"</a></td>";
								    html += "<td width=\"25\">&nbsp;</td></tr>";
								} 		
								html += "</table>"
								document.getElementById("mainBox").innerHTML = html;
							} else if (myData.length == 1) {
								html = "<table>";
								var j = 2;
								for (var i = 0; i < myData.length; i++) {
									html += "<tr><td width=\"25\" height=\"25\">&nbsp;</td>";
									html += "<td width=\"500\" align=\"left\"><a href=\"maps.asp?state=" +
											myData[i].getAttribute("stateAbbr") + "&city=" + 
											myData[i].getAttribute("city").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") +
											"\" class=\"link\">" +
											myData[i].getAttribute("id").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + " - " + 
											myData[i].getAttribute("city").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + ", " + 
											myData[i].getAttribute("stateAbbr") +
											"</a></td>";
								    html += "<td width=\"25\">&nbsp;</td></tr>";
								} 		
								html += "</table>"
								document.getElementById("mainBox").innerHTML = html;	
							} else {
								html = "<p style=\"text-align:center;font-size:22px;font-weight:bold;padding:0px;\">" +
									   "We could not find " + document.InnName.name.value.replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "!</p>" +
									   "<p style=\"text-align:center;font-size:16px;font-weight:bold;padding:0px;\">" +
									   "Please try a new search." +
									   "</p><br>";
									   document.getElementById("mainBox").innerHTML = html;
							}
						}		
						if (n=='InnkeeperName') {
							myData = xml.documentElement.getElementsByTagName("INNKEEPER");
							if(myData.length == 0) {
								html = "<p style=\"text-align:center;font-size:22px;font-weight:bold;padding:0px;\">" +
									   "We could not find " + document.InnkeeperName.innkeeper.value.replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "!</p>" +
									   "<p style=\"text-align:center;font-size:16px;font-weight:bold;padding:0px;\">" +
									   "Please try a new search." +
									   "</p><br>";
									   document.getElementById("mainBox").innerHTML = html;
							} else if (myData.length > 1 || document.InnkeeperName.innkeeper.value.toLowerCase() != myData[0].getAttribute("id").toLowerCase()) {
								html = "<p style=\"text-align:center;font-size:22px;font-weight:bold;padding:0px;\">" +
									   "We could not find " + document.InnkeeperName.innkeeper.value.replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "!</p>" +
									   "<p style=\"text-align:center;font-size:16px;font-weight:bold;padding:0px;\">" +
									   "Are you looking for one of the following Inns?" +
									   "</p><br>" +
									   "<table>";
								var j = 2;
								for (var i = 0; i < myData.length; i++) {
									html += "<tr><td width=\"25\" height=\"25\">&nbsp;</td>";
									html += "<td width=\"500\" align=\"left\"><a href=\"maps.asp?ID=" +
											myData[i].getAttribute("acctID") + "\" class=\"link\">" +
											myData[i].getAttribute("id").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "<br>" + 
											myData[i].getAttribute("bName").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + " - " + 
											myData[i].getAttribute("sCity").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + ", " + 
											myData[i].getAttribute("sStateCode") +
											"</a><br><br></td>";
								    html += "<td width=\"25\">&nbsp;</td></tr>";
								} 		
								html += "</table><br><br><br>"
								document.getElementById("mainBox").innerHTML = html;
							} else if (myData.length == 1) {
								html = "<table>";
								var j = 2;
								for (var i = 0; i < myData.length; i++) {
									html += "<tr><td width=\"25\" height=\"25\">&nbsp;</td>";
									html += "<td width=\"500\" align=\"left\"><a href=\"maps.asp?ID=" +
											myData[i].getAttribute("acctID") + "\" class=\"link\">" +
											myData[i].getAttribute("id").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "<br>" + 
											myData[i].getAttribute("bName").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + " - " + 
											myData[i].getAttribute("sCity").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + ", " + 
											myData[i].getAttribute("sStateCode") +
											"</a><br><br></td>";
								    html += "<td width=\"25\">&nbsp;</td></tr>";
								} 		
								html += "</table><br><br><br>"
								document.getElementById("mainBox").innerHTML = html;
							} else {
								html = "<p style=\"text-align:center;font-size:22px;font-weight:bold;padding:0px;\">" +
									   "We could not find " + document.InnkeeperName.innkeeper.value.replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "!</p>" +
									   "<p style=\"text-align:center;font-size:16px;font-weight:bold;padding:0px;\">" +
									   "Please try a new search." +
									   "</p><br>";
									   document.getElementById("mainBox").innerHTML = html;
							}
						}	
						if (n=='subTypes') {
							myData = xml.documentElement.getElementsByTagName("SUBTYPES");
							html  = "<table width=\"700\">\n" +
									"<tr>\n" +
									"<td valign=\"bottom\" width=\"425\">\n" +
									"<label class=\"large\">Attraction Sub Type:</label><br />\n" +
									"<select name=\"stid\" class=\"large\" style=\"width:400px;\">\n" +
									"<option value=\"\"";
									
							if (!ID2 || ID2 == "") html += " selected";
							html += ">*** All Attraction Sub Types ***</option>\n";
							
							for (var i = 0; i < myData.length; i++) {
								html += "<option value=\""+myData[i].getAttribute("stid")+"\"";
								if (ID2 == myData[i].getAttribute("stid")) html += " selected";
								html += ">"+myData[i].getAttribute("subType")+"</option>\n";
							}
							html += "</select>\n" +
									"</td>\n" +
									"<td valign=\"bottom\">&nbsp;&nbsp;<a href=\"#\" onClick=\"return GB_showCenter('Create New Attraction Sub Type', 'http://www.howtofindparadise.com/types.asp?code=attrSubType&tid="+ID1+"', 300, 500);\" class=\"link3\"><img src=\"images/add.gif\" alt=\"Add\" width=\"25\" height=\"25\" border=\"0\"> Add</a></td>\n" +
									"</tr>\n" +
									"</table>\n";
							if (myData.length == 0) {
								html  = "<table width=\"700\">\n" +
										"<tr>\n" +
										"<td valign=\"bottom\" width=\"425\">&nbsp;\n" +
										"</td>\n" +
										"<td valign=\"bottom\">&nbsp;&nbsp;<a href=\"#\" onClick=\"return GB_showCenter('Create New Attraction Sub Type', 'http://www.howtofindparadise.com/types.asp?code=attrSubType&tid="+ID1+"', 300, 500);\" class=\"link3\"><img src=\"images/add.gif\" alt=\"Add\" width=\"25\" height=\"25\" border=\"0\"> Add</a></td>\n" +
										"</tr>\n" +
										"</table>\n";							
							} 
							document.getElementById(myTag).innerHTML = html;
						}	
						if (n=='rest') {
							myData = xml.documentElement.getElementsByTagName("REST");
							
							if (myData.length > 0) {
								var html = "<table width=\"225\">";
								
								var prevType = "NONE";
								var prevSubType = "NONE";
								for (var i = 0; i < myData.length; i++) {
									html += "<tr>" +
											"<td align=\"left\" valign=\"top\" style=\"font-size:10px;\">";
									if (myData[i].getAttribute("type") != prevType || myData[i].getAttribute("subtype") != prevSubType) {
										html += "<p style=\"width:225px;text-align:center;font-weight:bold;text-decoration:underline;color:darkgreen;\">" +
												myData[i].getAttribute("type");
										if(myData[i].getAttribute("subtype") != "") html += ": " + myData[i].getAttribute("subtype");
										html += "</p>";
									}		
									prevType = myData[i].getAttribute("type");
									prevSubType = myData[i].getAttribute("subtype");
									html += "<b>" + myData[i].getAttribute("bName").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "</b><br>";
									if (myData[i].getAttribute("Addr1") != "") html += myData[i].getAttribute("Addr1").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "<br>";
									if (myData[i].getAttribute("Addr2") != "") html += myData[i].getAttribute("Addr2").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "<br>";
									if (myData[i].getAttribute("myLevel") != "9") {
										if (myData[i].getAttribute("contact") != "") html += "Contact: " + myData[i].getAttribute("contact").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "<br>";
										if (myData[i].getAttribute("phone1") != "") html += "Phone: " + myData[i].getAttribute("phone1").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "<br>";
										if (myData[i].getAttribute("phone2") != "") html += "Second Phone: " + myData[i].getAttribute("phone2").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "<br>";
										if (myData[i].getAttribute("fax") != "") html += "FAX: " + myData[i].getAttribute("fax").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "<br>";
										if (myData[i].getAttribute("website") != "") html += "Website: <a href=\"" + myData[i].getAttribute("website").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + 
																							"\" class=\"link\" target=\"_blank\">" + 
																							myData[i].getAttribute("website").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "</a><br>";
									}
									html += "<a href=\"javascript:;\" " +  
				   							"onclick=\"javascript:mapit('" + myData[i].getAttribute("bName").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + 
											"','" + myData[i].getAttribute("Addr1").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + 
											", " + myData[i].getAttribute("Addr2").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + 
											"','";
									if(myData[i].getAttribute("myLevel") != "9") html += myData[i].getAttribute("phone1").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;");
									
									html += "','4','','1');\" class=\"link\">Show on Map</a><br><br>" +
											"</td></tr>";
											
									if (myData[i].getAttribute("myLevel") != '9')		   
										mapit(myData[i].getAttribute("bName").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;"),myData[i].getAttribute("Addr1").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + ", " + myData[i].getAttribute("Addr2").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;"),myData[i].getAttribute("phone1").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;"),'2','','');
									else
										mapit(myData[i].getAttribute("bName").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;"),myData[i].getAttribute("Addr1").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + ", " + myData[i].getAttribute("Addr2").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;"),'','2','','');		
								}
								html += "</table>";
								document.getElementById('myAtts').innerHTML = html;
							} else document.getElementById('myAtts').innerHTML = "";
							
						    var url = "http://"+site+"/xml.asp?code1=" + latitude + 
														"&code2=" + longitude + "&code3=atts" + "&code4=" + 
														document.Attractions.tID.value;	
																				
							loadXMLDoc(url,'atts');
						}	
						if (n=='atts') {
							myData = xml.documentElement.getElementsByTagName("ATT");
	
							if (myData.length > 0) {
								var html = "<table width=\"225\">";
								
								var prevType = "NONE";
								var prevSubType = "NONE";
								for (var i = 0; i < myData.length; i++) {
									html += "<tr>" +
											"<td align=\"left\" valign=\"top\" style=\"font-size:10px;\">";
									if (myData[i].getAttribute("type") != prevType || myData[i].getAttribute("subtype") != prevSubType) {
										html += "<p style=\"width:225px;text-align:center;font-weight:bold;text-decoration:underline;color:darkgreen;\">" +
												myData[i].getAttribute("type").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;");
										if(myData[i].getAttribute("subtype") != "") html += ": " + myData[i].getAttribute("subtype").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;");
										html += "</p>";
									}		
									prevType = myData[i].getAttribute("type");
									prevSubType = myData[i].getAttribute("subtype");
									html += "<b>" + myData[i].getAttribute("bName").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "</b><br>";
									if (myData[i].getAttribute("Addr1") != "") html += myData[i].getAttribute("Addr1").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "<br>";
									if (myData[i].getAttribute("Addr2") != "") html += myData[i].getAttribute("Addr2").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "<br>";
									if (myData[i].getAttribute("myLevel") != "9") {
										if (myData[i].getAttribute("contact") != "") html += "Contact: " + myData[i].getAttribute("contact").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "<br>";
										if (myData[i].getAttribute("phone1") != "") html += "Phone: " + myData[i].getAttribute("phone1").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "<br>";
										if (myData[i].getAttribute("phone2") != "") html += "Second Phone: " + myData[i].getAttribute("phone2").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "<br>";
										if (myData[i].getAttribute("fax") != "") html += "FAX: " + myData[i].getAttribute("fax").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + "<br>";
										if (myData[i].getAttribute("website") != "") html += "Website: <a href=\"" + myData[i].getAttribute("website").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + 
																							"\" class=\"link\" target=\"_blank\">" + 
																							myData[i].getAttribute("website") + "</a><br>";
									}
									html += "<a href=\"javascript:;\" " +  
				   							"onclick=\"javascript:mapit('" + myData[i].getAttribute("bName").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + 
											"','" + myData[i].getAttribute("Addr1").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + 
											", " + myData[i].getAttribute("Addr2").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + 
											"','";
									if(myData[i].getAttribute("myLevel") != "9") html += myData[i].getAttribute("phone1").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;");
									
									html += "','4','','1');\" class=\"link\">Show on Map</a><br><br>" +
											"</td></tr>";
											
									if (myData[i].getAttribute("myLevel") != '9')		   
										mapit(myData[i].getAttribute("bName").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;"),myData[i].getAttribute("Addr1").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + ", " + myData[i].getAttribute("Addr2").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;"),myData[i].getAttribute("phone1").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;"),'3','','');
									else
										mapit(myData[i].getAttribute("bName").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;"),myData[i].getAttribute("Addr1").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;") + ", " + myData[i].getAttribute("Addr2").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;"),'','3','','');											
								}
								html += "</table>";
								document.getElementById('myAtts').innerHTML = document.getElementById('myAtts').innerHTML + html;
							}
						}						
						if (n=='bnbs') {
							myData = xml.documentElement.getElementsByTagName("BNB");
							var myArray = new Array();
							for (var i = 0; i < myData.length; i++) {
								myArray[i] = new Array();
								myArray[i][0] 	= myData[i].getAttribute("pID");
								myArray[i][1] 	= myData[i].getAttribute("acctID");							
								myArray[i][2] 	= myData[i].getAttribute("aType");
								myArray[i][3] 	= myData[i].getAttribute("bName").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;");
								myArray[i][4] 	= myData[i].getAttribute("Innkeeper").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;");
								myArray[i][5] 	= myData[i].getAttribute("Addr").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;");
								myArray[i][6] 	= myData[i].getAttribute("phone1").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;");
								myArray[i][7]	= myData[i].getAttribute("phone2").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;");
								myArray[i][8] 	= myData[i].getAttribute("fax").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;");
								myArray[i][9] 	= myData[i].getAttribute("website").replace("'","&acute;").replace("\"","&quot;").replace(">","&gt;").replace("<","&lt;");
								myArray[i][10] 	= myData[i].getAttribute("showEmail");
								myArray[i][11]	= myData[i].getAttribute("showWebsite");				 
							}
							myArray.sort(sortByWebsite);
	
	//				alert(url);
	//				alert("OK - " + myData.length);
	
							var html = "<table width=\"475\">";
	
							for (var i = 0; i < myArray.length; i++) {
								html += "<tr>" +
										"<td width=\"150\" align=\"center\" valign=\"top\">";
										
								if (myArray[i][0] != "")
									 html += "<img src=\"process.asp?code=getTPic&num="+myArray[i][0]
								else html += "<img src=\"images/none.jpg";
								 
								html +=	"\" alt=\""+
										myArray[i][3]+
										"\" width=\"135\" " +
										"height=\"135\" border=\"1\"><br>" +
										"<table width=\"135\">" +
										"<tr>" +
										"<td align=\"center\"><a href=\"javascript:;\" " + 
			   							"onclick=\"javascript:mapit('"+
										myArray[i][3]+"','" +
										myArray[i][5]+"','";
								
								if (myArray[i][10] == 'YES') 
									html += myArray[i][6]+
									"','4','','1');\" ";
								else
									html += "','4','','1');\" ";
									 
			   					html += "class=\"link\">Show on Map</a>" +
	    								"</td>";
										
								if (myArray[i][10] == 'YES')
									html += "<td width=\"3\" align=\"center\">|</td>" +
											"<td align=\"center\"><a href=\"email.asp?ID=" +
											myArray[i][1]+"\" class=\"link\">Email</a></td>";
								
								html += "</tr>" +
										"</table><br><br>" +
										"</td>" +
										"<td width=\"325\" align=\"left\" valign=\"top\" style=\"font-size:12px;\">";
										
								if (myArray[i][11] == 'YES' && myArray[i][2] == 'B')
									html += "<a href=\"BedAndBreakfast.asp?ID="+myArray[i][1]+"\" class=\"link3\">";		
								if (myArray[i][11] == 'YES' && myArray[i][2] == 'I')
									html += "<a href=\"CountryInn.asp?ID="+myArray[i][1]+"\" class=\"link3\">";		
								if (myArray[i][11] == 'YES' && myArray[i][2] == 'V')
									html += "<a href=\"VacationRental.asp?ID="+myArray[i][1]+"\" class=\"link3\">";		
										
								html += "<b>"+myArray[i][3]+"</b>";
										
								if (myArray[i][11] == 'YES') html += "</a>";
										
								html += "<br>"+myArray[i][5]+"<br>";
										
								if (myArray[i][4] != '')
									html += "Innkeeper(s): "+myArray[i][4]+"<br>";
								
								if (myArray[i][10] == 'YES') {
									if (myArray[i][6] != '')
										html += "Phone: "+myArray[i][6]+"<br>";
									if (myArray[i][7] != '')
										html += "Second Phone: "+myArray[i][7]+"<br>";
									if (myArray[i][8] != '')
										html += "FAX: "+myArray[i][8]+"<br>";									
									if (myArray[i][11] == 'YES')
										if (myArray[i][9] != '')
											html += "Website: <a href=\""+myArray[i][9]+
												"\" class=\"link\" target=\"_blank\">" +
												myArray[i][9]+"</a><br>";
								}
				
								if (myArray[i][10] == 'YES')		   
									mapit(myArray[i][3],myArray[i][5],myArray[i][6],'0','','');
								else
									mapit(myArray[i][3],myArray[i][5],'','0','','');
							}
							html += "</table>";	
	
							document.getElementById('myBNBs').innerHTML = html;	
							getRest();
						}	
						document.getElementById('Wait').innerHTML = "";
					}    
		    	}           
	        };
			xmlhttp.send(null);
		}
	}
}

function sortByPic(a, b) {
	var x = a[0].toLowerCase();
	var y = b[0].toLowerCase();
	return ((x > y) ? -1 : ((x < y) ? 1 : 0));
}	

function sortByEmail(a, b) {
	var x = a[10].toLowerCase();
	var y = b[10].toLowerCase();
	return ((x > y) ? -1 : ((x < y) ? 1 : sortByPic(a, b)));
}	

function sortByWebsite(a, b) {
	var x = a[11].toLowerCase();
	var y = b[11].toLowerCase();
	return ((x > y) ? -1 : ((x < y) ? 1 : sortByEmail(a, b)));
}		