<%@ LANGUAGE = VBScript %> <% If IsEmpty(Request.QueryString("postalcode")) AND (Len(Trim(Request("postalcode"))) > 0) Then Response.Redirect Request.ServerVariables("SCRIPT_NAME") & "?POSTALCODE=" & Server.URLEncode(Request("postalcode")) End If If IsEmpty(Request.QueryString("country")) AND (Len(Trim(Request("country"))) > 0) Then Response.Redirect Request.ServerVariables("SCRIPT_NAME") & "?COUNTRY=" & Server.URLEncode(Request("country")) End If Dim chDQ, chSQ, iNumToFind iNumToFind = 1 chDQ = CStr(Chr(34)) chSQ = CStr(Chr(39)) DQ = CStr(Chr(34)) SQ = CStr(Chr(39)) %> Availa4: Suppliers
<% If IsEmpty(Request.QueryString("postalcode")) AND IsEmpty(Request.QueryString("country")) Then %>

Supplier Locator

Our network of suppliers is strategically located in livestock-producing areas around the world to ensure a timely delivery of our products.

To locate your nearest Zinpro supplier, simply enter the address information requested below.

">
To find your nearest international Zinpro supplier, select a country from the list below:

Country
 

<% ElseIf NOT IsEmpty(Request.QueryString("postalcode")) Then strZip = Replace(Request.QueryString("postalcode"), "+", " ") ' strZip = Replace(Request("postalcode"), "+", " ") If (Len(strZip) = 10) And (InStr(strZip, "-") > 0) Then strZip = Left(strZip, 5) End if Set objDBConn = Server.CreateObject("ADODB.Connection") objDBConn.Open "DNS=Zinpro;" fFound = False strState = "" strSQL = "SELECT * " _ & "FROM Locator_Zipcodes " _ & "WHERE Zipcode = '" & strZip & "'" Set rs = objDBConn.Execute(strSQL) If Not rs.EOF Then strState = rs("State_Province") End If If strState = "CA" Then ' _If_ the postal code is in California, show all California facilities. ' strSQL = "SELECT * " _ & "FROM Locator_Dealers_US " _ & "WHERE State_Province = 'CA'" Set rs = objDBConn.Execute(strSQL) Do While NOT rs.EOF fFound = FoundHeader(fFound) PrettyPrint(rs) rs.MoveNext Loop Else ' Otherwise, act like a normal locator (sheesh) ' If (Len(strZip) = 7) And (InStr(strZip, " ") > 0) Then ' Canadian Zipcode ... handle differently ' strSQL = "SELECT * " _ & "FROM Locator_Dealers_Canada " _ & "WHERE PostalCode = '" & strZip & "'" Else ' American Zipcode ' strSQL = "SELECT Locator_Dealers_US.ID, Locator_Dealers_US.Company, Locator_Dealers_US.Contact, " _ & " Locator_Dealers_US.State_Province, Locator_Dealers_US.City, Locator_Dealers_US.PhoneFax, Locator_Zipcodes.X, Locator_Zipcodes.Y " _ & "FROM Locator_Dealers_US " _ & "INNER JOIN Locator_Zipcodes ON Locator_Dealers_US.Postalcode = Locator_Zipcodes.Zipcode " _ & "WHERE Locator_Dealers_US.PostalCode = '" & strZip & "'" End If Set rs = objDBConn.Execute(strSQL) iCount = 0 strCity = "" strState = "" Do While (NOT rs.EOF) strCity = rs("City") strState = rs("State_Province") fFound = FoundHeader(fFound) PrettyPrint(rs) rs.MoveNext iCount = iCount + 1 Loop If iCount < iNumToFind Then ' Now, pull any close zipcodes ' If (Len(strZip) = 7) And (InStr(strZip, " ") > 0) Then ' Canadian Zipcode ... handle differently ' strSQL = "SELECT Locator_Dealers_Canada.ID, Locator_Dealers_Canada.Company, " _ & " Locator_Dealers_Canada.Contact, Locator_Dealers_Canada.City, " _ & " Locator_Dealers_Canada.State_Province, Locator_Dealers_Canada.PostalCode, " _ & " Locator_Dealers_Canada.PhoneFax " _ & "FROM Locator_Dealers_Canada " _ & " WHERE Locator_Dealers_Canada.City = '" & strCity & "' AND Locator_Dealers_Canada.State_Province = '" & strState & "' " _ & " AND (NOT (Locator_Dealers_Canada.PostalCode) = '" & strZip & "');" Else ' American Zipcode ' xCenter = 0.0 yCenter = 0.0 xDelta = 0.05 yDelta = 0.05 strSQL = "SELECT * FROM Locator_Zipcodes WHERE Zipcode = '" & strZip & "'" Set rsZips = objDBConn.Execute(strSQL) If NOT rsZips.EOF Then xCenter = rsZips("X") yCenter = rsZips("Y") End If strSQL = "SELECT Locator_Dealers_US.ID, Locator_Dealers_US.Company, Locator_Dealers_US.Contact, Locator_Dealers_US.City, Locator_Dealers_US.State_Province, " & _ "Locator_Dealers_US.PostalCode, Locator_Dealers_US.PhoneFax, Locator_Zipcodes.X, Locator_Zipcodes.Y, " & _ "Sqr(Abs(" & xCenter & "-Locator_Zipcodes.X)) + Sqr(Abs(" & yCenter & "-Locator_Zipcodes.Y)) AS Distance " & _ "FROM Locator_Dealers_US " & _ "INNER JOIN Locator_Zipcodes ON Locator_Dealers_US.PostalCode = Locator_Zipcodes.Zipcode " & _ "WHERE (NOT (Locator_Dealers_US.PostalCode) = '" & strZip & "') " & _ "ORDER BY Sqr(Abs(" & xCenter & "-Locator_Zipcodes.X)) + Sqr(Abs(" & yCenter & "-Locator_Zipcodes.Y));" End If Set rs = objDBConn.Execute(strSQL) Do While (NOT rs.EOF) AND (iCount < iNumToFind) fFound = FoundHeader(fFound) PrettyPrint(rs) rs.MoveNext iCount = iCount + 1 Loop End If If (iCount < iNumToFind) And (Len(strZip) = 7) And (InStr(strZip, " ") > 0) Then ' Canadian Zipcode ... last chance. ' strSQL = "SELECT Locator_Dealers_Canada.ID, Locator_Dealers_Canada.Company, Locator_Dealers_Canada.Contact, Locator_Dealers_Canada.City, Locator_Dealers_Canada.State_Province, " & _ "Locator_Dealers_Canada.PostalCode, Locator_Dealers_Canada.PhoneFax " & _ "FROM Locator_Dealers_Canada " & _ "WHERE Locator_Dealers_Canada.State_Province = '" & strState & "' " & _ "AND (NOT ((Locator_Dealers_Canada.PostalCode) = '" & strZip & "') OR ((Locator_Dealers_Canada.City) = '" & strCity & "'));" Set rs = objDBConn.Execute(strSQL) Do While (NOT rs.EOF) AND (iCount < iNumToFind) fFound = FoundHeader(fFound) PrettyPrint(rs) rs.MoveNext iCount = iCount + 1 Loop End If End If if fFound Then Response.Write "

" & vbCRLF End If If (iCount <= 0) and Not fFound Then Response.Write "No distributor found." & vbCRLF End If ElseIf NOT IsEmpty(Request.QueryString("country")) Then strCountry = Replace(Request.QueryString("country"), "+", " ") Set objDBConn = Server.CreateObject("ADODB.Connection") objDBConn.Open "Zinpro-zmc" strSQL = "SELECT * FROM Locator_Dealers_Foreign WHERE Country = '" + CStr(strCountry) + "'" Set rsDistrib = objDBConn.Execute(strSQL) If NOT rsDistrib.EOF Then %>

Zinpro has the following distributors in <%=Replace(rsDistrib("Country"), vbCR, "
")%>

Distributor
Contact
Phone/Fax
<%=Replace(rsDistrib("Company"), vbCR, "
")%>
<%=Replace(rsDistrib("Contact"), vbCR, "
")%>
<%=Replace(rsDistrib("PhoneFax"), vbCR, "
")%>
<% Else %> No distributor found. <% End If End If %>  

© 2002 Zinpro. All Rights Reserved. <% Sub PrettyPrint(ByRef objRS) Response.Write " " & vbCRLF & _ " " & Replace(objRS("Company"), vbCR, "
") & "" & vbCRLF & _ " " & Replace(objRS("Contact"), vbCR, "
") & "" & vbCRLF & _ " " & Replace(objRS("PhoneFax"), vbCR, "
") & "" & vbCRLF & _ " " End Sub Function FoundHeader(ByRef f) FoundHeader = f If Not f Then Response.Write "" & vbCRLF & _ " " & vbCRLF & _ " " & vbCRLF & _ " " & vbCRLF & _ " " & vbCRLF & _ " " & vbCRLF FoundHeader = True End If End Function %>
DistributorContactPhone/Fax