<%
'Response.Write "Will be here soon! <A HREF=""javascript:history.back()"">Click here to Return</a>"
'Response.End

'  If Not Request.QueryString("ID") = "" Then Session("Group_ID") = Request.QueryString("ID")

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open Application("conn_string")

Dim Page
Page="contact"

'post stuff

 If UCase(Request.ServerVariables("REQUEST_METHOD")) = "POST" And Request("page") = Page Then

	Contact_ID = Replace(Request("Contact_ID"), "'", "''")
	
	If Not Trim(Request("Name_First")) = "" And Not Trim(Request("Name_Last")) = "" Then
		Dim SQL1
		Dim Conn
		Dim RS1

		Set RS1 = Server.CreateObject("ADODB.Recordset")

		SQL1 = "[Update_Contact] "

		If Trim(Contact_ID) = "" Then
			SQL1 = SQL1 & "@Contact_ID = Null,"
		Else
			SQL1 = SQL1 & "@Contact_ID = " & Contact_ID & ","
		End If
	
		SQL1 = SQL1 & " @Name_Prefix='" & Request.Form("Name_Prefix") & "',"
		SQL1 = SQL1 & " @Name_First='" & Request.Form("Name_First") & "',"
		SQL1 = SQL1 & " @Name_Pref='" & Request.Form("Name_Pref") & "',"
		SQL1 = SQL1 & " @Name_MI='" & Request.Form("Name_MI") & "',"
		SQL1 = SQL1 & " @Name_Last='" & Request.Form("Name_Last") & "',"
		SQL1 = SQL1 & " @Name_Suffix='" & Request.Form("Name_Suffix") & "'," 
		SQL1 = SQL1 & " @Gender='" & Request.Form("Gender") & "',"
		SQL1 = SQL1 & " @DOB='" & Request.Form("DOB") & "',"
		SQL1 = SQL1 & " @Title='" & Request.Form("Title") & "',"
		SQL1 = SQL1 & " @Address_1='" & Request.Form("Address_1") & "',"
		SQL1 = SQL1 & " @Address_2='" & Request.Form("Address_2") & "',"
		SQL1 = SQL1 & " @City='" & Request.Form("City") & "',"
		SQL1 = SQL1 & " @State='" & Request.Form("State") & "',"
		SQL1 = SQL1 & " @Country='" & Request.Form("Country") & "',"
		SQL1 = SQL1 & " @Zip='" & Request.Form("ZIP") & "',"
		SQL1 = SQL1 & " @Zip_4='" & Request.Form("ZIP_4") & "',"
		SQL1 = SQL1 & " @Latitude='" & Request.Form("Latitude") & "'," 
		SQL1 = SQL1 & " @Longitude='" & Request.Form("Longitude") & "',"
		SQL1 = SQL1 & " @Phone_CountryCode='" & Request.Form("Phone_CountryCode") & "',"
		SQL1 = SQL1 & " @Phone_HM_AreaCode='" & Request.Form("Phone_HM_AreaCode") & "',"
		SQL1 = SQL1 & " @Phone_HM='" & Request.Form("Phone_HM") & "',"
		SQL1 = SQL1 & " @Phone_WK_AreaCode='" & Request.Form("Phone_WK_AreaCode") & "',"
		SQL1 = SQL1 & " @Phone_WK='" & Request.Form("Phone_WK") & "',"
		SQL1 = SQL1 & " @Phone_WK_Ext='" & Request.Form("Phone_WK_Ext") & "'," 
		SQL1 = SQL1 & " @Mobile_AreaCode='" & Request.Form("Mobile_AreaCode") & "',"
		SQL1 = SQL1 & " @Mobile='" & Request.Form("Mobile") & "',"
		SQL1 = SQL1 & " @Pager_AreaCode='" & Request.Form("Pager_AreaCode") & "',"
		SQL1 = SQL1 & " @Pager='" & Request.Form("Pager") & "',"
		SQL1 = SQL1 & " @Fax_WK_AreaCode='" & Request.Form("Fax_WK_AreaCode") & "',"
		SQL1 = SQL1 & " @Fax_WK='" & Request.Form("Fax_WK") & "',"
		SQL1 = SQL1 & " @Fax_HM_AreaCode='" & Request.Form("Fax_HM_AreaCode") & "',"
		SQL1 = SQL1 & " @Fax_HM='" & Request.Form("Fax_HM") & "',"
		SQL1 = SQL1 & " @Web='" & Request.Form("Web") & "',"
		SQL1 = SQL1 & " @EMail_Home='" & Request.Form("EMail_Home") & "',"
		SQL1 = SQL1 & " @EMail_Work='" & Request.Form("EMail_Work") & "',"
		SQL1 = SQL1 & " @EMail_Other='" & Request.Form("EMail_Other") & "'" 
		Response.Write SQL1
		Set RS1 = Conn.Execute(SQL1)

		Contact_ID = RS1("Contact_ID")

		If isNull(Contact_ID) Then
			Response.Write "Error creating user. Please try again. If this does not work, please notify support@emagineering.com. Thanks!<br>"
			Response.Write "<a href=""javascript:history.back()"">Click here to return</a><br>"
			Response.End
		Else	
			
			For each Group_ID in Request("Existing_Groups")
				If Not Group_ID = "" Then
					For each Contact_Type_ID in Request("Existing_Contact_Type_ID_" & Group_ID)
						SQL1 = "Delete_Group_Contact_Map @Contact_ID='" & Contact_ID & "', @Group_ID='" & Group_ID & "', @Contact_Type_ID='" & Contact_Type_ID & "'"
						Conn.Execute(SQL1)
						SQL1 = "Add_Group_Contact_Map @Contact_ID='" & Contact_ID & "', @Group_ID='" & Group_ID & "', @Contact_Type_ID='" & Contact_Type_ID & "'"
						Conn.Execute(SQL1)
					Next
				End If
			Next
			
			For each Group_ID in Request("Groups")
				If Not Group_ID = "" Then
					
					SQL1 = "Delete_Group_Contact_Map @Contact_ID='" & Contact_ID & "', @Group_ID='" & Group_ID & "'"
					Conn.Execute(SQL1)
					Found = False
					
					For each Contact_Type_ID in Request("Contact_Type_ID_" & Group_ID)
						SQL1 = "Add_Group_Contact_Map @Contact_ID='" & Contact_ID & "', @Group_ID='" & Group_ID & "', @Contact_Type_ID='" & Contact_Type_ID & "'"
						Conn.Execute(SQL1)
						Found = True
					Next
					
					If Found = False Then
						SQL1 = "Add_Group_Contact_Map @Contact_ID='" & Contact_ID & "', @Group_ID='" & Group_ID & "', @Contact_Type_ID='1'"
						Conn.Execute(SQL1)
					End If

				End If
			Next

		End If	

	Set RS1 = Nothing
	Set Conn = Nothing

	End If
	
	'If Request.Form("createuser") = "True" And Not Contact_ID = "" Then
	If Request.Form("createuser") = "True" Then
		Response.Redirect "user_admin.asp?CID=" & Contact_ID & "&GID=" & Request("Group_ID")
	Else
		Response.Redirect "contacts_admin.asp"
	End If

End If
' end of post stuff

'edit stuff

If Not Request("CID") = "" Then 
	Contact_ID = Request("CID")
	Edit = True
End If

If Not Request("CTID") = "" Then 
	Contact_Type_ID = Request("CTID")
End If

If Not Request("GID") = "" Then 
	Group_ID = Request("GID")
End If

Function Get_Titles_DD (Title_ID, Title_Val)
   SQL	=	"Get_Titles @Title_ID='" & Title_ID & "'"
   HTML =	""
   Title_Value = Title_Val
   Set Title = Conn.Execute(SQL)
   Do While Not Title.EOF
		Title_Desc = Title("Title")
		HTML = HTML & "<option value=""" & Title_Desc & """"
		If LCase(Title_Desc) = LCase(Title_Value) Then HTML = HTML & " selected"
		HTML = HTML & ">" & Title_Desc & "</option>"
		Title.MoveNext
	Loop
   Set Title = Nothing
   Get_Titles_DD = HTML
End Function

SQLGrp = "Get_Entity_From_Group @Group_ID='" & Group_ID & "'"
Set Group = Conn.Execute(SQLGrp)

If Edit = True Then
	SQL = "Get_Contact @Contact_ID='" & Contact_ID & "'"
	Set RSContact = Conn.Execute(SQL)

	Name_Prefix = RSContact("Name_Prefix")
	Name_First = RSContact("Name_First")
	Name_Pref = RSContact("Name_Pref")
	Name_MI = RSContact("Name_MI")
	Name_Last = RSContact("Name_Last")
	Name_Suffix = RSContact("Name_Suffix")
	Title = RSContact("Title")
	DOB = RSContact("DOB")
	Gender = RSContact("Gender")
	Address_1 = RSContact("Address_1")
	Address_2 = RSContact("Address_2")
	City = RSContact("City")
	State = RSContact("State")
	Zip = RSContact("Zip")
	Zip_4 = RSContact("Zip_4")
	Country = RSContact("Country")
	Phone_HM_Areacode = RSContact("Phone_HM_Areacode")
	Phone_HM = RSContact("Phone_HM")
	Pager_AreaCode = RSContact("Pager_AreaCode")
	Pager = RSContact("Pager")
	Mobile_AreaCode = RSContact("Mobile_AreaCode")
	Mobile = RSContact("Mobile")
	Fax_WK_AreaCode = RSContact("Fax_WK_AreaCode")
	Fax_WK = RSContact("Fax_WK")
	Phone_WK_Areacode = RSContact("Phone_WK_Areacode")
	Phone_WK = RSContact("Phone_WK")
	Phone_WK_Ext = RSContact("Phone_WK_Ext")
	Web = RSContact("Web")
	EMail_Home = RSContact("EMail_Home")
	EMail_Work = RSContact("EMail_Work")
	EMail_Other = RSContact("EMail_Other")

End if


%>


<html>
<STYLE>
BODY {SCROLLBAR-FACE-COLOR: #5e5ebe; SCROLLBAR-HIGHLIGHT-COLOR: #5e5ebe; SCROLLBAR-SHADOW-COLOR: #5e5ebe; SCROLLBAR-3DLIGHT-COLOR: #5e5ebe; SCROLLBAR-ARROW-COLOR:  #6666CC; SCROLLBAR-TRACK-COLOR: #E3E3E3; SCROLLBAR-DARKSHADOW-COLOR: #666666; }
</STYLE>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="/Style-sheets/input-form-small.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/headline.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/page-formatting.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/standard-input-form.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/headline-large.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/emagineering.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/galley-text-indent.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/Lodging-display.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/Profile-layout.css" type="text/css">

<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function SubmitForm() {
var errmsg='';

//if (form1.Name_First.value=='' && form1.Name_Last.value == '') {
   // do nothing
//} else {
	if (form1.Name_First.value=='') errmsg=errmsg+'Must Specify a First Name\n';
	if (form1.Name_Last.value=='') errmsg=errmsg+'Must Specify a Last Name\n';
//	if (form1.Address_1.value=='') errmsg=errmsg+'Must Specify An Address\n';
//	if (form1.City.value=='') errmsg=errmsg+'Must Specify a City\n';
//	if (form1.State.value=='') errmsg=errmsg+'Must Specify a State\n';
//	if (form1.Country.value=='') errmsg=errmsg+'Must Specify a Country\n';
//	if (form1.Zip.value=='') errmsg=errmsg+'Must Specify a Zip Code\n';
//	if (form1.Email_Home.value=='' && form1.Email_Work.value=='' && form1.Email_Other.value=='') errmsg=errmsg+'Must Specify At Least One Email Address\n';
//}

if (errmsg) alert(errmsg);
else form1.submit();
}

function showuser() {
  ns4 = (document.layers) ? true:false 
  ie4 = (document.all) ? true:false 
  ng5 = (document.getElementById) ? true:false 

  if (document.form1.createuser.checked) {
	if (ng5) {
		document.getElementById("buttondiv").style.top = "585px"; 
		document.getElementById("userdiv").style.visibility = "visible"; 
	} else if (ns4) {
		document.layers["buttondiv"].top = "585px"; 
		document.layers["userdiv"].visibility = "show"; 
	} else if (ie4) {
		document.all["buttondiv"].style.top = "585px"; 
		document.all["userdiv"].style.visibility = "visible"; 
	}

  } else {

  	if (ng5) {
		document.getElementById('userdiv').style.visibility = "hidden"
		document.getElementById("buttondiv").style.top = "495px"; 
  	} else if (ns4) {
		document.userdiv.visibility = "hide"
		document.layers["buttondiv"].top = "495px";
  	} else if (ie4) {
		layer.userdiv.visibility = "hidden"
		document.all["buttondiv"].style.top = "495px"; 
	}
  }
}

//-->
</SCRIPT>

</head>

<body bgcolor="#ffffff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<FORM action="contact_edit.asp" method=post id=form1 name=form1>
<input type="hidden" name="page" value="<%=Page%>">
<input type="hidden" name="Contact_ID" value="<%=Contact_ID%>">
<input type="hidden" name="Contact_Type_ID" value="<%=Contact_Type_ID%>">
<input type="hidden" name="Group_ID" value="<%=Group_ID%>">
<Br>  
<table border="0" cellspacing="0" cellpadding="0" width="590" style="WIDTH: 590px; HEIGHT: 489px" align="center">
    <tr> 
    <td colspan="6" align="left" bgcolor="#6699cc"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>&nbsp;&nbsp;&nbsp;&nbsp;Edit a Contact
      </b></font><font color="#ffffff" size="2"></td>
  </tr>
  <tr bgcolor="#cccccc"> 
    <td align="right" rowspan="1" width="99" bgcolor="#cccccc"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#000099">Contact Info:</font></b></font></td>
    <td align="right" width="1" bgcolor="#ffffff">&nbsp;</td>
      <td colspan="4"><table border="0" cellspacing="0" cellpadding="0" width="100%">
		<tr>
			<td width="160"></td>
			<td width="40"></td>
			<td width="58"></td>
			<td width="138"></td>
			<td width="67"></td>
		<tr bgcolor="#cccccc"> 
		    <td align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#000099">First 
		      Name:</font></b>&nbsp;&nbsp;&nbsp;</font></td>
		    <td align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#000099">Preferred:</font></b></font></td>
		    <td align="center" width="58"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>&nbsp;&nbsp;&nbsp;M.I.</b></font></td>
		    <td align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Last 
		      Name:</b></font></td>
		    <td><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Jr, 
		      Sr </b></font></td>
		</tr>
		<tr>
			<td align="center"> <font size="1"><b><SELECT name="Name_Prefix"> 
				<OPTION value="" <% If Name_Prefix = "" Then Response.Write "selected" %>>Role</OPTION>
				<OPTION value="Mr." <% If Name_Prefix = "Mr." Then Response.Write "selected" %>>Mr.</OPTION>
				<OPTION value="Ms." <% If Name_Prefix = "Ms." Then Response.Write "selected" %>>Ms.</OPTION> 
				<OPTION value="Mrs."<% If Name_Prefix = "Mrs." Then Response.Write "selected" %>>Mrs.</OPTION> 
				<OPTION value="Dr." <% If Name_Prefix = "Dr." Then Response.Write "selected" %>>Dr.</OPTION></SELECT> 
				<input name="Name_First" size="10" value="<%=Name_First%>">
			</b></font></td>
			<td align="center"><font size="1"><b> </b></font><font size="1"><b> 
				<input name="Name_Pref" size="10" value="<%=Name_Pref%>">
			</b></font></td>
			<td align="center"><font size="1"><b> </b></font><font size="1"><b> 
			  <input name="Name_MI" size="2" value="<%=Name_MI%>">
			</b></font></td>
			<td align="center"> <font size="1"><b> </b></font><font face="Verdana, Arial, Helvetica, sans-serif" size="1"></font><font size="1"><b> 
			  <input name="Name_Last" size="15"  value="<%=Name_Last%>">
			</b></font></td>
			<td><font size="1"><b> 
			  <input name="Name_Suffix" size="2"  value="<%=Name_Suffix%>">
			</b></font></td>
		</tr>
		<tr><td>&nbsp;</td></tr>
		<tr bgcolor="#cccccc">
    		<td colspan="2" bgcolor="#cccccc" align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Title:</b></font></td>
			<td align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>D.O.B.:</b></font></td>
			<td colspan="2">&nbsp;</td>
		</tr>
		<tr bgcolor="#cccccc"> 
			<td colspan="2" bgcolor="#cccccc" align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="1">
				<SELECT id="Title" name="Title">
					<%=Get_Titles_DD("%", Title)%>
				</SELECT>&nbsp; 
			</font></td>
			<td align="center" width="58"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b><input name="DOB" size="8" value="" value="<%=DOB%>"></b></font></td>
			<td colspan="2"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b> 
				<input type="radio" name="Gender" value="Male" <% If LCase(Gender) = "male" Then Response.Write "selected"%>>
				Male 
				<input type="radio" name="Gender" value="Female" <% If LCase(Gender) = "female" Then Response.Write "selected"%>>
				Female </b>
			</font></td>
		</tr>
	  </table>
	</td>
  </tr>
  <tr> 
    <td colspan="6"><font color="#000099"><IMG height=3 src="../images/shim.gif" width=1></font></td>
  </tr>
  <tr> 
      <td align="right" width="99" bgcolor="#cccccc"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Address 
        Info:</b></font></td>
    <td align="right" width="1" bgcolor="#ffffff">&nbsp;</td>
    <td colspan="4" bgcolor="#cccccc"> 
      <table width="100%" border="0" cellspacing="1" cellpadding="0">
        <tr> 
          <td width="23%" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Address 
            1:</b></font></td>
          <td width="26%"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"> 
            <input name="Address_1" value="<%=Address_1%>">
            </font></td>
          <td width="24%">&nbsp;</td>
          <td width="28%">&nbsp;</td>
        </tr>
        <tr> 
          <td width="23%" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Address 
            2:</b></font></td>
          <td width="26%"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"> 
            <input name="Address_2" value="<%=Address_2%>">
            </font></td>
          <td width="24%" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#000099">City:</font></b></font></td>
          <td width="28%"><font size="1"> 
            <input name="City" size="15" value="<%=City%>">
            </font></td>
        </tr>
        <tr> 
          <td width="23%" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Postal 
            Code:</b></font></td>
          <td width="26%"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b> 
            <input name="Zip" size="5" maxlength="5" value="<%=Zip%>">&nbsp;<FONT color=#000099>-</FONT> 
            <input name="Zip_4" size="4" maxlength="4" value="<%=Zip_4%>"></b></font><font size="1"></font></td>
          <td width="24%" align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"> 
            <select name="State">
              <option value="">State</option>

<%

 Set Conn = Server.CreateObject("ADODB.Connection")
 Conn.Open "DRIVER={SQL Server};SERVER=WEBSRV01;UID=web;pwd=w3bs1t3;DATABASE=AVANTE"

 Set RS2 = Server.CreateObject("ADODB.Recordset")
 SQL2 = "Select * from [States] S Join [Countries] C On S.[Country_ID] = C.[Country_ID] Where Not C.[Country_Name] = 'NA'"
 RS2.Open SQL2, Conn

 If NOT RS2.EOF Then
   While Not RS2.EOF

%>
<option value="<%= RS2.Fields("State_Abbr") %>" <% If LCase(RS2.Fields("State_Abbr")) = LCase(State) Then Response.Write " selected" %>><%= RS2.Fields("State_Abbr") %></option>
<%

   RS2.MoveNext 
   Wend
 End If

 RS2.Close
 Set RS2 = Nothing

%>

           </select>
            </font></td>
          <td width="28%"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b> 
            <select name="Country">
              <option value="">Country</option>
<%

 Set Conn = Server.CreateObject("ADODB.Connection")
 Conn.Open "DRIVER={SQL Server};SERVER=WEBSRV01;UID=web;pwd=w3bs1t3;DATABASE=AVANTE"

 Set RS2 = Server.CreateObject("ADODB.Recordset")
 SQL2 = "Select * from [Countries] C Where Not C.[Country_Abbr] = 'NA'"
 RS2.Open SQL2, Conn

 If NOT RS2.EOF Then
   While Not RS2.EOF

%>
<option value="<%= RS2.Fields("Country_Abbr") %>" <% If LCase(RS2.Fields("Country_Abbr")) = LCase(Country) Then Response.Write " selected" %>><%= RS2.Fields("Country_Name") %></option>
<%

   RS2.MoveNext 
   Wend
 End If

 RS2.Close
 Set RS2 = Nothing

%>            </select>
            </b></font></td>
        </tr>
      </table>
    </td>
  </tr>

  <tr> 
    <td colspan="6"><font color="#000099"><IMG height=3 src="../images/shim.gif" width=1></font></td>
  </tr>
  <tr> 
      <td align="right" width="99" bgcolor="#cccccc"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000099"><b><font size="1">Phone 
        Contacts:</font></b></font></td>
      <td align="right" width="1" bgcolor="#ffffff">&nbsp;</td>
      <td colspan="4" bgcolor="#cccccc"> 
        <table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#cccccc">
          <tr> 
            <td width="22%" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Home 
              Phone:</b></font></td>
            <td width="27%"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"> 
              <input name="Phone_HM_AreaCode" size="3" value="<%=Phone_HM_AreaCode%>">
              <input name="Phone_HM" size="8" value="<%=Phone_HM%>">
              </font></td>
            <td width="23%" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Pager:</b></font></td>
            <td width="28%"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"> 
              <input name="Pager_Areacode" size="3" value="<%=Pager_AreaCode%>">
              <input name="Pager" size="8"  value="<%=Pager%>">
              </font></td>
          </tr>
          <tr> 
            <td width="22%" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Mobile Phone:</b></font></td>
            <td width="27%"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"> 
              <input name="Mobile_AreaCode" size="3" value="<%=Mobile_AreaCode%>">
              <input name="Mobile" size="8" value="<%=Mobile%>">
              </font></td>
            <td width="23%" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Work 
              Fax:</b></font></td>
            <td width="28%"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"> 
              <input name="Fax_WK_AreaCode" size="3" value="<%=Fax_WK_AreaCode%>">
              <input name="Fax_WK" size="8" value="<%=Fax_WK%>">
              </font></td>
          </tr>
          <tr> 
            <td width="22%" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Work 
              Phone:</b></font></td>
            <td width="27%"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"> 
              <input name="Phone_WK_AreaCode" size="3" value="<%=Phone_WK_AreaCode%>">
              <input name="Phone_WK" size="8" value="<%=Phone_WK%>">
              </font></td>
            <td width="23%" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#000099">Work 
              Ext.</font></b></font></td>
            <td width="28%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="1"> 
              <input type="text" name="Phone_WK_Ext" size="4" value="<%=Phone_WK_Ext%>">
              </font></td></tr>
        </table>
    </td>
  </tr>
  <tr> 
      <td colspan="6" align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b><IMG height=3 src="../images/shim.gif" width=1></b></font></td>
  </tr>
  <tr> 
      <td align="right" width="99" bgcolor="#cccccc"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Web 
        Info: </b></font></td>
      <td align="right" width="1" bgcolor="#ffffff">&nbsp;</td>
      <td colspan="4" bgcolor="#cccccc"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b> 
        </b></font><font face="Verdana, Arial, Helvetica, sans-serif" size="1"></font><font face="Verdana, Arial, Helvetica, sans-serif" size="1"></font><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b></b></font> 
        <table width="100%" border="0" cellspacing="1" cellpadding="0" bordercolorlight="#ffffff" bordercolor="#ffffff">
        <tr valign="center"> 
          <td width="22%" align="right"><font size="1" color="#000099"><b><font face="Verdana, Arial, Helvetica, sans-serif">E-mail:</font></b></font></td>
          <td width="28%"><font size="1" color="#000099"><b><font face="Verdana, Arial, Helvetica, sans-serif"> 
            </font><font size="1" color="#000099"><font face="Verdana, Arial, Helvetica, sans-serif"> 
            </font></font><font face="Verdana, Arial, Helvetica, sans-serif"> 
            <input name="Email_Home" size="15" value="<%=Email_Home%>">
            </font></b></font></td>
          <td width="19%" align="right"><font size="1" color="#000099"><b><font face="Verdana, Arial, Helvetica, sans-serif">Work 
            E-mail:</font></b></font></td>
          <td width="31%"><font size="1" color="#000099"><font face="Verdana, Arial, Helvetica, sans-serif"> 
            <input name="Email_Work" size="15"  value="<%=Email_Work%>">
            </font></font></td>
        </tr>
        <tr valign="center"> 
          <td width="22%" align="right" height="18"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Web 
            Address:</b></font></td>
          <td width="28%" height="18"><font size="1" color="#000099"><font face="Verdana, Arial, Helvetica, sans-serif"><b> 
            </b></font><font size="1" color="#000099"><font face="Verdana, Arial, Helvetica, sans-serif"> 
            </font></font><font face="Verdana, Arial, Helvetica, sans-serif"><b> 
            <input name="Web" size="15"  value="<%=Web%>">
            </b></font></font></td>
          <td width="19%" align="right" height="18"><font size="1" color="#000099"><b><font face="Verdana, Arial, Helvetica, sans-serif">Alt. 
            E-mail:</font></b></font></td>
          <td width="31%" align="left" height="18"><font size="1" color="#000099"><font face="Verdana, Arial, Helvetica, sans-serif"> 
            </font><font size="1" color="#000099"><font face="Verdana, Arial, Helvetica, sans-serif"> 
            </font></font><font face="Verdana, Arial, Helvetica, sans-serif"> 
            <input name="Email_Other" size="15"  value="<%=Email_Other%>">
            </font></font></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr> 
      <td colspan="6" align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b><IMG height=3 src="../images/shim.gif" width=1></b></font></td>
  </tr>
  <tr> 
      <td align="right" width="99" bgcolor="#cccccc"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Group Info: </b></font></td>
      <td align="right" width="1" bgcolor="#ffffff">&nbsp;</td>
      <td colspan="4" bgcolor="#cccccc"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b> 
        </b></font><font face="Verdana, Arial, Helvetica, sans-serif" size="1"></font><font face="Verdana, Arial, Helvetica, sans-serif" size="1"></font><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b></b></font> 
        <table width="100%" border="0" cellspacing="1" cellpadding="0" bordercolorlight="#ffffff" bordercolor="#ffffff">
        <tr valign="center"> 
          <td width="100%" align="left">
  
          <font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b> 
				<input type="hidden" name="Groups" value="<%=Group("Group_ID")%>">
				&nbsp;&nbsp;&nbsp;&nbsp;This contact will be found in:<br></b><div align="right">
					<%=Group("Name")%> (
					<select name="Contact_Type_ID_<%=Group("Group_ID")%>" class="input-form-small" MULTIPLE SIZE="2">
					<%	SQL = "Select * from Contact_Type"
						Set CT = Conn.Execute(SQL)
						Do While Not CT.EOF
							%>
							<option value="<%=CT("Contact_Type_ID")%>"
							
							<%
							If isObject(RSContact) Then
								RSContact.MoveFirst
								Do While Not RSContact.EOF
									If CStr(RSContact("Contact_Type_ID")) = CStr(CT("Contact_Type_ID")) Then Response.Write " selected"
									RSContact.MoveNext
								Loop
							End If
							%>
							
							><%=CT("Contact_Type_Name")%></option>
							<%
							CT.MoveNext
						Loop
						Set CT = Nothing
					%>
					</select>
					)
					</div>
<br>
          <% If Edit = True Then %><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b> 
				&nbsp;&nbsp;&nbsp;&nbsp;This contact currently belongs to:<br></b><div align="right">
					<%
						RSContact.MoveFirst
						Do While Not RSContact.EOF
							%>
								<%=RSContact("Name")%> (<%=RSContact("Contact_Type_Name")%>)<br>
								<input type="hidden" name="Existing_Groups" value="<%=RSContact("Group_ID")%>">
								<input type="hidden" name="Existing_Contact_Type_ID_<%=RSContact("Group_ID")%>" value="<%=RSContact("Contact_Type_ID")%>">
							<%						
							RSContact.MoveNext
						Loop
					%></div>
          <% End If %>

          </td>
        </tr>
        </tr>
      </table>
    </td>
  </tr>
  <tr> 
      <td colspan="6" bgcolor="#6699cc" align="right" height="2"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#">Manage User Accounts for this Contact: <input type="checkbox" name="createuser" value="True"></td>
  </tr>
  </table>

<div align="center"><br>
	<% If Edit = True Then %>
        <input type="button" name="Submit" value="Update Record" onclick="SubmitForm();">
	<% Else %>
        <input type="button" name="Submit" value="Create the Contact" onclick="SubmitForm();">
    <% End If %>
</div>
</FORM>
</body>
</html>
