Topic: return undefined error

Hi - I have been testing some code for using the results with Google maps.  The calculations are fine, but when the value is returned I get an undefined error.  Any help would be appreciated.

Also, my editor is highlighting the following line with an error:
       yres = (ycalc[yi] / ydiv);

Txs.   Ronnie


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
  <title></title>


<script type="text/javascript">

  var lat = 28.48805;
    var llong = -82.545564;
    var longDir = "W";
    var latDir = "N";
    var stra = "";
    var ychr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    var ynum = "0123456789";
    var yqth, yi, yk, ydiv, yres, ylp, y;
    var y     = 0;
    var ycalc = new Array(0,0,0);
    var yn    = new Array(0,0,0,0,0,0,0);

    stra += Math.round(lat * 10000) / 10000 + " " + latDir;
    stra += ", ";
    stra += Math.round(llong * 10000) / 10000 + " " + longDir;
   
    ycalc[1] = llong + 180;
    ycalc[2] = lat +  90;

    for (yi = 1; yi < 3; ++yi) {
        for (yk = 1; yk < 4; ++yk) {
            if (yk != 3) {
                if (yi == 1) {
                if (yk == 1) ydiv = 20;
                if (yk == 2) ydiv = 2;
            }
            if (yi == 2) {
                if (yk == 1) ydiv = 10;
                if (yk == 2) ydiv = 1;
            }
            yres = (ycalc[yi] / ydiv);
            ycalc[yi] = yres;
                if (ycalc[yi]>0)
                    ylp = Math.floor(yres)
                else
                    ylp = Math.ceil(yres);
            ycalc[yi] = (ycalc[yi] - ylp) * ydiv;
            }
            else {
                if (yi == 1)
                    ydiv = 12
                else
                    ydiv = 24;
            yres = ycalc[yi] * ydiv;
            ycalc[yi] = yres;
                if (ycalc[yi]> 0)
                    ylp = Math.floor(yres)
                else
                    ylp = Math.ceil(yres);
                }

            ++y;
            yn[y] = ylp;
        }
    }

    yqth = ychr.charAt(yn[1]) + ychr.charAt(yn[4]) + ynum.charAt(yn[2]);
    yqth += ynum.charAt(yn[5]) + ychr.charAt(yn[3])+ ychr.charAt(yn[6]);
    stra += ", " + yqth;
    alert(stra);
    return stra;
    }
</script>

</head>

<body>

<script type="text/javascript">
    var stra;
   
    test();
   
    alert(stra);   
   
</script>

</body>

</html>

__________________

solar installers doncaster
Mermaid Beach Property Managers