	<!--

		/* --------------------------- STANDARD ROUTINES --------------------------- */

		var ns4 = (document.layers);
		var ie4 = (document.all && !document.getElementById);
		var ie5 = (document.all && document.getElementById);
		var ns6 = (!document.all && document.getElementById);

		function showMenu(where) {
			if (ns4) {
				document.layers[where].style.visibility="visible";
			} else if (ie4) {
				document.all[where].style.visibility="visible";
			} else if (ie5 || ns6) {
				document.getElementById(where).style.visibility="visible";
			}
		}

		function hideMenu(where) {
			if (ns4) {
				document.layers[where].style.visibility="hidden";
			} else if (ie4) {
				document.all[where].style.visibility="hidden";
			} else if (ie5 || ns6) {
				document.getElementById(where).style.visibility="hidden";
			}
		}

		function SwapText(where, what) {
			if (ns4) {
				document.layers[where].innerHTML=what;
			} else if (ie4) {
				document.all[where].innerHTML=what;
			} else if (ie5 || ns6) {
				document.getElementById(where).innerHTML=what;
			}
		}

		function GetText(where) {
			if (ns4) {
				var what = document.layers[where].innerHTML;
			} else if (ie4) {
				var what = document.all[where].innerHTML;
			} else if (ie5 || ns6) {
				var what = document.getElementById(where).innerHTML;
			}
			return what;
		}

		function GetMonths() {
			var moList = {
				"1" : "January",
				"2" : "February",
				"3" : "March",
				"4" : "April",
				"5" : "May",
				"6" : "June",
				"7" : "July",
				"8" : "August",
				"9" : "September",
				"10" : "October",
				"11" : "November",
				"12" : "December"
			}
			return moList;
		}

		function DoBox(url,w,h,top,left) {
			window.open(url,'popup','height=' + h + ',width=' + w + ',top=' + top + ',left=' + left + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no');
		}

		function DoBox2(url,w,h,top,left) {
			window.open(url,'popup','height=' + h + ',width=' + w + ',top=' + top + ',left=' + left + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes');
		}

		function CheckTime(dname,fname) {
			msg = "Please enter a valid time in\n\'0:00 AM\' or \'0:00 PM\' format.";
			tmp = document[dname][fname].value;
			tmp = tmp.toUpperCase();
			if (!tmp.indexOf(":")) {
				alert(msg);
				document[dname][fname].focus();
				return true;
			}
			if (tmp.indexOf(" ")) {
				timeArray = tmp.split(" ");
				if (timeArray.length !== 2) {
					alert(msg);
					document[dname][fname].focus();
					return true;
				} else {
					dayPart = timeArray[1];
					if ((dayPart !== "AM") && (dayPart !== "PM")) {
						alert(msg);
						document[dname][fname].focus();
						return true;
					}
				}
			}
			numArray = timeArray[0].split(":");
			if (numArray.length !== 2) {
				alert(msg);
				document[dname][fname].focus();
				return true;
			} else {
				var hr = numArray[0];
				var mn = numArray[1];
				if ((hr.length !== 1) && (hr.length !== 2)) {
					alert(msg);
					document[dname][fname].focus();
					return true;
				}
				if ((mn.length !== 1) && (mn.length !== 2)) {
					alert(msg);
					document[dname][fname].focus();
					return true;
				}
				if (hr.substr(0, 1) == "0") {
					hr = hr.substr(1, 1);
				}
				if (mn.substr(0, 1) == "0") {
					mn = mn.substr(1, 1);
				}
				if ((isNaN(hr)) || (isNaN(mn))) {
					alert(msg);
					document[dname][fname].focus();
					return true;
				}
				if ((hr < 1) || (hr > 12) || (mn < 0) || (mn > 59)) {
					alert(msg);
					document[dname][fname].focus();
					return true;
				}
			}
		}

		function CheckRadio(dname,fname,msg,num) {
			var isOk = false;
			for (i = 0; i < num; i++) {
				if (document[dname][fname][i].checked==true) {
					isOk = true;
					break;
				}
			}
			if (isOk == false) {
				alert(msg);
				return true;
			}
		}

		function CheckDate(dname,fname,msg) {
			var frmName = dname;
			var fldName = fname;
			var alertText = msg;
			var string1 = document[frmName][fldName].value;
			if (string1.indexOf("/")==-1) {
				alert(alertText);
				document[frmName][fldName].focus();
				return true;
			}
		        var dateArray = string1.split('/');
			if (dateArray.length !== 3) {
				alert(alertText);
				document[frmName][fldName].focus();
				return true;
			}
			if ((isNaN(dateArray[0])) || (isNaN(dateArray[1])) || (isNaN(dateArray[2]))) {
				alert(alertText);
				document[frmName][fldName].focus();
				return true;
			}
			var vMonth = dateArray[0];
			var vDay = dateArray[1];
			var vYear = dateArray[2];
			if ((vMonth > 12) || (vMonth < 1)) {
				alert(alertText);
				document[frmName][fldName].focus();
				return true;
			}
			if ((vDay < 1) || (vDay > 31)) {
				alert(alertText);
				document[frmName][fldName].focus();
				return true;
			}
			if (vMonth == 2) {
				var febMax = 28;
				var startYear = 1004;
				for (count = 0; count < 1000; count++) {
					startYear = startYear + 4;
					if (vYear == startYear) {
						febMax = 29;
						break;
					}
				}
				if (vDay > febMax) {
					alert(alertText);
					document[frmName][fldName].focus();
					return true;
				}
			}
			if ((vMonth == 4) || (vMonth == 6) || (vMonth == 9) || (vMonth == 11)) {
				if (vDay > 30) {
					alert(alertText);
					document[frmName][fldName].focus();
					return true;
				}
			}
			if ((vMonth == 1) || (vMonth == 3) || (vMonth == 5) || (vMonth == 7) || (vMonth == 8) || (vMonth == 10) || (vMonth == 12)) {
				if (vDay > 31) {
					alert(alertText);
					document[frmName][fldName].focus();
					return true;
				}
			}
			if ((vYear < 1000) || (vYear > 9999)) {
				alert(alertText);
				document[frmName][fldName].focus();
				return true;
			}
		}

		function CheckEmail(dname,fname,msg) {
			var frmName = dname;
			var fldName = fname;
			var alertText = msg;
			var string1 = document[frmName][fldName].value;
			if ((string1.indexOf("@")==-1) || (string1.indexOf(".")==-1)) {
				alert(alertText);
				document[frmName][fldName].focus();
				return true;
			}
		}

		function CheckNull(dname,fname,msg) {
			var frmName = dname;
			var fldName = fname;
			var alertText = msg;
			var string1 = document[frmName][fldName].value;
			var string2 = string1.replace(/ /g, "");
			if (string2=="") {
				alert(alertText);
				document[frmName][fldName].focus();
				return true;
			}
		}


		function CheckLength(dname,fname,msg,max) {
			var frmName = dname;
			var fldName = fname;
			var alertText = msg;
			var maxLen = max - 0;
			var string1 = document[frmName][fldName].value;
			if (string1.length > maxLen) {
				alert(alertText);
				document[frmName][fldName].focus();
				return true;
			}
		}


		/* ------------------------------ STANDARD AJAX ---------------------------- */


		function PostItem(theScript, frmName, div) {
			frmName = document.forms[frmName];
			var fld;
			var theData = "";
			for (i = 0; i < frmName.elements.length; i++) {
				fld = frmName.elements[i];
				if ((fld.type !== "button") && (fld.type !== "submit")) {
					if ((fld.type == "radio") || (fld.type == "checkbox")) {
						if (fld.checked) {
							if (i > 0) {
								theData += "&" + fld.name + "=" + escape(fld.value);
							} else {
								theData += fld.name + "=" + escape(fld.value);
							}
						}
					} else {
						if (i > 0) {
							theData += "&" + fld.name + "=" + escape(fld.value);
						} else {
							theData += fld.name + "=" + escape(fld.value);
						}
					}
				}
			}
			var xmlHttp;
			if (xmlHttp = startAjax()) {
				xmlHttp.open("POST", theScript, true);
				xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				xmlHttp.onreadystatechange = function() {
					if (xmlHttp.readyState == 4) {
						var theText = xmlHttp.responseText;
						showMenu(div);
						SwapText(div, theText);
					}
				}
				xmlHttp.send(theData);
			}
		}

		function GetItem(scrp, div, tmp) {
			var theScript = scrp + tmp;
			var xmlHttp;
			if (xmlHttp = startAjax()) {
				xmlHttp.onreadystatechange = function() {
					if(xmlHttp.readyState == 4) {
						var theText = xmlHttp.responseText;
						showMenu(div);
						SwapText(div, theText);
					}
				}
				xmlHttp.open("GET", theScript, true);
				xmlHttp.send(null);
			}
			if (tmp.indexOf("#") == 0) {
				document.location.href = tmp;
			}
		}

		function startAjax() {
			var xmlHttp;
			try {
				xmlHttp = new XMLHttpRequest();
			//	xmlHttp.overrideMimeType("text/xml");
			}
			catch (e) {
				try {
					xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch (e) {
					try {
						xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
					}
					catch (e) {
						alert("Your browser does not support AJAX.");
						return false;
					}
				}
			}
			return xmlHttp;
		}


		/* -------------------------------- EDITOR TOY ----------------------------- */

		function GetSortForm(place, extraid) {
			var theScript = "../modules/moEditorSort.php?itemplace=" + place + "&extraid=" + extraid;
			GetItem(theScript, "itemlist", "");
			SwapText("newform", "");
		}

		function GetNewForm(type, place, extraid) {
			var newText = "../modules/moEditorNewT.php";
			var newBullets = "../modules/moEditorNewB.php";
			switch (type) {
				case "text":
					theScript = newText;
					break;
				case "bullets":
					theScript = newBullets;
					break;
				default:
					alert("Error!");
					return false;
			}
			theScript += "?itemplace=" + place + "&extraid=" + extraid;
			GetItem(theScript, "newform", "");
			EditorRefresh(place, extraid);
		}

		function EditorUpdate(id, typeid) {
			if (typeid == 0) {
				if (CheckNull('frmText','itemtext','Please enter the Item Text first.')) {
					return false;
				}
				var theScript = "../modules/moEditorWriteT.php";
			} else {
				var isOK = 0;
				var theField = "";
				var theLimit = document.frmText.bulletcount.value;
				for (i = 1; i < theLimit; i++) {
					theField = document.frmText["bullet" + i].value;
					theField = theField.replace(/ /g, "");
					if (theField !== "") {
						isOK = 1;
						break;
					}
				}
				if (isOK == 0) {
					alert("Please enter at least one bullet-point item.");
					document.frmText.bullet1.focus();
					return false;
				}
				var theScript = "../modules/moEditorWriteB.php";
			}
			PostItem(theScript, "frmText", "item" + id);
		}

		function CheckEditorT() {
			if (CheckNull('frmText','itemtext','Please enter the Item Text first.')) {
				return false;
			}
			var thePlace = document.frmText.itemplace.value;
			var theExtra = document.frmText.extraid.value;
			var theList = "../modules/moEditorList.php?itemplace=" + thePlace + "&extraid=" + theExtra;
			PostItem("../modules/moEditorWriteT.php", "frmText", "trashcan");
			SwapText("newform", "");
			hideMenu("newform");
			SwapText("itemlist", "");
			GetItem(theList, "itemlist", "");
			GetItem(theList, "itemlist", "");
		}

		function CheckEditorB() {
			var isOK = 0;
			var theField = "";
			for (i = 1; i < 9; i++) {
				theField = document.frmText["bullet" + i].value;
				theField = theField.replace(/ /g, "");
				if (theField !== "") {
					isOK = 1;
					break;
				}
			}
			if (isOK == 0) {
				alert("Please enter at least one bullet-point item.");
				document.frmText.bullet1.focus();
				return false;
			}
			var thePlace = document.frmText.itemplace.value;
			var theExtra = document.frmText.extraid.value;
			var theList = "../modules/moEditorList.php?itemplace=" + thePlace + "&extraid=" + theExtra;
			PostItem("../modules/moEditorWriteB.php", "frmText", "trashcan");
			SwapText("newform", "");
			hideMenu("newform");
			SwapText("itemlist", "");
			GetItem(theList, "itemlist", "");
			GetItem(theList, "itemlist", "");
		}

		function EditorRefresh(itemplace, extraid) {
			var theList = "../modules/moEditorList.php?itemplace=" + itemplace + "&extraid=" + extraid;
			GetItem(theList, "itemlist", "");
			SwapText("newform", "");
		}

		function EditorDelete(tmp) {
			if (confirm("This will permanently remove the item!")) {
				GetItem("../modules/moEditorDelete.php?id=" + tmp, "trashcan", "");
				SwapText("item" + tmp, "");
				hideMenu("item" + tmp);
			}
		}

		function EditorDoSort() {
			var numString = document.frmSort.numstring.value;
			var theNum = "";
			if (numString.indexOf(",") > 0) {
				numArray = numString.split(",");
				for (i = 0; i < numArray.length; i++) {
					theNum = document.frmSort["sort" + numArray[i]].value;
					theNum = theNum.replace(/ /g, "");
					if ((isNaN(theNum)) || (theNum == "") || (theNum < 0) || (theNum.indexOf(".") > -1)) {
						document.frmSort["sort" + numArray[i]].value = "0";
					}
				}
			} else {
				theNum = document.frmSort["sort" + numString].value;
				theNum = theNum.replace(/ /g, "");
				if ((isNaN(theNum)) || (theNum == "") || (theNum < 0) || (theNum.indexOf(".") > -1)) {
					document.frmSort["sort" + numString].value = "0";
				}
			}
			var thePlace = document.frmSort.itemplace.value;
			var theExtra = document.frmSort.extraid.value;
			var theList = "../modules/moEditorList.php?itemplace=" + thePlace + "&extraid=" + theExtra;
			PostItem("../modules/moEditorSortWrite.php", "frmSort", "trashcan");
			SwapText("itemlist", "");
			GetItem(theList, "itemlist", "");
			GetItem(theList, "itemlist", "");
		}

		function EditorGetForm(tmp) {
			GetItem("../modules/moEditorItemForm.php?id=" + tmp, "item" + tmp, "");
		}

		/* --------------------------------- MAP STUFF ----------------------------- */

		function LoadMap1() {

			// --------------------------------- MEMPHIS OFFICE

			if (GBrowserIsCompatible()) {
				var map = new GMap2(document.getElementById("map1"));
				map.setCenter(new GLatLng(35.110082,-89.867817), 12);
			        map.addControl(new GLargeMapControl());
				map.addControl(new GMapTypeControl());
			}

			var baseIcon = new GIcon();
			baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
			baseIcon.iconSize = new GSize(20, 34);
			baseIcon.shadowSize = new GSize(37, 34);
			baseIcon.iconAnchor = new GPoint(9, 34);
			baseIcon.infoWindowAnchor = new GPoint(9, 2);
			baseIcon.infoShadowAnchor = new GPoint(18, 25);

			function createMarker(point, index, tmp) {

				var letter = index;
				var letteredIcon = new GIcon(baseIcon);
				letteredIcon.image = "http://www.geocodezip.com/mapIcons/marker" + letter + ".png";

				markerOptions = { icon:letteredIcon };
				var marker = new GMarker(point, markerOptions);

				GEvent.addListener(marker, "click", function() {
					marker.openInfoWindowHtml("<p align='left'><font face='verdana' size='2'>" + tmp + "</font></p>");
				});
				return marker;
			}

			var latlng;
			var theText;

			latlng = new GLatLng(35.110082,-89.867817);
			theText = "795 Ridge Lake Boulevard<br>Memphis, TN 38120";
			map.addOverlay(createMarker(latlng, "A", theText));

		}

		function LoadMap2() {

			// ---------------------------- COLLIERVILLE OFFICE

			if (GBrowserIsCompatible()) {
				var map = new GMap2(document.getElementById("map2"));
				map.setCenter(new GLatLng(35.049013,-89.699339), 12);
			        map.addControl(new GLargeMapControl());
				map.addControl(new GMapTypeControl());
			}

			var baseIcon = new GIcon();
			baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
			baseIcon.iconSize = new GSize(20, 34);
			baseIcon.shadowSize = new GSize(37, 34);
			baseIcon.iconAnchor = new GPoint(9, 34);
			baseIcon.infoWindowAnchor = new GPoint(9, 2);
			baseIcon.infoShadowAnchor = new GPoint(18, 25);

			function createMarker(point, index, tmp) {

				var letter = index;
				var letteredIcon = new GIcon(baseIcon);
				letteredIcon.image = "http://www.geocodezip.com/mapIcons/marker" + letter + ".png";

				markerOptions = { icon:letteredIcon };
				var marker = new GMarker(point, markerOptions);

				GEvent.addListener(marker, "click", function() {
					marker.openInfoWindowHtml("<p align='left'><font face='verdana' size='2'>" + tmp + "</font></p>");
				});
				return marker;
			}

			var latlng;
			var theText;

			latlng = new GLatLng(35.049013,-89.699339);
			theText = "1100 Poplar View Lane North<br>Collierville, TN 38017";
			map.addOverlay(createMarker(latlng, "B", theText));

		}


		// ----------- POP-UP SLIDE SHOW

		function ShowPic(pic, picW, picH) {
			var maxW = document.frmHide.maxwidth.value;
			var maxH = document.frmHide.maxheight.value;
			maxW = (maxW - 0);
			maxH = (maxH - 0);
			var orient = "width";
			if (picH > picW) {
				orient = "height";
			}
			switch (orient) {
				case "width":
					if (picW > maxW) {
						picW = maxW;
					}
					var theDim = picW;
					break;
				case "height":
					if (picH > maxH) {
						picH = maxH;
					}
					var theDim = picH;
			}
			var theStuff = "<img src='" + pic + "' " + orient + "='" + theDim + "'>";
			SwapText("picbox", theStuff);
			var thisPic = Math.round(document.frmHide.thispic.value);
			var picCount = Math.round(document.frmHide.piccount.value);
			thisPic++;
			picCount++;
			var theStuff = "<span class='tableLink'>" + thisPic + " of " + picCount + "</span>";
			SwapText("nums", theStuff);
		}

		function ShowNext(tmp) {
			var thisPic = Math.round(document.frmHide.thispic.value);
			var picCount = Math.round(document.frmHide.piccount.value);
			var listString = document.frmHide.datastring.value;
			listArray = listString.split("|");
			if (tmp == "next") {
				var theNum = ((thisPic + 1) - 0);
			} else {
				var theNum = ((thisPic - 1) - 0);
			}
			if (theNum < 0) {
				theNum = picCount;
			}
			if (theNum > picCount) {
				theNum = 0;
			}
			document.frmHide.thispic.value = theNum;
			var picString = listArray[theNum];
			picArray = picString.split(",");
			ShowPic(picArray[0], picArray[1], picArray[2]);
		}



		/* ----------------------------- SCRIPT SPECIFIC --------------------------- */


		// ------------------------ SHOW DOCTOR REQUEST FORM

		function GetRequest() {
			GetItem("../modules/moDoctorRequest.php?r=" + Math.random(), "doctorrequest", "");
		}


		// --------------- TEST AND POST DOCTOR REQUEST FORM

		function DoRequest() {
			if (CheckNull('frmRequest','fname','Please enter your First Name.')) {
				return false;
			}
			if (CheckNull('frmRequest','lname','Please enter your Last Name.')) {
				return false;
			}
			if (CheckNull('frmRequest','busname','Please enter your Business Name.')) {
				return false;
			}
			if (CheckNull('frmRequest','addr','Please enter your Address.')) {
				return false;
			}
			if (CheckNull('frmRequest','city','Please enter your City.')) {
				return false;
			}
			if (CheckNull('frmRequest','state','Please select your State.')) {
				return false;
			}
			if (CheckNull('frmRequest','phone','Please enter your Phone number.')) {
				return false;
			}
			if (CheckEmail('frmRequest','email','That Email address doesn\'t look valid.')) {
				return false;
			}
			PostItem("../modules/moDoctorWrite.php", "frmRequest", "doctorrequest");
		}

	-->

