
769 P.2d 579 (1989)
115 Idaho 702
Duane L. ST. CLAIR, M.D., and Evelyn St. Clair, husband and wife; Darrell J. Ludders, M.D.; Jon Kattenhorn, M.D. and Jeanette Kattenhorn, husband and wife; and Beverly Ludders, M.D., Plaintiffs-Appellants,
v.
Philip M. KRUEGER, M.D. and Allyn M. Krueger, husband and wife, dba A & M Rental; and John Does I Through V, Defendants-Respondents.
No. 16403.
Supreme Court of Idaho.
February 16, 1989.
Rehearing Denied February 16, 1989.
*580 Paul E. Levy, Boise, for plaintiffs-appellants.
Hawley Troxell Ennis & Hawley, Boise, for defendants-respondents. Richard G. Smith argued.
Before BAKES, BISTLINE and HUNTLEY, JJ., and McFADDEN, J. pro tem.[*]
1988 OPINION NO. 114, FILED DECEMBER 13, 1988, IS HEREBY WITHDRAWN, AND THIS OPINION IS SUBSTITUTED THEREFOR.
PER CURIAM.
This appeal arises from a complaint seeking to enforce a restrictive covenant on commercially developed land located in the neighborhood of St. Alphonsus Hospital in Boise. The St. Clairs are owners of land adjacent to that of Dr. Krueger. The St. Clairs sought a permanent injunction from the district court which would enjoin Dr. Krueger from building an office complex on his land. The basis for seeking the injunction was that Dr. Krueger's planned construction would violate a restrictive covenant which controlled the development of both the St. Clairs' and Dr. Krueger's land.
The St. Clairs purchased undeveloped land near St. Alphonsus Hospital in 1975. The land was part of Boise's first planned unit development. The parcel that Dr. Krueger later purchased was to remain undeveloped, except for landscaping.
In 1976 Dr. Krueger's predecessors-in-interest sought to build offices on the land. The consent of Dr. St. Clair and his partners was required. The parties reached an agreement whereby the formerly undeveloped parcel could be developed. Dr. St. Clair's group sought to ensure that Dr. Krueger's building included adequate parking. The agreement required eight parking spaces for every 1,000 square feet of gross office space. In 1977 Dr. Krueger's predecessors requested that the restrictive covenant be amended to require only six parking spaces per 1,000 square feet of gross office space. This request was granted.
In 1978 the St. Clair group constructed their own office building which conformed to the covenant. They provided the required number of parking spaces on-site.
The language that is at issue in the agreement is the following restrictive covenant:[1]

*581 In consideration of the mutual covenants contained herein, both parties agree that upon construction of an office building on their respective parcels of real property, each of the First Parties and Second Parties will provide a minimum of six (6) parking spaces per one thousand (1,000) gross square feet of office space in their respective office complexes, unless otherwise mutually agreed upon.
In 1983 Dr. Krueger joined others in putting together earnest money for a purchase of the encumbered parcel. Dr. Krueger was aware of the restrictive covenant. In 1984 Dr. Krueger bought the parcel, and entered into an agreement with St. Alphonsus Hospital in which the hospital agreed to pay him to build and occupy an office complex.
Dr. Krueger proposed to construct a building of 24,950 square feet on that parcel. His building plan and proposal to the Ada County Planning and Zoning Commission showed 53 on-site parking spaces. Dr. Krueger wanted to obtain off-site parking to provide the remaining four parking spaces, and negotiated an agreement with the nearby Rodeway Inn which provided a parking license, cancelable by either party upon giving 90 days' notice.
Dr. St. Clair objected to Dr. Krueger's parking arrangement. On August 29, 1985, the St. Clair group brought this action to enjoin use of the property by the defendants except in accordance with the covenant.
At trial the primary issue was whether or not the restrictive covenant was ambiguous, i.e., whether or not the covenant required that the parking spaces provided for in the covenant had to be in the parties' "respective office complexes," or whether the parking could be off-site. The trial court first concluded, as a matter of law, that the parking covenant was ambiguous on the question of whether or not the parking spaces had to be provided on-site or whether off-site parking would satisfy its requirement. Therefore, the court permitted the parties to introduce extrinsic evidence concerning the intention of the parties in negotiating and executing the parking covenant. After considering that evidence, the trial court found that while neither party contemplated such an extensive medical complex as that proposed by Dr. Krueger, the most reasonable interpretation of the covenant was that the parking could be located off-site if it was readily available to Dr. Krueger's clients so as not to improperly burden the parking lot of the other parties to the covenant.[2]
The plaintiffs, Dr. St. Clair et al., have appealed asserting that the restrictive covenant is not ambiguous and that, as a matter of law, the restrictive covenant requires the parking spaces to be located in the respective office complexes of the parties, and not off-site. We agree.
The interpretation of written contracts and restrictive covenants presents, in the first instance, a question of law for the courts. DeLancey v. DeLancey, 110 Idaho 63, 714 P.2d 32 (1986); Bergkamp v. Carrico, 101 Idaho 365, 613 P.2d 376 (1980). However, if an agreement is ambiguous, the resolution of any ambiguity raises a question of fact for the trial court or jury. DeLancey v. DeLancey, supra; Pocatello Ind. Park v. Steel West, Inc., 101 Idaho 783, 621 P.2d 399 (1980). While the trial *582 judge's decision on the ambiguity question is entitled to deference, it is subject to our independent free review. Clearwater Minerals Corp. v. Presnell, 111 Idaho 945, 729 P.2d 420 (1986).
The critical language in the covenant provides that "each of the First Parties and Second Parties will provide a minimum of six (6) parking spaces per one thousand (1,000) gross square feet of office space in their respective office complexes... ." In interpreting any provision of a contract, however, our cases indicate that the entire agreement must be viewed as a whole. Wing v. Martin, 107 Idaho 267, 688 P.2d 1172 (1984); West v. Brenner, 88 Idaho 44, 396 P.2d 115 (1964). After reviewing the entire agreement, and recognizing the desire of the parties expressed therein to control the size of their respective office complexes, and to require each party to have sufficient parking to meet the needs of its office complex in order not to overflow into the parking space of the other, we conclude that the only reasonable interpretation of the provision is that the required six parking spaces per thousand gross square feet of office space must be "in their respective office complexes." Viewed as a whole, we conclude that the agreement is not ambiguous, and that as a matter of law it requires the parking spaces to be on-site. Accordingly, the judgment of the district court is reversed and the cause remanded with directions to determine the other issues in the case, including whether or not there was sufficient on-site parking provided for in the plan of Dr. Krueger to satisfy the requirement of "six (6) parking spaces per one thousand (1,000) gross square feet of office space in their respective office complexes... ."
Reversed and remanded for further proceedings. Costs to appellants. Attorney fees pursuant to the agreement to await the ultimate outcome in the district court.
NOTES
[*]   WARD, J. pro tem., participated in the oral argument, but died prior to issuance of the Court's opinion.
[1]  Technically, this provision in the agreement should probably be denominated an equitable servitude. Equitable servitudes and negative real covenants are two types of restrictive covenants that retain many similarities. For a definitive discussion see, Newman and Losey, "Covenants Running with the Land, and Equitable Servitudes; Two Concepts, or One?" 21 Hastings L.J. 1319 (1970).

The relationship between the St. Clairs and Kruegers lacks the "horizontal privity" that is generally required for the burden of a negative covenant to "run," i.e., bind successors in interest. See generally, Cunningham, Stoebuck, and Whitman, The Law of Property (West Publishing, 1984), §§ 8.13-8.33. Horizontal privity is absent in this case because the restrictive language at issue is not contained in a grant, or conveyance, or lease, between the St. Clairs and Kruegers. Both acquired their property through independent chains of title from an original common owner. But horizontal privity is not required in order to obtain the permanent injunction that the St. Clairs seek here. See Newman and Losey, supra, Cunningham, et al, supra.
[2]  The court further found it unclear whether the construction of the complex would violate the terms of the agreement. The court at that time declined to assume that construction would violate the agreement and observed that the plaintiffs might still have an adequate remedy at law for damages in the event that the building would violate the agreement.
