
386 N.W.2d 321 (1986)
PEOPLES STATE BANK OF PLAINVIEW, Minnesota, Appellant,
v.
Ross MUIR, Defendant and Third Party Plaintiff, Respondent,
Alan Marshman, a/k/a Al Marshman, Third Party-Defendant.
No. C5-85-2359.
Court of Appeals of Minnesota.
April 29, 1986.
Review Denied June 30, 1986.
*322 David A. Shulman, Rochester, for appellant.
Robert B. Spelhaug, Rochester, for respondent.
Heard, considered and decided by PARKER, P.J., and LANSING and CRIPPEN, JJ.

OPINION
CRIPPEN, Judge.
Respondent Ross Muir was a guarantor on the original note given for a line of credit extended by appellant Peoples State Bank to Alan Marshman. Appellant bank extended further credit to Marshman pursuant to the line of credit agreement between Marshman and the bank. When Marshman was unable to pay the debt incurred, the bank sought to collect from Muir. The trial court found that respondent was not liable for the unpaid debt. The bank appeals. We reverse and remand.

FACTS
Respondent Ross Muir owns several acres of farm land. For the past several years, the land has been farmed by Alan Marshman. Muir and Marshman agreed that Marshman would farm the land and Muir and Marshman would share in the proceeds from the farming enterprise.
During the course of the relationship between Marshman and Muir, both individuals borrowed money from appellant Peoples State Bank. They have borrowed money both individually and as co-obligors.
On January 28, 1982, Marshman and the bank entered into a line of credit agreement under which the bank agreed to lend Marshman a maximum of $40,000.[1] At the same time, Marshman signed a promissory note, borrowing $24,903.39 against his line of credit. Respondent signed the guarantor's contract that was part of the note instrument used in the line of credit transaction. Muir guaranteed "the prompt payment of the within Note (and all extensions and renewals thereof) and of all sums stated therein to be payable, when due, at maturity, by acceleration or otherwise * * *."
After the initial transaction and through May 1983, Marshman borrowed a total of $17,059.61 against his line of credit, and $6866.90 was charged on the line of credit for accumulations of interest. During the same time, Marshman made numerous payments on his obligation totaling $32,376.41.
In May 1983, Marshman's debt totaled $17,753.49. He was unable to make further payments, so the bank sought to collect the amount due from respondent. Respondent, claiming the promissory note for $24,903.39 had been paid, refused to pay. The bank claimed that respondent was liable as a guarantor for the funds loaned to Marshman under the line of credit and brought suit against respondent to collect $19,166.73, the amount, with accrued interest, still owed by Marshman.
Both parties moved for summary judgment, and the trial court granted respondent's motion, finding that there were no material facts in dispute and there were no ambiguities in the guarantor's contract. The trial court concluded that respondent obligated himself to pay no more than $24,903.39. *323 Because more than this amount was repaid by Marshman, the court decided the current balance due represented credit extended in excess of the sum Muir guaranteed.
The bank appeals from the order for summary judgment.

ISSUE
Did the guarantor's agreement make respondent liable for the outstanding debt left unpaid by Marshman?

ANALYSIS
The trial court may grant summary judgment when it appears there is no genuine issue as to any material fact and that either party is entitled to judgment as a matter of law. Minn.R.Civ.P. 56.03. We must determine whether respondent was clearly entitled to a summary judgment, taking the view of the evidence most favorable to appellant, and bearing in mind respondent has the burden of proof. Sauter v. Sauter, 244 Minn. 482, 484-85, 70 N.W.2d 351, 353 (1955).
The trial court expressly viewed the evidence most favorably for the nonmoving appellant and found that the material facts were undisputed and that respondent was entitled to judgment as a matter of law. Because the parties do not argue that any disputed material facts remained, we agree with the trial court that that part of the test was met.
The trial court also found that respondent was entitled to judgment as a matter of law and that the bank argued for an incorrect interpretation of the guarantor's contract.
When interpreting a guaranty agreement, "each case must depend upon the terms of the instrument under consideration." Tolerton & Stetson Co. v. Barck, 81 Minn. 470, 471, 84 N.W. 330, 331 (1900). Therefore, the effect of guaranty agreements are determined upon a case by case basis.
When determining the liability of a guarantor, the court looks to the principal contract to which the guaranty relates. Hungerford v. O'Brien, 37 Minn. 306, 307, 34 N.W. 161 (1887). A guaranty agreement is to be given a fair and reasonable construction and will not be enlarged beyond the fair and natural import of its terms. American Tobacco Co. v. Chalfen, 260 Minn. 79, 81, 108 N.W.2d 702, 704 (1961).
When construing a contract, it is the function of the court to determine the intention of the parties. Carl Bolander & Sons, Inc. v. United Stockyards Corp., 298 Minn. 428, 433, 215 N.W.2d 473, 476 (1974). Thus, the language of a contract is to be construed in such a way as to enforce the expectations reasonably raised by the language. See id.
We agree with the trial court in this case that the agreements signed by the parties were clear and unambiguous. We cannot agree, however, with the trial court's analysis of the transaction. The trial court erroneously granted summary judgment for respondent, and the case must be remanded to the court so summary judgment can be entered for appellant.
The transactions here involved a line of credit agreement and a promissory note that incorporates the language on the transaction stated in the line of credit agreement. Both documents make it evident that the parties expected occasional, even frequent, advances, repayment, and further advances against the open line of credit.
The integration of the two documents is evident initially from the headings used on the documents: the line of credit agreement states specifically that it is to be used "with Promissory Note Form VRIN." The promissory note used in the transaction, which contains the guarantor agreement signed by respondent, states that it is to be used "with Line of Credit Agreement Form ODLCA."
According to the language of the note guaranteed by respondent, Marshman promised to pay $24,903.39 "or so much thereof as may from time to time have been advanced under and pursuant to the *324 line of credit agreement of even date herewith issued by the Lender to the Borrower (`Line of Credit Agreement')." This line of credit agreement gives Marshman the right to borrow sums at times and in amounts he chooses up to a maximum amount of $45,000, with rights to "borrow, prepay and reborrow hereunder."
We agree with the trial court that respondent was liable as a guarantor only up to $24,903.39, the amount loaned under the original promissory note. The trial court noted that in March and April of 1983, Marshman made payments of $16,213.75, $6588, and $2015.66, the total of which almost equaled the amount of the original loan. The court reasoned that these payments relieved respondent of his guarantor's liability. We do not agree that because Marshman paid back more than the amount of the original loan that respondent has been relieved of his liability as a guarantor. Nothing in the record shows characteristics of this transaction suggesting that any payments were directed specifically toward any particular advances. Respondent is liable under his guarantor's agreement for up to $24,903.39. Marshman's present debt obligation is $19,166.73, well within the amount for which respondent is liable. Therefore, the bank may properly collect that amount from respondent.
Respondent contends that Marshman would not have a present obligation to the bank if credit had not been extended in sums above the amount of the guaranteed note. It is true that by late 1982, the debt of Marshman amounted to over $40,000. Respondent also argues that the note contains no language about payment of a balance due but no greater than the note amount. Cf. Tolerton, 81 Minn. 470, 84 N.W. 330. These arguments overlook the express language of the line of credit agreement and the note itself. The line of credit contract showed expectations for borrowing and for payment and reborrowing, and the note called for payment of $24,903.39 "or so much thereof as may from time to time have been advanced" under the contract. The language of these instruments is synonymous with language otherwise referring to a balance due up to a prescribed limit.

DECISION
The trial court erred in determining that the respondent had been released from his guarantor's agreement. The trial court must enter summary judgment for appellant bank.
Reversed and remanded with instructions.
NOTES
[1]  In late January 1983, the Marshman indebtedness to the bank increased to $40,325.98. One week later, Marshman gave the bank a new line of credit agreement, which stated a maximum indebtedness of $45,000. Except for the increase in the maximum balance, nothing in the 1983 agreement suggests a modification or replacement of the 1982 line of credit agreement expressly mentioned in Marshman's 1982 note.
