<%

 '// If Session("Group_ID") = "" Then
 '//	Response.Write ("Error: No Group ID. You should login first.. this won't work!<br><br>")
 '// Else

' Get Entity Detail Information... if update a record ability has been requested..
Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open Application("conn_string")

Dim SQLName, RSName
SQLName = "get_entity_details_from_group @Group_ID='" & Session("Admin_Group_ID") & "'"
Set RSName=Conn.Execute(SQLName)

' Set the Edit/New Entity Flag
Dim Edit
Edit = True

If RSName.EOF Then 
	Edit = False
End If

If Request("Create") = "1" Then
	Edit = False
End If

'Get the Lookup Tier to pull the drop down from...
Dim Tier_1_ID
Tier_1_ID = Replace(Request.QueryString("Lookup"), "'", """")

If Tier_1_ID = "" Then Tier_1_ID = Get_Parent_Lookup (RSName("Lookup_ID"))

Dim InFrame, Redir, From, Brand

If Request.QueryString("InFrame") <> "" Then InFrame=Request.QueryString("InFrame")

IsaBrand="0"
If Request.QueryString("Brand") = "1" Or Request.Form("Brand") = "1" Then IsaBrand = "1"

If Not Request.QueryString("Redir") = "" Then 
	Redir=Request.QueryString("Redir")
ElseIf Not Request.Form("Redir") = "" Then 
	Redir=Request.Form("Redir")
Else
	If Not Session("default_page") = "" Then 
		Redir=Session("default_page")
	Else
		Redir="default.asp"
	End If
End If
	
If Not Request.QueryString("From") = "" Then 
	From=Request.QueryString("From")
ElseIf Not Request.Form("From") = "" Then 
	From=Request.Form("From")
Else
	If Not Session("default_page") = "" Then 
		From=Session("default_page")
	Else
		From="default.asp"
	End If
End If

Frame = "top.stage"

' Lights.. dimmed....
Dim SQL1
Dim SQL2
Dim SQL3
Dim SQL4
Dim RS1
Dim RS2
Dim RS3
Dim Toll_Free
Dim Billing_Toll_Free
Dim Tax_ID
Dim Phone_CountryCode
Dim Billing_Phone_CountryCode
Dim Parent_Entity_ID
Dim Franchise_ID
Dim Billing_Entity_ID
Dim Group_Type_ID
Dim Entity_ID
Dim Location_ID
Dim Entity_Name

' Check to see if we've posted to ourselves....
If (UCase(Request.ServerVariables("REQUEST_METHOD")) = "POST" And Request.Form("Address_1") <> "" And Request.Form("Edit") = "False") Then

	Group_Type_ID = "874" ' Initial Entity Group Type
	
	Tax_ID = Request.Form("Tax_ID1") & Request.Form("Tax_ID2")
	Billing_Toll_Free = Request.Form("Billing_Toll_Free_1") & Request.Form("Billing_Toll_Free_2")
	Toll_Free = Request.Form("Toll_Free_1") & Request.Form("Toll_Free_2")
	Parent_Entity_ID = Request.Form("Parent_Entity_ID")
	Franchise_ID = Request.Form("Franchise_ID")
	Billing_Entity_ID = Request.Form("Billing_Entity_ID")
	Lookup_Type_ID = Request.Form("Lookup_Type")
	Location_ID = Request.Form("Location_ID")
	Entity_Name = Replace(Request.Form("Name"), "'", "''")

	' Phone Country Code Definitions....... pull based on country...? add in later........?
	Phone_CountryCode = 1
	Billing_Phone_CountryCode = 1			
					
	If Request.Form("Parent_Entity_ID") = "" Then 
		Parent_Entity_ID = "NULL"
	Else
		Parent_Entity_ID = "'" & Parent_Entity_ID & "'"
	End If
		
	If Request.Form("Franchise_ID") = "" Then 
		Franchise_ID = "NULL"
	Else
		Franchise_ID = "'" & Franchise_ID & "'"
	End If	
		
	If Request.Form("Billing_Entity_ID") = "" Then 
		Billing_Entity_ID = "NULL"
	Else
		Billing_Entity_ID = "'" & Billing_Entity_ID & "'"
	End If

	If Request.Form("Location_ID") = "" Then 
		Location_ID = "NULL" 
	Else
		Location_ID = "'" & Location_ID & "'"
	End If

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

	SQL1 = "[Avante].[dbo].[Add_Entity] " 
	SQL1 = SQL1 & "@Parent_Group_ID="& Parent_Entity_ID & "," 
	SQL1 = SQL1 & "@Franchise_ID=" & Franchise_ID & "," 
	SQL1 = SQL1 & "@Group_Type_ID='" & Group_Type_ID & "'," 
	SQL1 = SQL1 & "@Billing_Entity_ID=" & Billing_Entity_ID & "," 
	SQL1 = SQL1 & "@Name='" & Entity_Name & "'," 
	SQL1 = SQL1 & "@Lat='" & Request.Form("Lat") & "'," 
	SQL1 = SQL1 & "@Long='" & Request.Form("Long") & "'," 
	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 & "@County='" & Request.Form("County") & "'," 
	SQL1 = SQL1 & "@Country='" & Request.Form("Country") & "'," 
	SQL1 = SQL1 & "@ZIP='" & Request.Form("ZIP") & "'," 
	SQL1 = SQL1 & "@ZIP_4='" & (Request.Form("ZIP_4")) & "'," 
	SQL1 = SQL1 & "@Phone_CountryCode='" & Phone_CountryCode & "'," 
	SQL1 = SQL1 & "@Billing_Phone_CountryCode='" & Billing_Phone_CountryCode & "'," 
	SQL1 = SQL1 & "@Phone_AreaCode='" & (Request.Form("Phone_AreaCode")) & "'," 
	SQL1 = SQL1 & "@Phone='" & (Request.Form("Phone")) & "'," 
	SQL1 = SQL1 & "@Fax_AreaCode='" & (Request.Form("Fax_AreaCode")) & "',"
	SQL1 = SQL1 & "@Fax='" & (Request.Form("Fax")) & "',"
	SQL1 = SQL1 & "@Toll_Free='" & (Toll_Free) & "'," 
	SQL1 = SQL1 & "@Contact='" & Request.Form("Contact") & "'," 
	SQL1 = SQL1 & "@Web='" & Request.Form("Web") & "'," 
	SQL1 = SQL1 & "@Email='" & Request.Form("Email") & "'," 
	SQL1 = SQL1 & "@Billing_Address_1='" & Request.Form("Billing_Address_1") & "'," 
	SQL1 = SQL1 & "@Billing_Address_2='" & Request.Form("Billing_Address_2") & "'," 
	SQL1 = SQL1 & "@Billing_City='" & Request.Form("Billing_City") & "'," 
	SQL1 = SQL1 & "@Billing_State='" & Request.Form("Billing_State") & "'," 
	SQL1 = SQL1 & "@Billing_County='" & Request.Form("Billing_County") & "'," 	
	SQL1 = SQL1 & "@Billing_Country='" & Request.Form("Billing_Country") & "'," 
	SQL1 = SQL1 & "@Billing_Zip='" & Request.Form("Billing_Zip") & "'," 
	SQL1 = SQL1 & "@Billing_Zip_4='" & (Request.Form("Billing_Zip_4")) & "'," 
	SQL1 = SQL1 & "@Billing_Phone_AreaCode='" & Request.Form("Billing_Phone_AreaCode") & "'," 
	SQL1 = SQL1 & "@Billing_Phone='" & (Request.Form("Billing_Phone")) & "',"
	SQL1 = SQL1 & "@Billing_Fax_AreaCode='" & Request.Form("Billing_Fax_AreaCode") & "'," 
	SQL1 = SQL1 & "@Billing_Fax='" & Request.Form("Billing_Fax") & "'," 
	SQL1 = SQL1 & "@Billing_Toll_Free='" & Billing_Toll_Free & "'," 
	SQL1 = SQL1 & "@Billing_Contact='" & Request.Form("Billing_Contact") & "'," 
	SQL1 = SQL1 & "@Billing_Email='" & Request.Form("Billing_Email") & "'," 
	SQL1 = SQL1 & "@Tax_Type_ID='" & (Request.Form("Tax_Type_ID")) & "'," 
	SQL1 = SQL1 & "@Tax_ID='" & Tax_ID & "'," 
	SQL1 = SQL1 & "@Entity_Type='" & isaBrand & "'," 
	SQL1 = SQL1 & "@Lookup_ID='" & Request.Form("Lookup_Type") & "'," 
	SQL1 = SQL1 & "@Location_ID=" & Location_ID & ""
	RS1.Open SQL1, conn

	For Each Key in Request.Form
		If InStr(1, Key, "_lid") Then
			If Not Request.Form(Key) = "" Then
	   			Conn.Execute ("Add_Group_Lookup_Map '" & Mid(Key, 5) & "','" & RS1("Group_ID") & "'")
			End If
		End If
	Next

	Session("Admin_Group_ID") = RS1("Group_ID")

	If Not Session("Admin_Realm") = "" Then
		Conn.Execute ("Add_Group_Realm_Map @Group_ID='" & Session("Admin_Group_ID") & "', @Realm_ID='" & Session("Admin_Realm") & "'")
	End If

	Set RS1 = Nothing
	Set RSName = Nothing
	'Set Conn = Nothing
	
	Response.Redirect(Redir & "?From=" & From)

	' End of posting to ourselves... for create.. let's do update....

ElseIf (UCase(Request.ServerVariables("REQUEST_METHOD")) = "POST" And Request.Form("Address_1") <> "" And Request.Form("Edit") = "True") Then

	Group_Type_ID = "874" ' Initial Entity Group Type.. lets us know that this is an entity's group record...
	
	Tax_ID = Request.Form("Tax_ID1") & Request.Form("Tax_ID2")
	Billing_Toll_Free = Request.Form("Billing_Toll_Free_1") & Request.Form("Billing_Toll_Free_2")
	Toll_Free = Request.Form("Toll_Free_1") & Request.Form("Toll_Free_2")
	Parent_Entity_ID = Request.Form("Parent_Entity_ID")
	Franchise_ID = Request.Form("Franchise_ID")
	Billing_Entity_ID = Request.Form("Billing_Entity_ID")
	Lookup_Type_ID = Request.Form("Lookup_Type")
	Entity_ID = Request.Form("Entity_ID")
	Location_ID = Request.Form("Location_ID")
	Entity_Name = Replace(Request.Form("Name"), "'", "''")
			
	' Phone Country Code Definitions....... pull based on country...?

	Phone_CountryCode = 1
	Billing_Phone_CountryCode = 1			
					
	If Request.Form("Parent_Entity_ID") = "" Then 
		Parent_Entity_ID = "NULL"
	Else
		Parent_Entity_ID = "'" & Parent_Entity_ID & "'"
	End If
		
	If Request.Form("Franchise_ID") = "" Then 
		Franchise_ID = "NULL"
	Else
		Franchise_ID = "'" & Franchise_ID & "'"
	End If	
		
	If Request.Form("Billing_Entity_ID") = "" Then 
		Billing_Entity_ID = "NULL"
	Else
		Billing_Entity_ID = "'" & Billing_Entity_ID & "'"
	End If

	If Request.Form("Location_ID") = "" Then 
		Location_ID = "NULL" 
	Else
		Location_ID = "'" & Location_ID & "'"
	End If
	
	Set RS1 = Server.CreateObject("ADODB.Recordset")

	SQL1 = "[Avante].[dbo].[Update_Entity] "
	SQL1 = SQL1 & "@Entity_ID='" & Entity_ID & "'," 
	SQL1 = SQL1 & "@Parent_Group_ID="& Parent_Entity_ID & "," 
	SQL1 = SQL1 & "@Franchise_ID=" & Franchise_ID & "," 
	SQL1 = SQL1 & "@Group_Type_ID='" & Group_Type_ID & "'," 
	SQL1 = SQL1 & "@Billing_Entity_ID=" & Billing_Entity_ID & "," 
	SQL1 = SQL1 & "@Name='" & Entity_Name & "'," 
	SQL1 = SQL1 & "@Lat='" & Request.Form("Lat") & "'," 
	SQL1 = SQL1 & "@Long='" & Request.Form("Long") & "'," 
	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 & "@County='" & Request.Form("County") & "'," 
	SQL1 = SQL1 & "@Country='" & Request.Form("Country") & "'," 
	SQL1 = SQL1 & "@ZIP='" & Request.Form("ZIP") & "'," 
	SQL1 = SQL1 & "@ZIP_4='" & (Request.Form("ZIP_4")) & "'," 
	SQL1 = SQL1 & "@Phone_CountryCode='" & Phone_CountryCode & "'," 
	SQL1 = SQL1 & "@Billing_Phone_CountryCode='" & Billing_Phone_CountryCode & "'," 
	SQL1 = SQL1 & "@Phone_AreaCode='" & (Request.Form("Phone_AreaCode")) & "'," 
	SQL1 = SQL1 & "@Phone='" & (Request.Form("Phone")) & "'," 
	SQL1 = SQL1 & "@Fax_AreaCode='" & (Request.Form("Fax_AreaCode")) & "',"
	SQL1 = SQL1 & "@Fax='" & (Request.Form("Fax")) & "',"
	SQL1 = SQL1 & "@Toll_Free='" & (Toll_Free) & "'," 
	SQL1 = SQL1 & "@Contact='" & Request.Form("Contact") & "'," 
	SQL1 = SQL1 & "@Web='" & Request.Form("Web") & "'," 
	SQL1 = SQL1 & "@Email='" & Request.Form("Email") & "'," 
	SQL1 = SQL1 & "@Billing_Address_1='" & Request.Form("Billing_Address_1") & "'," 
	SQL1 = SQL1 & "@Billing_Address_2='" & Request.Form("Billing_Address_2") & "'," 
	SQL1 = SQL1 & "@Billing_City='" & Request.Form("Billing_City") & "'," 
	SQL1 = SQL1 & "@Billing_State='" & Request.Form("Billing_State") & "'," 
	SQL1 = SQL1 & "@Billing_County='" & Request.Form("Billing_County") & "'," 	
	SQL1 = SQL1 & "@Billing_Country='" & Request.Form("Billing_Country") & "'," 
	SQL1 = SQL1 & "@Billing_Zip='" & Request.Form("Billing_Zip") & "'," 
	SQL1 = SQL1 & "@Billing_Zip_4='" & (Request.Form("Billing_Zip_4")) & "'," 
	SQL1 = SQL1 & "@Billing_Phone_AreaCode='" & Request.Form("Billing_Phone_AreaCode") & "'," 
	SQL1 = SQL1 & "@Billing_Phone='" & (Request.Form("Billing_Phone")) & "',"
	SQL1 = SQL1 & "@Billing_Fax_AreaCode='" & Request.Form("Billing_Fax_AreaCode") & "'," 
	SQL1 = SQL1 & "@Billing_Fax='" & Request.Form("Billing_Fax") & "'," 
	SQL1 = SQL1 & "@Billing_Toll_Free='" & Billing_Toll_Free & "'," 
	SQL1 = SQL1 & "@Billing_Contact='" & Request.Form("Billing_Contact") & "'," 
	SQL1 = SQL1 & "@Billing_Email='" & Request.Form("Billing_Email") & "'," 
	SQL1 = SQL1 & "@Tax_Type_ID='" & (Request.Form("Tax_Type_ID")) & "'," 
	SQL1 = SQL1 & "@Tax_ID='" & Tax_ID & "'," 
	SQL1 = SQL1 & "@Entity_Type='" & isaBrand & "'," 
	SQL1 = SQL1 & "@Lookup_ID='" & Request.Form("Lookup_Type") & "'," 
	SQL1 = SQL1 & "@Location_ID=" & Location_ID & ""
	RS1.Open SQL1, conn
	
	' Drop all Lookup Relationships....
	Conn.Execute("Delete_Lookup_Map_By_Group @Group_ID='" & RS1("Group_ID") & "'")

	' Re-establish all lookup relationships...
	For Each Key in Request.Form
		If InStr(1, Key, "_lid") Then
			If Not Request.Form(Key) = "" Then
	   			Conn.Execute ("Add_Group_Lookup_Map '" & Mid(Key, 5) & "','" & RS1("Group_ID") & "'")
			End If
		End If
	Next

	Session("Admin_Group_ID") = RS1("Group_ID")

	If Not Session("Admin_Realm") = "" Then
		Conn.Execute ("Add_Group_Realm_Map @Group_ID='" & Session("Admin_Group_ID") & "', @Realm_ID='" & Session("Admin_Realm") & "'")
	End If

	Set RS1 = Nothing
	Set RSName = Nothing
	'Set Conn = Nothing
	
	Response.Redirect(Redir & "?From=" & From)

	' End of posting to ourselves... for edit.. okay.. done.. yay!

End If
	
' keep rollin'......

	' Get Countries and States into Recordsets
	Set State = Server.CreateObject("ADODB.RecordSet")
	Dim StateSQL
	StateSQL = "Select * from States"
	State.Open StateSQL, Conn

	Set Country = Server.CreateObject("ADODB.RecordSet")
	Dim CountrySQL
	CountrySQL = "Select * from Countries"
	Country.Open CountrySQL, Conn

	'Declare some stuff...
	Dim hideLayer

  	Dim Checkfound
	Dim Checkfound1
	Dim Checkfound2
	Dim Checkfound3
  
	Dim Tier1Count
	Dim Tier2Count

	Tier1Count = 0
	Tier2Count = 0

	' I'll bet these are recordsets...
	Set RS2 = Server.CreateObject("ADODB.Recordset")
	Set RS3 = Server.CreateObject("ADODB.Recordset")
	Set RS4 = Server.CreateObject("ADODB.Recordset")
	Set RS5 = Server.CreateObject("ADODB.Recordset")
		
	'SQL2 = "Select * from Lookup Where Tier='1' And Verified='1'"
    SQL2 = "Select * from Lookup_Lookup_Map LL Inner Join Lookup L On LL.Lookup_ID_2 = L.Lookup_ID Where LL.Lookup_ID_1='" & Tier_1_ID & "' And Tier>=2 And L.Verified='1'"
	RS2.Open SQL2, Conn

	If Edit = True Then
		SQL4 = "Select * from Group_Lookup_Map Where [Group_ID]='" & Session("Admin_Group_ID") & "'"
		RS4.Open SQL4, Conn
		
		Set RS5 = Conn.Execute("select gem.entity_id from group_entity_map gem inner join group_group_map ggm on ggm.group_id_1 = gem.group_id where ggm.group_id_2 = '" & Session("Admin_Group_ID") & "'")		
		Dim Edit_Parent_Entity_ID
		If Not RS5.EOF Then
			Edit_Parent_Entity_ID = RS5("Entity_ID")
		End If		
	End If	

    LTypes = LTypes & "<option value="""""">Select</option>" & Chr(13)

	Do Until RS2.EOF
	   Tier1Count = Tier1Count + 1

	   Checkfound = ""	   
	   If Edit=True Then
		 If RS2("Lookup_ID") = RSName("Lookup_ID") Then
			Checkfound = " selected"
		 End If	
	   End If

   	   LTypes = LTypes & "<option value=""" & RS2("Lookup_ID") & """" & Checkfound & ">" & RS2("Lookup_Name") & "</option>" & Chr(13)	   
			
	   Script_Vars = Script_Vars & "var text" & RS2("Lookup_ID") & ";" & Chr(13)

	   SQL3 = "Select * from Lookup_Lookup_Map LL Inner Join Lookup L On LL.Lookup_ID_2 = L.Lookup_ID Where LL.Lookup_ID_1='" & RS2("Lookup_ID") & "' And Tier>=2 And L.Verified='1'"
	   RS3.Open SQL3, Conn

	   Script_Add = Script_Add & "<Div id=""layer" & RS2("Lookup_ID") & """ >"
       Script_Add = Script_Add & "<font face=""Verdana, Arial, Helvetica, sans-serif"" size=""1"" color=""#000000"">Choose Additional Features:</font><br>"
       Script_Add = Script_Add & "<table border=0 cellspacing=0 cellpadding=0 width=""100%"">" & Chr(13)
       
	   Checkfound = "visibility:hidden;"

	   If Edit=True Then
	     If RS2("Lookup_ID") = RSName("Lookup_ID") Then
			  Checkfound = ""
		 End If
	   End If

   	   Script_Add2 = Script_Add2 & "#layer" & RS2("Lookup_ID") & " {position:absolute;top:102px;left:249px;" & Checkfound & "z-index:" & Tier1Count & "00;overflow:auto;height:75;width:250;background-color:#f4f4f4;}" & Chr(13)

       hideLayer = hideLayer & "if (ng5) document.getElementById('layer" & RS2("Lookup_ID") & "').style.visibility = ""hidden""" & Chr(13)
       hideLayer = hideLayer & "else if (ns4) document.layer" & RS2("Lookup_ID") & ".visibility = ""hide""" & Chr(13)
       hideLayer = hideLayer & "else if (ie4) layer.style" & RS2("Lookup_ID") & ".visibility = ""hidden""" & Chr(13) & Chr(13)

	   If Not RS3.EOF Then
	   	Do Until RS3.EOF
  	  	  Tier2Count = Tier2Count + 1
		  Checkfound = ""

		  If Edit = True Then
			If Not RS4.EOF Then 
			  RS4.MoveFirst			
			  Do Until RS4.EOF
				If RS3("Lookup_ID") = RS4("Lookup_ID") Then
					Checkfound = " checked"
				End If
				RS4.MoveNext
			  Loop	
			End If
		  End If
		  
    	  Script_Add = Script_Add & "<tr><td width=35 align=right> <input type=checkbox id=_lid" & RS3("Lookup_ID") & " name=_lid" & RS3("Lookup_ID") & " value=True" & Checkfound & "> &nbsp;</td>" & Chr(13)
		  Script_Add = Script_Add & "<td><font face=""Verdana, Arial, Helvetica, sans-serif"" size=""1"" color=""#000099""> " & RS3("Lookup_Name") & " </td></tr> " & Chr(13)
		  RS3.MoveNext
	   	Loop   
	   Else
		  Script_Add = Script_Add & "<tr><td colspan=2><br><font face=""Verdana, Arial, Helvetica, sans-serif"" size=""1"" color=""#000000"">None found.</font></td></tr>"
	   End If

	   Script_Add = Script_Add & "</table></Div>" & Chr(13)

	   RS3.Close
	   RS2.MoveNext
	Loop 

	Set RS4 = Nothing
	Set RS3 = Nothing
	Set RS2 = Nothing

Function Get_Parent_Lookup (Lookup_ID)
	
	On Error resume next
	SQL = "Get_Parent_Lookup @Tier = 1, @Lookup_ID=" & Lookup_ID & ""
	Response.Write (SQL)
	Set GRS = Conn.Execute(SQL)
	
	If Not GRS.EOF Then Lookup_ID = GRS("Lookup_ID")

	Get_Parent_Lookup = Lookup_ID
	
	on error goto 0
	
End Function

%>
<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>New Entity Entry</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--

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

function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}


function show_flyout() {
	top.main.cols = "300,559"; 
}

function hide_flyout(win,ID) {
	top.main.cols = "1,559"; 
	if (win=='parent')		{form2.parent_entity_id.value=ID;}
	if (win=='billing')		{form2.Billing_Entity_ID.value=ID;}
	if (win=='franchise')	{form2.Franchise_ID.value=ID;}
	if (win=='lookup')		{form2.Lookup_ID.value=ID;}
	if (win=='location')	{form2.location_id.value=ID;}
}

function Same_Bill_onclick() {
	form2.Billing_Address_1.value=form2.Address_1.value;
	form2.Billing_Address_2.value=form2.Address_2.value;
	form2.Billing_City.value=form2.City.value;
	form2.Billing_State.value=form2.State.value;
	form2.Billing_County.value=form2.County.value;
	form2.Billing_Contact.value=form2.Contact.value;
	form2.Billing_Country.value=form2.Country.value;
	form2.Billing_Zip.value=form2.Zip.value;
	form2.Billing_Zip_4.value=form2.Zip_4.value;
}

function Bill_Same_Phone_onclick() {
	form2.Billing_Phone_AreaCode.value=form2.Phone_AreaCode.value;
	form2.Billing_Phone.value=form2.Phone.value;
	form2.Billing_Fax_AreaCode.value=form2.Fax_AreaCode.value;
	form2.Billing_Fax.value=form2.Fax.value;
	form2.Billing_Toll_Free_1.value=form2.Toll_Free_1.value;
	form2.Billing_Toll_Free_2.value=form2.Toll_Free_2.value;
}

//-->
</SCRIPT>
<style>
	<%= Script_Add2 %>
</style>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function franchise_onclick() {
	franchise.href = 'franchise_id_flyout.asp?InFrame=<%=Frame%>&ID='+form2.Lookup_Type.value;
	show_flyout();
}


function hideLayer() { 

	<%= hideLayer %>

}

function ShowLayer(selObj) {

	hideLayer(); 
	
	if (!selObj.value == '') {

		if (ng5) document.getElementById("requestnew").style.visibility = "visible"; 
		else if (ns4) document.layers["requestnew"].visibility = "show"; 
		else if (ie4) document.all["requestnew"].style.visibility = "visible"; 

		if (ng5) document.getElementById("tablename").style.visibility = "visible"; 
		else if (ns4) document.layers["tablename"].visibility = "show"; 
		else if (ie4) document.all["tablename"].style.visibility = "visible"; 

		if (ng5) document.getElementById('layer' + selObj.value).style.visibility = "visible"; 
		else if (ns4) document.layers["layer" + selObj.value].visibility = "show"; 
		else if (ie4) document.all["layer" + selObj.value].style.visibility = "visible"; 

	}

}

function form_submit() {
	form2.submit();
}

//-->
</SCRIPT>
<link rel="stylesheet" href="/Style-sheets/headline.css" type="text/css">
</head>

<body bgcolor="#ffffff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" link="#000099">
<form action="entity_create-stage.asp" method="POST" id="form2" name="form2">
<%= Script_Add %>

<input type="hidden" name="isaBrand" value="<%= Brand %>">
<input type="hidden" name="Redir" value="<%= Redir %>">
<input type="hidden" name="From" value="<%= From %>">
<input type="hidden" name="Edit" value="<%= Edit %>">

<% If Edit = True Then %>
<input type="hidden" name="Entity_ID" value="<%= RSName("Entity_ID") %>">
<input type="hidden" name="Group_ID" value="<%= RSName("Group_ID") %>">
<% End If %>

<table border="0" cellspacing="0" cellpadding="0" width="500" bgcolor="#FFFFFF">
  <% If Edit = True Then %>
	<tr><td align="right" class="headline" bgcolor="#e3e3e3"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#3f3fbb">EDIT MODE&nbsp;</font></td></tr>
  <% Else 
		If isaBrand = "1" Then %>
			<tr><td align="right" class="headline" bgcolor="#e3e3e3"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#3f3fbb">CREATE A BRAND&nbsp;</font></td></tr>
		<% Else %>
			<tr><td align="right" class="headline" bgcolor="#e3e3e3"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#3f3fbb">CREATE AN ENTITY&nbsp;</font></td></tr>
		<% End If 
	 End If %>
    <tr bgcolor="#cccccc"> 
      <td width="500" bgcolor="#FFFFFF" align="middle" height="151"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"> 
        </font><font size="1" face="Arial, Helvetica, sans-serif"><b> </b></font> 
        <table width="500" border="0" cellspacing="1" cellpadding="0">
          <tr> 
            <td colspan="2" class="headline-ffffff" bgcolor="#5e5ebe">Name</td>
          </tr>
          <tr> 
            <td width="294"> &nbsp; 
              <input name="Name" size="25" value="<% If Edit=True Then Response.Write (RSName("Name"))%>">
            </td>
            <td width="205"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Tax 
              ID: </b></font><font size="1"><b> 
              <input name="Tax_ID1" size="2" maxlength="2" value="<% If Edit=True Then Response.Write (Mid(RSName("Tax_ID"),1,2))%>">
              <input name="Tax_ID2" size="7" maxlength="7" value="<% If Edit=True Then Response.Write (Mid(RSName("Tax_ID"),3,7))%>">
              </b></font></td>
          </tr>
          <tr> 
            <td colspan="2" align="right">
              <hr size="1" width="100%" align="center">
              <font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#000099">&nbsp;&nbsp; 
              What category best describes the organization:&nbsp;&nbsp;</font></b></font> 
              <font size="1"> 
              <select name="Lookup_Type" OnChange="ShowLayer(this);">
                <%=LTypes%> 
              </select>
              </font><br>
            </td>
          </tr>
          <tr valign="middle"> 
            <td height="19"> <font color="#000099"><b></b></font><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><font color="#000099"> 
              </font></font> 
              <table border="0" cellspacing="0" cellpadding="0" width="100%">
                <tr> 
                  <td colspan="2" height="18" align="left"><font color="#000099"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="1">&nbsp;&nbsp;Brand&nbsp;Affiliation:&nbsp;</font></b></font></td>
                </tr>
                <tr> 
                  <td width="105" height="18"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><font color="#000099"> 
                    <input type="text" id="Franchise_ID" name="Franchise_ID" size="15" value="<% If Edit=True Then Response.Write (RSName("Group_Brand_ID"))%>">
                    </font></font></td>
                  <td height="18" valign="bottom"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><font color="#000099"></font><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><font color="#000099"><a href="franchise_id_flyout.asp?InFrame=<%=Frame%>" id=franchise name=franchise target=flyout LANGUAGE=javascript onclick="return franchise_onclick()"><img border="0" src="images/brand-lookup.gif" width="120" height="18"></a></font></font></font></td>
                </tr>
              </table>
            </td>
            <td rowspan="2">
              <table cellspacing="0" cellpadding="0" id="tablename" border="0" width="250px" bgcolor="#ffffff" align="center" style="visibility:hidden;">
                <tr>
                  <td height="75px"> &nbsp; </td>
                </tr>
              </table>
            </td>
          </tr>
          <tr> 
            <td height="20"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"></font><font face="Verdana, Arial, Helvetica, sans-serif" size="1"> 
              </font> 
              <table border="0" cellspacing="0" cellpadding="0">
                <tr> 
                  <td colspan="2" align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>&nbsp;&nbsp;Parent&nbsp;Entity:&nbsp;</b></font></td>
                </tr>
                <tr> 
                  <td width="105"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"> 
                    <input name="parent_entity_id" id="parent_entity_id" size="15" value="<% If Edit=True Then Response.Write (Edit_Parent_Entity_ID)%>">
                    </font></td>
                  <td valign="bottom"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><a onClick="show_flyout();" href="parent_id_lookup_flyout.asp?InFrame=<%=Frame%>" target=flyout><img border="0" src="images/parent-lookup.gif" width="120" height="18"></a></b></font></td>
                </tr>
              </table>
            </td>
          </tr>
          <tr> 
            <td colspan="2">
              <table border="0" cellspacing="0" width="100%">
                <tr>
                  <td width="100">
					<table border="0" cellspacing="0" cellpadding="0">
					  <tr> 
						<td colspan="2" align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>&nbsp;&nbsp;Location&nbsp;Entity:&nbsp;</b></font></td>
					  </tr>
					  <tr> 
						<td width="105"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"> 
						<input name="location_id" id="location_id" size="15" value="<% If Edit=True Then Response.Write (RSName("Location_ID"))%>">
						</font></td>
						<td valign="bottom"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><a onClick="show_flyout();" href="location_id_flyout.asp?InFrame=<%=Frame%>" target=flyout><img border="0" src="images/location-lookup.gif" width="120" height="18"></a></b></font></td>
					  </tr>
                    </table>
<!--                  <font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>&nbsp;&nbsp;Entity 
                    Type:</b></font></td><td width="80"><font size="1" face="Arial, Helvetica, sans-serif"><b> 
                    <font color="#000099"> 
					<%

					Checkfound1 = "checked"
					Checkfound2 = ""

					If Edit = True Then
						If RSName("Brand") = "1" Then
							Checkfound1 = ""
							Checkfound2 = "checked"
						End If
					End If

					%>
                    <input type="radio" name="Entity_Type" value="0" <%=Checkfound1%>>
                    Standard</font></b></font></td><td>
					<font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b> 
                    </b></font> <font size="1" face="Arial, Helvetica, sans-serif" color="#000099"><b> 
                    <input type="radio" name="Entity_Type" value="1" <%=Checkfound2%>>
                    Brand Entity</b></font></td>
-->                    
                  <td align="right">
                    <div id="requestnew" name="requestnew" style="visibility:hidden;"><a href="new_lookup_type.asp" target="_new"><font size="1" face="Arial, Helvetica, sans-serif" color="#000099">Request 
                      New Classification</font></a> </div>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
	  <tr> 
            <td colspan="2">
              <table border="0" cellspacing="0" width="100%">
                <tr>
                  <td width="100"> <font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>&nbsp;&nbsp;Tax 
                    Type:</b></font></td><td width="80"><font size="1" face="Arial, Helvetica, sans-serif"><b> 
                    <font color="#000099">
					<%

					Checkfound1 = "checked"
					Checkfound2 = ""
					Checkfound3 = ""

					If Edit = True Then
						If RSName("Tax_Type_ID") = "2" Then
							Checkfound1 = ""
							Checkfound2 = "checked"
							Checkfound3 = ""
						ElseIf RSName("Tax_Type_ID") = "3" Then
							Checkfound1 = ""
							Checkfound2 = ""
							Checkfound3 = "checked"
						End If
					End If

					%>
                    <input type="radio" name="Tax_Type_ID" value="1" <%=Checkfound1%>>
                    Corporation</font></b></font></td><td><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b> 
                    </b></font> <font size="1" face="Arial, Helvetica, sans-serif" color="#000099"><b> 
                    <input type="radio" name="Tax_Type_ID" value="2" <%=Checkfound2%>>
                    Sole Propritorship</b></font><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b> 
                    </b></font><font size="1" face="Arial, Helvetica, sans-serif" color="#000099"><b> 
                    <input type="radio" name="Tax_Type_ID" value="3" <%=Checkfound3%>>
                    Non-profit</b></font></td>
                </tr>
              </table>
            </td>
          </tr>        </table>
      </td>
    </tr>
    <tr bgcolor="#CCCCCC"> 
      <td width="500" height="12" bgcolor="#5e5ebe" class="headline-ffffff">Physical 
        Address</td>
    </tr>
    <tr> 
      <td width="500" bgcolor="#FFFFFF"> 
        <table width="500" border="0" cellspacing="1" cellpadding="0">
          <tr> 
            <td width="109" align="right" height="24"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Address 
              1:</b></font></td>
            <td height="24"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"> 
              <INPUT type="text" id=Address_1 name=Address_1 value="<% If Edit=True Then Response.Write (RSName("Address_1"))%>">
              </font></td>
              <td width="90" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>County:</b></font></td>
              <td><input name="County" value="<% If Edit=True Then Response.Write (RSName("County"))%>" size="15"></td>
          </tr>
          <tr> 
            <td width="109" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Address 
              2:</b></font></td>
            <td width="154"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"> 
              <input name="Address_2" value="<% If Edit=True Then Response.Write (RSName("Address_2"))%>">
              </font></td>
            <td width="90" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#000099">City:</font></b></font></td>
            <td width="146"><font size="1"> 
              <input name="City" size="15" value="<% If Edit=True Then Response.Write (RSName("City"))%>">
              </font></td>
          </tr>
          <tr> 
            <td width="109" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Postal 
              Code:</b></font></td>
            <td width="154"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b> 
              <input name="Zip" size="5" value="<% If Edit=True Then Response.Write (RSName("ZIP"))%>">
              <font color="#000099">+</font> 
              <input name="Zip_4" size="4" maxlength="4" value="<% If Edit=True Then Response.Write (RSName("ZIP_4"))%>">
              </b></font><font size="1"></font></td>
            <td align="left"><select name="State">
                <option value="">State</option>
				<%
				State.MoveFirst()
				Do While Not State.EOF
					If Edit = True Then
						If UCase(RSName("State")) = UCase(State("State_Abbr")) Or UCase(RSName("State")) = UCase(State("State_Name")) Then
							%>
							<OPTION value="<%=State("State_Abbr")%>" selected><%=State("State_Abbr")%></OPTION>
							<%
						Else
							%>
							<OPTION value="<%=State("State_Abbr")%>"><%=State("State_Abbr")%></OPTION>
							<%
						End If
					Else
						%>
						<OPTION value="<%=State("State_Abbr")%>"><%=State("State_Abbr")%></OPTION>
						<%
					End If
					State.MoveNext()
				Loop
				%>
              </select>&nbsp;<a target="_new" href="statelist.asp"><img src="images/question.gif" alt="Click here for State list!" border="0"></a>&nbsp;</td>
            <td width="146"><select name="Country">
                <option value="">Country</option>
				<%
				Country.MoveFirst()
				Do While Not Country.EOF
					If Edit = True Then
						If UCase(RSName("Country")) = UCase(Country("Country_Abbr")) Or UCase(RSName("Country")) = UCase(Country("Country_Name")) Then
							%>
							<OPTION value="<%=Country("Country_Abbr")%>" selected><%=Country("Country_Name")%></OPTION>
							<%
						Else
							%>
							<OPTION value="<%=Country("Country_Abbr")%>"><%=Country("Country_Name")%></OPTION>
							<%
						End If
					Else
						%>
						<OPTION value="<%=Country("Country_Abbr")%>"><%=Country("Country_Name")%></OPTION>
						<%
					End If	
					Country.MoveNext()
				Loop
				%>
              </select></td>
          </tr>
        </table>
        <table width="500" border="0" cellspacing="1" cellpadding="0">
          <tr> 
            <td width="109" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b> 
              Phone:</b></font></td>
            <td width="131"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"> 
              <input name="Phone_AreaCode" size="3" value="<% If Edit=True Then Response.Write (RSName("Phone_AreaCode"))%>">
              <input name="Phone" size="8" value="<% If Edit=True Then Response.Write (RSName("Phone"))%>">
              </font></td>
            <td width="113" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Toll 
              Free Phone:</b></font></td>
            <td width="146"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"> 
              <input name="Toll_Free_1" size="3" value="<% If Edit=True Then Response.Write (Mid(RSName("Toll_Free"),1,3))%>">
              <input name="Toll_Free_2" size="8" value="<% If Edit=True Then Response.Write (Mid(RSName("Toll_Free"),4,8))%>">
              </font></td>
          </tr>
          <tr> 
            <td width="109" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b> 
              Fax:</b></font></td>
            <td width="131"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"> 
              <input name="Fax_AreaCode" size="3" value="<% If Edit=True Then Response.Write (RSName("Fax_AreaCode"))%>">
              <input name="Fax" size="8" value="<% If Edit=True Then Response.Write (RSName("Fax"))%>">
              </font></td>
            <td width="113" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Contact:</b></font></td>
            <td width="146"><input name="Contact" size="15" value="<% If Edit=True Then Response.Write (RSName("Contact"))%>"></td>
          </tr>
        </table>
      </td>
    </tr>
    <tr bgcolor="#ffffff"> 
      <td width="500" align="left" height="15" bgcolor="#5e5ebe"> 
        <table width="500" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <td align="left" width="201" class="headline-ffffff">Billing Address 
            </td>
            <td align="right" width="150"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><font color="#FFFFFF">Check 
              if same as above</font></font></td>
            <td width="149"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"> 
              <input type="checkbox" name="Same_Bill" language=javascript onClick="return Same_Bill_onclick()">
              </font></td>
          </tr>
        </table>
        
      </td>
    </tr>
    <tr> 
      <td width="500" bgcolor="#FFFFFF" valign="top"> 
        <table width="500" border="0" cellspacing="1" cellpadding="0">
          <tr> 
            <td width="109" align="right"></td>
            <td width="154" valign="bottom" align="right"><a onClick="show_flyout();" href="billing_id_flyout.asp?InFrame=<%=Frame%>" target=flyout><img border="0" src="images/entity-lookup.gif" width="120" height="18"></a>&nbsp;</td>
			<td colspan="2"></td>
          </tr>
          <tr> 
            <td width="109" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Billing Entity:</b></font></td>
            <td width="154"><input name="Billing_Entity_ID" value="<% If Edit=True Then If Not RSName("Billing_Entity_ID") = "0" Then Response.Write(RSName("Billing_Entity_ID"))%>"></td>
            <td width="90" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Contact:</b></font></td>
            <td width="146"><input name="Billing_Contact" size="15" value="<% If Edit=True Then Response.Write (RSName("Billing_Contact"))%>"></td>
          </tr>
          <tr> 
            <td width="109" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Address 
              1:</b></font></td>
            <td width="154"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"> 
              <input name="Billing_Address_1" id="Billing_Address_1" value="<% If Edit=True Then Response.Write (RSName("Billing_Address_1"))%>">
              </font></td>
            <td width="90" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b><font size="1" color="#000099">County:</font></b></font></td>
            <td width="146"><font size="1"> 
              <input name="Billing_County" value="<% If Edit=True Then Response.Write (RSName("County"))%>" size="15">
              </font></td>
          </tr>
          <tr> 
            <td width="109" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Address 
              2:</b></font></td>
            <td width="154"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"> 
              <input name="Billing_Address_2" value="<% If Edit=True Then Response.Write (RSName("Billing_Address_2"))%>">
              </font></td>
            <td width="90" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#000099">City:</font></b></font></td>
            <td width="146"><font size="1"> 
              <input name="Billing_City" size="15" value="<% If Edit=True Then Response.Write (RSName("Billing_City"))%>">
              </font></td>
          </tr>
          <tr> 
            <td width="109" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Postal 
              Code:</b></font></td>
            <td width="154"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b> 
              <input name="Billing_Zip" size="5" maxlength="5" value="<% If Edit=True Then Response.Write (RSName("Billing_Zip"))%>">
              <font color="#000099">+</font> 
              <input name="Billing_Zip_4" size="4" maxlength="4" value="<% If Edit=True Then Response.Write (RSName("Billing_Zip_4"))%>">
              </b></font><font size="1"></font></td>
            <td width="113" align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"> 
              <select name="Billing_State">
                <option value="">State</option>
				<%
				State.MoveFirst()
				Do While Not State.EOF
					If Edit = True Then
						If UCase(RSName("Billing_State")) = UCase(State("State_Abbr")) Or UCase(RSName("Billing_State")) = UCase(State("State_Name")) Then
							%>
							<OPTION value="<%=State("State_Abbr")%>" selected><%=State("State_Abbr")%></OPTION>
							<%
						Else
							%>
							<OPTION value="<%=State("State_Abbr")%>"><%=State("State_Abbr")%></OPTION>
							<%
						End If
					Else
						%>
						<OPTION value="<%=State("State_Abbr")%>"><%=State("State_Abbr")%></OPTION>
						<%
					End If
					State.MoveNext()
				Loop
				%>
              </select>&nbsp;<a target="_new" href="statelist.asp"><img src="images/question.gif" alt="Click here for State list!" border="0"></a>&nbsp;</td>
            <td width="146"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b> 
              <select name="Billing_Country">
                <option value="">Country</option>
				<%
				Country.MoveFirst()
				Do While Not Country.EOF
					If Edit = True Then
						If UCase(RSName("Billing_Country")) = UCase(Country("Country_Abbr")) Or UCase(RSName("Billing_Country")) = UCase(Country("Country_Name")) Then
							%>
							<OPTION value="<%=Country("Country_Abbr")%>" selected><%=Country("Country_Name")%></OPTION>
							<%
						Else
							%>
							<OPTION value="<%=Country("Country_Abbr")%>"><%=Country("Country_Name")%></OPTION>
							<%
						End If
					Else
						%>
						<OPTION value="<%=Country("Country_Abbr")%>"><%=Country("Country_Name")%></OPTION>
						<%
					End If	
					Country.MoveNext()
				Loop
				%>
              </select>
              </b></font></td>
          </tr>
        </table>
      </td>
    </tr>
    <tr bgcolor="#999999"> 
      <td bgcolor="#FFFFFF" height="13" width="500" valign="top"> 
        <table width="500" border="0" cellspacing="0" cellpadding="0" bgcolor="#5e5ebe">
          <tr>
            <td width="200" class="headline-ffffff">Billing Phone</td>
            <td width="150" align="right"><font size="1"><font size="1"><font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif">Check 
              if same as </font><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">above</font></font><font face="Arial, Helvetica, sans-serif" color="#FFFFFF"><b><font size="1"> 
              </font></b></font></font></td>
            <td width="150"><font size="1"><font face="Arial, Helvetica, sans-serif"><b><font size="1"><font color="#000099"> 
              <input type="checkbox" name="Bill_Same_Phone" language=javascript onClick="return Bill_Same_Phone_onclick()">
              </font></font></b></font></font></td>
          </tr>
        </table>
      </td>
    </tr>
    <tr> 
      <td width="500" bgcolor="#FFFFFF"> 
        <table width="501" border="0" cellspacing="1" cellpadding="0" bgcolor="#FFFFFF">
          <tr> 
            <td width="108" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b> 
              Phone:</b></font></td>
            <td width="134"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"> 
              <input name="Billing_Phone_AreaCode" size="3" value="<% If Edit=True Then Response.Write (RSName("Billing_Phone_AreaCode"))%>">
              <input name="Billing_Phone" size="8" value="<% If Edit=True Then Response.Write (RSName("Billing_Phone"))%>">
              </font></td>
            <td width="114" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Toll 
              Free Phone:</b></font></td>
            <td width="140"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"> 
              <input name="Billing_Toll_Free_1" size="3" value="<% If Edit=True Then Response.Write (Mid(RSName("Billing_Toll_Free"),1,3))%>">
              <input name="Billing_Toll_Free_2" size="8" value="<% If Edit=True Then Response.Write (Mid(RSName("Billing_Toll_Free"),4,8))%>">
              </font></td>
          </tr>
          <tr> 
            <td width="108" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b> 
              Fax:</b></font></td>
            <td width="134"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"> 
              <input name="Billing_Fax_AreaCode" size="3" value="<% If Edit=True Then Response.Write (RSName("Billing_Fax_AreaCode"))%>">
              <input name="Billing_Fax" size="8" value="<% If Edit=True Then Response.Write (RSName("Billing_Fax"))%>">
              </font></td>
            <td width="114" align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"></font></td>
            <td width="140"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"> 
              </font></td>
          </tr>
        </table>
      </td>
    </tr>
    <tr bgcolor="#ffffff"> 
      <td align="left" width="500"><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 bgcolor="#CCCCCC"> 
      <td width="500" height="12" bgcolor="#5e5ebe" class="headline-ffffff">Internet Information</td>
    </tr>
    <tr> 
      </tr>
    <tr> 
      <td width="500" bgcolor="#FFFFFF"><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="500" border="0" cellspacing="1" cellpadding="0" bordercolorlight="#ffffff" bordercolor="#ffffff">
          <tr valign="center"> 
            <td width="109" align="right"><font size="1" color="#000099"><b><font face="Verdana, Arial, Helvetica, sans-serif">E-mail:</font></b></font></td>
            <td width="140"><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" size="15" value="<% If Edit=True Then Response.Write (RSName("Email"))%>">
              </font></b></font></td>
            <td width="95" align="right"><font size="1" color="#000099"><b><font face="Verdana, Arial, Helvetica, sans-serif">Billing 
              E-mail:</font></b></font></td>
            <td width="155"><font size="1" color="#000099"><font face="Verdana, Arial, Helvetica, sans-serif"> 
              <input name="Billing_Email" size="15" value="<% If Edit=True Then Response.Write (RSName("Billing_Email"))%>">
              </font></font></td>
          </tr>
          <tr valign="center"> 
            <td width="109" align="right" height="18"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000099"><b>Web 
              Address:</b></font></td>
            <td width="140" 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="<% If Edit=True Then Response.Write (RSName("Web"))%>">
              </b></font></font></td>
            <td width="95" align="right" height="18"><font size="1" color="#000099"><b></b></font></td>
            <td width="155" 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"> 
              </font></font></td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
  <table width="500" border="0" cellspacing="0" cellpadding="0">
    <tr bgcolor="#6699cc" align="center"> 
      <td width="795" height="35" bgcolor="#5e5ebe"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">&nbsp;<b> 
<% If Edit = True Then 
		If Brand = "1" Then %>
        <input type="button" name="Submit" value="Update Brand" onclick="javasript:form_submit();">
		<% Else %>
        <input type="button" name="Submit" value="Update Entity" onclick="javasript:form_submit();">
		<% End If 
	Else
		If Brand = "1" Then %>
                <input type="button" name="Submit" value="Create Brand" onclick="javasript:form_submit();">
		<% Else %>
                <input type="button" name="Submit" value="Create Entity" onclick="javasript:form_submit();">
		<% End If 

  End If %>
        </b></font></b></td>
  </tr>
</table>
</FORM>
</body>
</html>
<%
Set Country = Nothing
Set State = Nothing
Set RSName = Nothing
'Set Conn = Nothing
%>