As promised, here is a fuller (and clearer, I hope) exposition of al-Biruni's method for determining the qibla (the direction to Mecca, expressed as an angle measured from due north) for the city of Jerusalem.

An understanding of the solution requires that we use the figure (Fig. 7.26) on p. 280 of the text.  I reproduce it here below a number of times, highlighting the various spherical triangles he measures along the way to determining the qibla.  Each stage of the calculation requires selecting a particular triangle and applying the fundamental law of sines.

(You can see a nice dynamic web app showing a spherical triangle at the MathWorld site.)

Here is an expanded version of the figure, outlining the various points and circles.  Essentially, it is a picture of the Earth viewed from directly above Jerusalem.  All the lines and curves are great circles (the through P look like lines from this perpsective).  Meridians are great circles through the North Pole.

Since N is in the direction of the compass point of north on the horizon at Jerusalem, the qibla is the measure of angle NPK = arc NCK.

From an atlas of the world, al-Biruni locates the coordinates of M and P.  The latitude of M is 21°25 ' (note the typo in the book!!) and its longitude is 39°49 '.  The latitude of P is 31°47 ' and its longitude is 35°13 '.

The first spherical triangle we consider is the triangle MHT.  See the figure below.  Since latitude measures the arc along the meridian between the city and the equator (see Fig. 7.25), it follows that TM = 90° - 21°25 ' = 68°35 '.  Also, angle THM is right and angle MTH is an angle between two meridian lines, hence is the difference of the longitudes of the points M and P: angle MTH = 39°49 ' - 35°13 ' = 4°36 '.  Now we can apply the law of sines to this triangle:

        

Next, we concentrate on the small triangle TFL.  Consult the figure below.  Since J lies on the horizon at M, MJ = 90° and so HJ = 90° - MH = 85°43 '; thus angle TFL = 85°43 '.  But L also lies on the horizon at M, so TL = ML - MT = 90° - MT = 21°45 '.  Now we apply the law of sines:

        

Now we draw attention to the triangle PFI and the figure below.  We observe that angle PFI = angle TFL = 85°43 ' and that PF = PN - FN = 90° - FN = 90° - (TN - TF) = 90° - (31°47 ' - 21°29 ') = 79°42 '.  So we can apply the law of sines:

        

Finally, we consider the triangle CFN.  Since angle MIC = 90° and angle MQC = 90°, it follows that the circle KPIQ is the horizon at C, so angle FCN = angle ICQ = IQ = PQ - PI = 90° - 78°51 ' = 11°9 '.  Also, angle CFN = angle PFI = 85°43 ', so we apply the law of sines to get

        

It follows that the qibla = KN = KC + CN = 90° + 67°14 ' = 157°14 ' and we're done.