'=====================================
'
'* Name:		Ward Map App - modified from ASP to run on windows clients
'* Author:		Kevin Ball
'=====================================

Dim pFile
Dim arrLastName(500)
Dim arrFirstNames(500)
Dim arrFullName(500)
'Dim arrCity(500)
'Dim arrState(500)
Dim arrPhone(500)
Dim arrEmail(500)
Dim arrAddr1(500)
Dim arrAddr2(500)
Dim arrAddr3(500)
Dim arrAddr4(500)
Dim arrName1(500)
Dim arrName2(500)
Dim currentRecordNums

result = MsgBox ("Before running this script, you must download your ward's membership file from LDS.org.  This script will ask you to locate your ward's LDS.org membership file that you downloaded from your unit's website.  Once you select the membership csv file, the script will generate an HTML file that will display your Ward Map.  Please note: you must be connected to the Internet for this to work.", vbOKCancel+vbInformation, "Ward Map Script")

'user cancelled -- end script
If result = 2 Then
	WScript.Quit
End if

'this only works on Windows XP, so comment it out if you're not on XP...
Set objDialog = CreateObject("UserAccounts.CommonDialog")

objDialog.Filter = "Membership Files|*.csv"
objDialog.InitialDir = "C:\"
intResult = objDialog.ShowOpen
 
If intResult = 0 Then
    Wscript.Quit
Else
    pFile = objDialog.FileName
End If

'uncomment the line below if you're NOT running this on an XP system
'pFile = MaskedInput("Locate your LDS.ORG membership file", "Locate Ward's Membership File")

ShowMap(pFile)
	
'-----------------------------------------------------------------------------------
Function MaskedInput(strCaption, strMessage)
	Dim objFSO, tsHTM, objIE
	Dim strPassword

	'Create Objects
	Set objFSO = CreateObject("Scripting.FileSystemObject")
	Set objIE = WScript.CreateObject ("InternetExplorer.Application", "IE_")

	'Create User Interface
	Set tsHTM = objFSO.OpenTextFile("C:\USERPASS.HTM", 2, -2)
	tsHTM.WriteLine "<html><title>" & strCaption & "</title>"
	tsHTM.WriteLine "<body style='Font-Family:Arial; Font-Size:10pt; Background-Color:#C0C0C0'>"
	tsHTM.WriteLine "<table width='100%'><tr><td width='100%' colspan='2'>"
	tsHTM.WriteLine strMessage
	tsHTM.WriteLine "</td></tr><tr><td width='75%'>"
	tsHTM.WriteLine "<input type='file' name='membershipFile' size='35'>"
	tsHTM.WriteLine "</td><td width='*'><input type='Button' name='OKButton' value='   OK   '>"
	tsHTM.WriteLine "</td></tr></table>"
	tsHTM.WriteLine "<input type='Hidden' name='OKClicked'>"
	tsHTM.WriteLine "</body></html>"
	tsHTM.WriteLine "<SCRIPT language='VBScript'>"
	tsHTM.WriteLine "<!--"
	tsHTM.WriteLine "Sub OKButton_OnClick"
	tsHTM.WriteLine "OKClicked.Value = 1"
	tsHTM.WriteLine "End Sub"
	tsHTM.WriteLine "-->"
	tsHTM.WriteLine "</SCRIPT>"

	tsHTM.Close

	'Show Dialog
	objIE.Navigate "file:///C:\USERPASS.HTM"
	objIE.ToolBar = 0
	objIE.StatusBar = 0
	objIE.Width = 500
	objIE.Height = 200
	objIE.Left = 0
	objIE.Top = 0
	objIE.Visible = 1

	Do While (objIE.Document.All.OKClicked.Value = "")
		Wscript.Sleep 250
	Loop

	strPassword = objIE.Document.All.membershipFile.Value
	objIE.Quit

	Wscript.Sleep 250

	'Clean Up
	objFSO.DeleteFile "C:\USERPASS.HTM", True

	'Return Value
	MaskedInput = strPassword

	'Clear Memory
	Set objFSO = Nothing
	Set tsHTM = Nothing
	Set objIE = Nothing
End Function

'-----------------------------------------------------------------------------------
	
Sub ShowMap(strCaption)

	'declare our variables
	Dim tsHTM, objIE
	Dim objFSO , strURL , objFile, tmpFile, modDate
	Dim strRecord, arrRecord, maxNum
	currentRecordNum = 0
	
	'create an instance of the file system object
	Set objFSO = CreateObject("Scripting.FileSystemObject")
	
	'this is the csv file downloaded from LDS.org
	strURL = strCaption
	
	'open the file
	Set objFile = objFSO.OpenTextFile(strURL)
	Set tmpFile = objFSO.GetFile(strURL)
	'Read the modification date of the file
	modDate = tmpFile.DateCreated
	Set tmpFile = Nothing
	'For use if we ever have to deal with line breaks within a record (MIS likes to do this)
		'text = Replace(objFile.ReadAll,chr(13)&chr(10),"<br><br>")
		'strInternalBreak = "||||"
		'text = Replace(text,chr(10),strInternalBreak)
		'Response.write text
		'response.end
	
	'I don't want to see any errors at this point:
	On Error resume Next
	'while we are not at the end of the file
	Do While Not objFile.AtEndOfStream
		strRecord = objFile.readLine
		
		'Only process a line if the record starts with a quote
		If Left(strRecord,1) = chr(34) Then
			'Response.write currentRecordNum & ":" & strRecord & "<br>"
				
			'split the strText 
			arrRecord = split(strRecord, chr(34) & "," & chr(34))
			
			'find max number of people on this record
			maxNum = UBound(arrRecord)
			
			'Response.write "HI: " & currentRecordNum & "|" & arrRecord(0) & "<br>"
			
			'Replace quotation marks and single quotes appropriately - DOWNLOAD FROM LDS SITE
			arrFullName(currentRecordNum) = Replace(Trim(Replace(arrRecord(0),chr(34),"")),chr(39),"\'")		
			arrLastName(currentRecordNum) = Left(arrFullName(currentRecordNum),Instr(arrFullName(currentRecordNum),",")-1)
			arrFirstNames(currentRecordNum) = Right(arrFullName(currentRecordNum),Len(arrFullName(currentRecordNum))-(Len(arrLastName(currentRecordNum))+1))
			
			arrPhone(currentRecordNum) = Replace(Trim(Replace(arrRecord(1),chr(34),"")),chr(39),"\'")			
			arrAddr1(currentRecordNum) = Replace(Trim(Replace(arrRecord(2),chr(34),"")),chr(39),"\'")			'street
			arrAddr2(currentRecordNum) = Replace(Trim(Replace(arrRecord(3),chr(34),"")),chr(39),"\'")			'addr2
			arrAddr3(currentRecordNum) = Replace(Trim(Replace(arrRecord(4),chr(34),"")),chr(39),"\'")			'addr3
			arrAddr4(currentRecordNum) = Replace(Trim(Replace(arrRecord(5),chr(34),"")),chr(39),"\'")			'addr4
			arrName1(currentRecordNum) = Replace(Trim(Replace(arrRecord(6),chr(34),"")),chr(39),"\'")			
			
			'see if an email address is contained in a name record, if so, extract it and add it to this record's email array
			If Instr(arrName1(currentRecordNum),"@") <> 0 Then
				'get email between brackets
				startEmail = Instr(arrName1(currentRecordNum),"<")+1
				endEmail = Instr(arrName1(currentRecordNum),">")
				emailLength = endEmail - startEmail
				thisEmail = Mid(arrName1(currentRecordNum),startEmail,emailLength)
				arrEmail(currentRecordNum) = Trim(thisEmail)
			End if
			
			'grab rest of name info
			For i = 7 to maxNum
				thisStr = Replace(Trim(Replace(arrRecord(i),chr(34),"")),chr(39),"\'")
				arrName2(currentRecordNum) = arrName2(currentRecordNum) & "<br>" & thisStr
				'see if an email address is contained in a name record, if so, extract it and add it to this record's email array
				If Instr(thisStr,"@") <> 0 Then
					'get email between brackets
					startEmail = Instr(thisStr,"<")+1
					endEmail = Instr(thisStr,">")
					emailLength = endEmail - startEmail
					thisEmail = Mid(thisStr,startEmail,emailLength)
					If arrEmail(currentRecordNum) <> "" Then
						arrEmail(currentRecordNum) = arrEmail(currentRecordNum) & ", " & Trim(thisEmail)
					Else
						arrEmail(currentRecordNum) = Trim(thisEmail)
					End if
				End if
			Next
			
			
			
			currentRecordNum = currentRecordNum + 1
		End if
	Loop
	
	'close and destroy objects
	objFile.Close
	Set objFile = Nothing
	Set objFSO = Nothing

	'Create Objects
	Set objFSO = CreateObject("Scripting.FileSystemObject")
	Set objIE = WScript.CreateObject ("InternetExplorer.Application", "IE_")

	'Create User Interface
	Set tsHTM = objFSO.OpenTextFile("C:\WARDMAP.HTM", 2, -2)
	tsHTM.WriteLine "<html><head>"
	tsHTM.WriteLine "<script type=""text/javascript"" src=""http://maps.yahooapis.com/v3.5.2/fl/javascript/apiloader.js?appid=parkwayward""></script>"
	tsHTM.WriteLine "<script language=""JavaScript"">"
	tsHTM.WriteLine "function toggleControls() {"
	tsHTM.WriteLine "	if (controlsColumn.style.display == ""block"") {"
	tsHTM.WriteLine "		controlsColumn.style.display = ""none"";"
	tsHTM.WriteLine "		mapContainer.style.width = ""100%"";"
	tsHTM.WriteLine "	} else {"
	tsHTM.WriteLine "		controlsColumn.style.display = ""block"";"
	tsHTM.WriteLine "		mapContainer.style.width = ""700px"";"
	tsHTM.WriteLine "	}"
	tsHTM.WriteLine "}"
	tsHTM.WriteLine "</script>"
	tsHTM.WriteLine "<style type=""text/css"">"
	tsHTM.WriteLine "#mapContainer { "
	tsHTM.WriteLine "	height: 100%; "
	tsHTM.WriteLine "	width: 700px; "
	tsHTM.WriteLine "} "
	tsHTM.WriteLine "</style>"
	tsHTM.WriteLine "<title>Ward Map - Authorized Church Use Only [last load of map data: " & modDate & "]</title>"
	tsHTM.WriteLine "<link rel=""stylesheet"" href=""http://wardmap.theballfamily.org/mapStyle.css"" type=""text/css"" />"
	tsHTM.WriteLine "<style type=""text/css"">"
	tsHTM.WriteLine "<!--"
	tsHTM.WriteLine "td {"
	tsHTM.WriteLine "	font-family: Verdana, Arial, Helvetica, sans-serif;"
	tsHTM.WriteLine "	font-size: 12px;"
	tsHTM.WriteLine "}"
	tsHTM.WriteLine ".lightLink {"
	tsHTM.WriteLine "	font-family: Verdana, Arial, Helvetica, sans-serif;"
	tsHTM.WriteLine "	font-size: 9px;"
	tsHTM.WriteLine "	font-weight: bold;"
	tsHTM.WriteLine "	color: #FFFFFF;"
	tsHTM.WriteLine "}"
	tsHTM.WriteLine ""
	tsHTM.WriteLine "-->"
	tsHTM.WriteLine "</style>"
	tsHTM.WriteLine "<meta http-equiv=""Content-Type"" content=""text/html; charset=iso-8859-1"">"
	tsHTM.WriteLine "<style type=""text/css"">"
	tsHTM.WriteLine "<!--"
	tsHTM.WriteLine ".formItem {"
	tsHTM.WriteLine "	font-family: Geneva, Arial, Helvetica, sans-serif;"
	tsHTM.WriteLine "	font-size: 10px;"
	tsHTM.WriteLine "	border: thin double #666666;"
	tsHTM.WriteLine "}"
	tsHTM.WriteLine "-->"
	tsHTM.WriteLine "</style>"
	tsHTM.WriteLine "<style type=""text/css"">"
	tsHTM.WriteLine "<!--"
	tsHTM.WriteLine ".memTable {"
	tsHTM.WriteLine "	border: thin dashed #000000;"
	tsHTM.WriteLine "}"
	tsHTM.WriteLine "-->"
	tsHTM.WriteLine "</style>"
	tsHTM.WriteLine "</head>"
	tsHTM.WriteLine "<body bgcolor=""#000099"" onLoad=""initControls()"" leftmargin=""0"" topmargin=""0"" marginwidth=""0"" marginheight=""0"">"
	tsHTM.WriteLine "<table width=""100%"" id=""submenu"">"
	tsHTM.WriteLine "	<tr>"
	tsHTM.WriteLine "		<td width=""33%"">by Kevin Ball</td>"
	tsHTM.WriteLine "		<td align=""center""><font size=""-2"" face=""Arial, Helvetica, sans-serif""><a href=""javascript:void(0);"" onClick=""toggleControls();"" title=""click here to show/hide the controls on the left (gives more room for map viewing/printing)""><b>toggle control bar</b></a></font></td>"
	tsHTM.WriteLine "		<td width=""33%"" align=""right""><font size=""-2"" face=""Arial, Helvetica, sans-serif"">C:\WARDMAP.HTM</font></td>"
	tsHTM.WriteLine "	</tr>"
	tsHTM.WriteLine "</table>"
	tsHTM.WriteLine "<table width=""100%"" height=""96%"">"
	tsHTM.WriteLine "  <tr> "
	tsHTM.WriteLine "	<td valign=""top"" id=""controlsColumn"" name=""controlsColumn"" style=""display:block""> "
	tsHTM.WriteLine "	  <table width=""100%"" border=""0"" cellpadding=""2"" cellspacing=""0"">"
	tsHTM.WriteLine "		<tr bgcolor=""#666666""> "
	tsHTM.WriteLine "		  <td><font size=""-2"">&nbsp;&nbsp;&nbsp;<a href=""javascript:toggleControls();window.print();"" class=""lightLink"" title=""click here to print this window"" style=""color:#FFFFFF"">print&nbsp;map</a></font></td>"
	tsHTM.WriteLine "		  <td align=""right""><font size=""-2""><a href=""javascript:void(0);"" class=""lightLink"" onClick=""javascript:document.execCommand('SaveAs',true,'WardMap.htm');"" title=""click here to save this map to a file [you will still need the Internet to view the map later on]""  style=""color:#FFFFFF"">save&nbsp;map</a>&nbsp;&nbsp;&nbsp;</font></td>"
	tsHTM.WriteLine "		</tr>"
	tsHTM.WriteLine "	  </table>"
	tsHTM.WriteLine "	  <p align=""left""><strong>Ward Map</strong>: Authorized use only</p>"
	tsHTM.WriteLine "	  <font color=""#000099"" size=""""><span id=""mapStatus""></span></font> <span id=""memberTools"" style=""display=none""> "
	tsHTM.WriteLine "	  <form method=""post"" name=""frmMemberList"" id=""frmMemberList"">"
	tsHTM.WriteLine "		<strong>Find a member:</strong> "
	tsHTM.WriteLine "		<select name=""memberList"" class=""formItem"" id=""memberList"" onChange=""fillMemberInfo();"">"
	tsHTM.WriteLine "		</select>"
	tsHTM.WriteLine "		<br>"
	tsHTM.WriteLine "		<table width=""100%"" border=""0"" cellpadding=""1"" cellspacing=""1"" bgcolor=""#FFFFFF"" class=""memTable"">"
	tsHTM.WriteLine "		  <tr> "
	tsHTM.WriteLine "			<td width=""1""><div align=""right""><strong><font size=""-2"">phone:</font></strong></div></td>"
	tsHTM.WriteLine "			<td><font size=""-2""><span id=""memPhone"" name=""memPhone""></span></font></td>"
	tsHTM.WriteLine "		  </tr>"
	tsHTM.WriteLine "		  <tr> "
	tsHTM.WriteLine "			<td width=""1""><div align=""right""><strong><font size=""-2"">email:</font></strong></div></td>"
	tsHTM.WriteLine "			<td><font size=""-2""><span id=""memEmail"" name=""memEmail""></span></font></td>"
	tsHTM.WriteLine "		  </tr>"
	tsHTM.WriteLine "		  <tr> "
	tsHTM.WriteLine "			<td width=""1""><div align=""right""><strong><font size=""-2"">address:</font></strong></div></td>"
	tsHTM.WriteLine "			<td><font size=""-2""><span id=""memAddress"" name=""memAddress""></span></font></td>"
	tsHTM.WriteLine "		  </tr>"
	tsHTM.WriteLine "		</table>"
	tsHTM.WriteLine "	  </form>"
	tsHTM.WriteLine "	  <hr>"
	tsHTM.WriteLine "	  </span> <div id=""standardPage""> <font size=""-2""><strong>Note:</strong></font> "
	tsHTM.WriteLine "		<ul>"
	tsHTM.WriteLine "		  <li><font size=""-2"" color=""#0000FF""><strong>This is a dynamic map! Click "
	tsHTM.WriteLine "			and drag it to move around and see all the markers!</strong></font></li>"
	tsHTM.WriteLine "		  <li><font size=""-2""><strong>It takes a minute or two for the various "
	tsHTM.WriteLine "			servers involved to get all of the members on the map, so please be "
	tsHTM.WriteLine "			patient.</strong></font></li>"
	tsHTM.WriteLine "		  <li><font size=""-2"">You must be connected to the Internet to use the "
	tsHTM.WriteLine "			map.</font></li>"
	tsHTM.WriteLine "		  <li><font size=""-2"">You must have <a href=""http://www.macromedia.com/go/getflashplayer"" target=""_blank"">Flash</a> "
	tsHTM.WriteLine "			installed to view the map.</font></li>"
	tsHTM.WriteLine "		  <li><font size=""-2"">If a house does not show up, it is possible that "
	tsHTM.WriteLine "			the address in the MIS is incorrect or that Yahoo does not yet have "
	tsHTM.WriteLine "			the street in its database.</font> </li>"
	tsHTM.WriteLine "		  <li><font size=""-2"">Press F11 to view in FullScreen (IE)</font></li>"
	tsHTM.WriteLine "		</ul>"
	tsHTM.WriteLine "	  </div></td>"
	tsHTM.WriteLine "	<td width=""1"" bgcolor=""#0d324f"" id=""""><a href=""javascript:void(0);"" onClick=""toggleControls();"" title=""click here to show/hide the controls on the left (gives more room for map viewing/printing)"" style=""color:#ffffff;decoration:none"">"
	tsHTM.WriteLine "	<strong>&gt;<br />"
	tsHTM.WriteLine "	  &lt;</strong></a> </td>"
	tsHTM.WriteLine "	<td> <div id=""mapContainer"" name=""mapContainer""></div></td>"
	tsHTM.WriteLine "  </tr>"
	tsHTM.WriteLine "</table>"

	pMapCenterAddress = arrAddr1(0) & ", " & arrAddr2(0) & ", " 
	If arrAddr3(0)<>"Tx" Then 
		pMapCenterAddress = pMapCenterAddress & arrAddr3(0)
	End if
	pMapCenterAddress = pMapCenterAddress & arrAddr4(0)

	tsHTM.WriteLine "<script type=""text/javascript"">"
	tsHTM.WriteLine "	// Create and display Map object at the address and with zoom level 3 "
	tsHTM.WriteLine "	// Include your application ID."
	tsHTM.WriteLine "	var map = new Map(""mapContainer"", ""parkwayward"", """ & pMapCenterAddress & """, 3); "
	tsHTM.WriteLine "	// Make the map draggable "
	tsHTM.WriteLine "	map.addTool( new PanTool(), true );"
	tsHTM.WriteLine "	// Create a Navigator Widget object"
	tsHTM.WriteLine "	navWidget = new NavigatorWidget(); "
	tsHTM.WriteLine "	// Add the Navigator Widget to the map and display it"
	tsHTM.WriteLine "	map.addWidget(navWidget); "
	tsHTM.WriteLine "	"
	tsHTM.WriteLine "	map.addWidget(new SatelliteControlWidget());"
	tsHTM.WriteLine "	//Make the map listen for new markers"
	tsHTM.WriteLine "	map.addEventListener(Map.EVENT_MARKER_GEOCODE_SUCCESS,increaseCounter);"
	tsHTM.WriteLine "	map.addEventListener(Map.EVENT_MARKER_GEOCODE_ERROR,increaseCounter);"
	tsHTM.WriteLine "	"
	tsHTM.WriteLine "	var thisMarkerCount = 0;"
	tsHTM.WriteLine "	var strWAIT = ""When member load is complete, map functionality will appear here...<br><br>"""
	tsHTM.WriteLine "	function increaseCounter( oEvent ) {"
	tsHTM.WriteLine "		thisMarkerCount += 1;"
	tsHTM.WriteLine "		thisPercent = Math.round((thisMarkerCount/" & currentRecordNum & ")*100)"
	tsHTM.WriteLine "		mapStatus.innerHTML = ""Loading Member Markers: <b>"" + thisPercent + ""%</b><br><br>"" + strWAIT;"
	tsHTM.WriteLine "		"
	tsHTM.WriteLine "		if (thisPercent >= 50) {"
	tsHTM.WriteLine "			mapStatus.style.display = ""none"";"
	tsHTM.WriteLine "			memberTools.style.display = ""block"";	"
	tsHTM.WriteLine "		}"
	tsHTM.WriteLine "	}"
	tsHTM.WriteLine ""
	
	'write out the markers
	For x=0 to (currentRecordNum-1)
		tsHTM.WriteLine "// Create a POI marker object"
		tsHTM.WriteLine "	marker" & (x+1) & " = new CustomPOIMarker( """ & arrLastName(x) & """, "", " & arrFirstNames(x) & """, """ & showDetails(x) & """, ""0x000099"",     ""0xFFFFFF"" );"
		tsHTM.WriteLine "	// Add the POI marker to the map and display it          "
		tsHTM.WriteLine "	map.addMarkerByAddress( marker" & (x+1) & ", """ & arrAddr1(x) & ", " & arrAddr2(x) & " " & arrAddr3(x) & " " & arrAddr4(x) & """); "
	Next
	
	tsHTM.WriteLine "	"
	tsHTM.WriteLine "function callLocation(pLoc) {"
	tsHTM.WriteLine "	map.setCenterByAddress(pLoc,2000);	//2 seconds to pan"
	tsHTM.WriteLine "}"
	tsHTM.WriteLine "	"
	tsHTM.WriteLine "	"
	tsHTM.WriteLine "/* populates the form with any stored data and sets it up for easy search */ "
	tsHTM.WriteLine "function initControls() { "
	tsHTM.WriteLine "		populateMemberList(); "
	tsHTM.WriteLine "} "
	tsHTM.WriteLine ""
	tsHTM.WriteLine "/* populates the type of MemberList dropdown */ "
	tsHTM.WriteLine "var arrEmail = new Array(); "
	tsHTM.WriteLine "var arrPhone = new Array(); "
	tsHTM.WriteLine "var arrStreet = new Array(); "
	tsHTM.WriteLine "var arrCity = new Array(); "
	tsHTM.WriteLine "var arrState = new Array(); "
	tsHTM.WriteLine ""
	tsHTM.WriteLine "function populateMemberList() { "
	tsHTM.WriteLine ""
	
	For p=0 to (currentRecordNum-1)
		tsHTM.WriteLine "	document.frmMemberList.memberList[" & (p+1) & "] = new Option(""" & arrLastName(p) & """ + "", " & arrFirstNames(p) & """,""" & (p+1) & """); "
		tsHTM.WriteLine "	arrEmail[" & (p+1) & "] = """ & arrEmail(p) & """;arrPhone[" & (p+1) & "] = """ & arrPhone(p) & """;arrStreet[" & (p+1) & "] = """ & arrAddr1(p) & """;arrCity[" & (p+1) & "] = """ & arrAddr2(p) & """;arrState[" & (p+1) & "] = """ & arrAddr3(p) & """;"
	Next
	
	tsHTM.WriteLine "} "
	tsHTM.WriteLine ""
	tsHTM.WriteLine "//populates the Member Info div based on MemberList listbox selection - call when selection made on list "
	tsHTM.WriteLine "function fillMemberInfo() { "
	tsHTM.WriteLine "	pID = document.frmMemberList.memberList.options[document.frmMemberList.memberList.selectedIndex].value;"
	tsHTM.WriteLine "	//document.frmMemberList.memberList.options.length = 0; //clear the list box "
	tsHTM.WriteLine "	//alert(arrPhone[pID]);"
	tsHTM.WriteLine "	memPhone.innerHTML = eval(""arrPhone["" + pID + ""]"");"
	tsHTM.WriteLine "	memEmail.innerHTML = ""<a href='mailto:"" + eval(""arrEmail["" + pID + ""]"") + ""'>"" + eval(""arrEmail["" + pID + ""]"") + ""</a>"";"
	tsHTM.WriteLine "	"
	tsHTM.WriteLine "	thisAddress = eval(""arrStreet["" + pID + ""]"") + "" "" + eval(""arrCity["" + pID + ""]"") + "" "" + eval(""arrState["" + pID + ""]"");"
	tsHTM.WriteLine "	memAddress.innerHTML = thisAddress"
	tsHTM.WriteLine "	"
	tsHTM.WriteLine "	//highlight them on the map and pan to their location"
	tsHTM.WriteLine "	eval(""marker"" + pID + "".open()"");"
	tsHTM.WriteLine "	callLocation(thisAddress);"
	tsHTM.WriteLine "}"
	tsHTM.WriteLine ""
	tsHTM.WriteLine "</script>"
	tsHTM.WriteLine "</body>"
	tsHTM.WriteLine "</html> "
	tsHTM.Close

	'Show Dialog
	strComputer = "."
	Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
	Set colItems = objWMIService.ExecQuery _
    ("Select * From Win32_DisplayConfiguration")

	objIE.Navigate "file:///C:\WARDMAP.HTM"
	objIE.ToolBar = 0
	objIE.StatusBar = 1
	For each objItem in colItems
		objIE.Width = objItem.PelsWidth
		objIE.Height = objItem.PelsHeight
	Next
	objIE.Left = 0
	objIE.Top = 0
	objIE.Visible = 1
	
	set objWMIService = Nothing
	set colItems = Nothing
	
	Wscript.Sleep 250

	'Clean Up
	'objFSO.DeleteFile "C:\WARDMAP.HTM", True

	'Clear Memory
	Set objFSO = Nothing
	Set tsHTM = Nothing
	Set objIE = Nothing
End Sub

Public Function showDetails(pNum)
	strReturn = ""
	If Trim(arrAddr1(pNum)) <> "" Then
		strReturn = strReturn & Trim(arrAddr1(pNum)) & " "
	End if
	If Trim(arrAddr2(pNum)) <> "" Then
		strReturn = strReturn & Trim(arrAddr2(pNum)) & " " 
	End if
	If Trim(arrAddr3(pNum)) <> "" Then
		strReturn = strReturn & Trim(arrAddr3(pNum)) & " "
	End if
	If Trim(arrAddr4(pNum)) <> "" Then
		strReturn = strReturn & Trim(arrAddr4(pNum))
	End if
	
	strReturn = Trim(strReturn)
	
	If Trim(arrPhone(pNum)) <> "" Then
		strReturn = strReturn & "<br>" & arrPhone(pNum)
	End if
	
	If Trim(arrName1(pNum)) <> "" Then
		strReturn = strReturn & "<br>" & arrName1(pNum)
	End if
	
	If Trim(arrName2(pNum)) <> "" Then
		strReturn = strReturn & arrName2(pNum)
	End if
	
	showDetails = strReturn

End Function

