function get_sunrise(todays_date, rise){
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Javascript function to calculate sunrise and sunset  +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++

//Calculate day of year
var sinDec,cosDec ;
var Deg2rads = 3.14159/180 ;

var tz_offset = todays_date.getTimezoneOffset() ;
var year_val = todays_date.getFullYear() ;				// this year
var day1_val = new Date(year_val,0,1) ;					// first day of this year

var t1 = todays_date.getTime() ;						// today in Seconds
var t2 = day1_val.getTime() ;							// first day of year in milliseconds
var day_of_year = ((t1 - t2)/(86400000)) + 1; 			// days since Jan 1 

// calculate longitude hour

var longitude = -121.0833 ;								// El Dorado Hills Coordinates
var latitude = 38.7000 ;									//Latitude 38° 41' 8" North, 
														//Longitude -121° 4' 55" West
var longHours = longitude/15 ; 							// (360/24) = 15

if(rise){
var rtime = day_of_year + ((6 - longHours)/24) ;
}else{
var rtime = day_of_year + ((18 - longHours)/24) ;
}

var M = (.9856 * rtime) - 3.289 ;						// pointer for equation of time adjustment
var Mrad = M*(Deg2rads) ;			     				// Convert to radians

var TrueLong = M + (1.916 * Math.sin(Mrad)) + (.02 * Math.sin(2 * Mrad)) + 282.634 ;
if (TrueLong > 360) TrueLong -= 360 ;
	

var RA = (Math.atan(.91764 * Math.tan(TrueLong * Deg2rads)))/Deg2rads ;

var LQuad = (Math.floor(TrueLong/90)) * 90;
var RQuad = (Math.floor(RA/90)) * 90;
RA = (RA + (LQuad - RQuad))/15 ;


sinDec = .39782 * Math.sin(TrueLong*Deg2rads) ;
cosDec = Math.cos(Math.asin(sinDec)) ;
var cos_H = (-0.014 - (sinDec * Math.sin(latitude*Deg2rads)))/(cosDec * Math.cos(latitude*Deg2rads)) ;
if (cos_H > 1) alert("Error 01") ;
if (cos_H < -1) alert("Error 02") ;

if(rise){
var H = 360 - Math.acos(cos_H)/Deg2rads ;
}else{
var H = Math.acos(cos_H)/Deg2rads ;
}

H = H/15 ;

var T_time = H + RA -(.06571 * rtime) - 6.622 ;
T_time = T_time - longHours - tz_offset/60 ;

if(T_time > 24) T_time -= 24 ;
if(T_time < 0 ) T_time +=24 ;
var thrs = Math.floor(T_time) ;
var tmins = Math.floor((T_time - thrs)*60) ;
if (tmins < 10) tmins = "0" + tmins ;

//document.write("rtime = " + rtime) ;
//document.write("\n<BR>M = " + M + ", " + Mrad) ;
//document.write("\n<BR>True Long. (L) = " + TrueLong) ;
//document.write("\n<BR>RA = " + RA) ;
//document.write("<BR>Risetime = " + thrs + ":" + tmins.toPrecision(2)) ;
return thrs + ":" + tmins;
}