For each positive integer $n$ it is shown how to construct a finite collection of multivariable polynomials $\{F_{i}:=F_{i}(t,X_{1},..., X_{\lfloor \frac{n+1}{2} \rfloor})\}$ such that each positive integer whose squareroot has a continued fraction expansion with period $n+1$ lies in the range of exactly one of these polynomials. Moreover, each of these polynomials satisfy a polynomial Pell's equation $C_{i}^{2} -F_{i}H_{i}^{2} = (-1)^{n-1}$ (where $C_{i}$ and $H_{i}$ are polynomials in the variables $t,X_{1},..., X_{\lfloor \frac{n+1}{2} \rfloor}$) and the fundamental solution can be written down. Likewise, if all the $X_{i}$'s and $t$ are non-negative then the continued fraction expansion of $\sqrt{F_{i}}$ can be written down. Furthermore, the congruence class modulo 4 of $F_{i}$ depends in a simple way on the variables $t,X_{1},..., X_{\lfloor \frac{n+1}{2} \rfloor}$ so that the fundamental unit can be written down for a large class of real quadratic fields. Along the way a complete solution is given to the problem of determining for which symmetric strings of positive integers $a_{1},..., a_{n}$ do there exist positive integers $D$ and $a_{0}$ such that $\sqrt{D} = [ a_{0};\bar{a_{1}, >..., a_{n},2a_{0}}]$.