SolarZenith functions correctly. I have tried two different loops and neither produce the right answer.

I have tried placing the "return Sunrise1" right after "Sunrise1 = hrr + "." + mnr;" and it produces "undefined" in the textbox.

How do I get a loop to be able to save an variable till the loop is concluded?

Code:
function SunRise(mo, dy, yr, hr, mn, timezone, dst, lon, lat){
    var Twi = 90.8333333333333;var t = 0;
    do{
    	hr = Math.floor(t / 60);
    	mn = t - 60 * hr;
        solarzen = SolarZenith(mo, dy, yr, hr, mn, timezone, dst, lon, lat);
        if (solarzen < Twi){// Twilight
            //Light
            if (a1 = 0){
               var a1 = 1;
               var hrr = hr;
               if (mn < 10){mn = "0" + mn}
               var mnr = mn;
				SunRise1 = hrr + ":" + mnr;
			}//end if
		}//end if
    t++;
	}while (a1 = 0);
    return SunRise1;
}//End Function