var suncalc_updated var HA_for_calibrated_position,SetLocation,Lat,Lon,LatDir,LonDir var Calibrate_pulsevalue,Calibrate_pulse_per_ha_degree,calibrate_inc_direction,SatNameCurrentIndex,SitePosCurrentIndex var output_angles= new Array() var month_string= new Array() var autoupdate,SatLon,autoprintupdate,htmleclipsecalc_updated,orbital_period,rsat rsat=42164.57; //km orbital_period=2*Math.PI*Math.sqrt(rsat*rsat*rsat/398600.5)/(60*60*24); // in days //alert(orbital_period); month_string[1]="January"; month_string[2]="February"; month_string[3]="March"; month_string[4]="April"; month_string[5]="May"; month_string[6]="June"; month_string[7]="July"; month_string[8]="August"; month_string[9]="September"; month_string[10]="October"; month_string[11]="November"; month_string[12]="December"; autoupdate=0; autoprintupdate=0; eclipsecalc_updated="Calculator script updated 09-10-2006
"; htmleclipsecalc_updated="Updated 09 October 2006
"; //window.setInterval CalculateAngles(),5000 //window.setInterval "update()",1000,JavaScript function date_and_time(){ date_and_time=Date(); //alert(Date()); } function ShowCredit() { var credittext credittext="First uploaded 27092006 " credittext=credittext+"\nProgrammed by Jens T. Satre" credittext=credittext+"\nScript for satellite eclipse calculation" credittext=credittext+"\n2709-2006: First version, Javascript" credittext=credittext+"\n2809-2006: Some small fixes in satellite distance and earth radius" credittext=credittext+"\n0910-2006: Correction to orbital period of satellite (set to 23h56m05s)" alert(credittext); } function SelectSatellite() { // position in east format. document.OrbitPosition.Degrees.value=formatvalue(document.Satellite.Position.value,5); document.OrbitPosition.West_angle.value=formatvalue((360-document.OrbitPosition.Degrees.value),5); document.OrbitPosition.Direction.value="East"; } function doublefigure(number) { if (number<10) number="0"+number; return(number) } function convert_date_time_to_UTC_offet(dateandtimeinput) { var Hour,Minute,Second,Month,Day,Year,formatteddate,timeoffset today = new Date(); today=dateandtimeinput; Hour= today.getHours() ; Minute=today.getMinutes() ; Second=today.getSeconds() ; Month= today.getMonth()+1; Day= today.getDate() ; Year= today.getFullYear(); timeoffset=today.getTimezoneOffset()/60; if (timeoffset>0) formatteddate=doublefigure(Day)+"."+doublefigure(Month)+"."+Year+" "+doublefigure(Hour)+":"+doublefigure(Minute)+":"+doublefigure(Second)+" UTC"+(-1*timeoffset) else formatteddate=doublefigure(Day)+"."+doublefigure(Month)+"."+Year+" "+doublefigure(Hour)+":"+doublefigure(Minute)+":"+doublefigure(Second)+" UTC+"+(-1*timeoffset); return(formatteddate); } function printtodayseclipse(SatLon) { var d,Day,Month,Year,Hour,Minute,Seconds var SunAltitude,ElevationDifference var beta,T_orbit_period,r_earth,r_sat,t,R var satellite_time,start_eclipse,end_eclipse,total_eclipse,west_position,d_now,Hour,Second,Minute var printout,last_total_eclipse,printlinebreak,Dayoftheyear,d_new_year var ValArray=new Array(); var SubArray=new Array(); SitePosCurrentIndex =1073 ; // Used only if there are not any cookie stored //SatNameCurrentIndex =40 ; start_eclipse= new Date(); end_eclipse= new Date(); r_earth=6378.14; //km //r_sat=42241; //km r_sat=42164.57; //km today = new Date(); Day=today.getUTCDate(); Month=today.getUTCMonth()+1; Year=today.getUTCFullYear(); Hour= today.getUTCHours() ; Minute=today.getMinutes() ; Second=today.getSeconds() ; d_now=daynumber(Day,Month,Year,Hour,Minute,Second); d_new_year=daynumber(1,1,Year,0,0,0); //alert(d_new_year); d=daynumber(Day,Month,Year,0,0,0); R=r_earth/r_sat; // satellite_time = 0 deg. = 00:00 ,90 deg.=06:00, 180 deg. = 12:00, 270 deg. = 18:00 satellite_time=Rev(SatLon)*(24/360)/24; // ok in days & UTC west_position=SatLon; d=Math.floor(d); d=d+satellite_time; //document.Angles.SunDeclination.value=Deg(sun_decl(d)); // i radianer beta=sun_decl(d); //printout=" Upcoming satellite earth shadow eclipses (Start time - end time - total eclipsed time) :"; printout=""; printout=printout+""; t= Math.acos( Math.sqrt(1-R*R)/Math.cos(beta) ) * (orbital_period/Math.PI) ; // ok ,in days so far so good //alert(t); // two periodes from 1.September-15 Oktober and from 27. Februar -12 April if ((d-d_new_year)<104) printout=printout+"" else printout=printout+""; start_eclipse=d-t/2; end_eclipse=d+t/2; total_eclipse=t; //if time passed show next days eclipse //d=d-1; if (end_eclipse0)&&(Math.floor(d)%2==0)) printout=printout+""; else if (total_eclipse>0) printout=printout+""; //if ((isNaN(total_eclipse))&&(last_total_eclipse>0)) printout=printout+"
"; if ((isNaN(total_eclipse))&&(last_total_eclipse>0)) { if ((d-d_new_year)>180) printout=printout+"" else printout=printout+""; } last_total_eclipse=total_eclipse; for (i = 1; i <= 370; i++) { d =d+1; //d=daynumber(Day,Month,Year,0,0,0); R=r_earth/r_sat; satellite_time=Rev(SatLon)*(24/360)/24; // ok in days west_position=SatLon; d=Math.floor(d); d=d+satellite_time; beta=sun_decl(d); t= Math.acos( Math.sqrt(1-R*R)/Math.cos(beta) ) * (orbital_period/Math.PI) ; // ok ,in days so far so good // two periodes from 1.September-15 Oktober and from 27. Februar -12 April start_eclipse=d-t/2; end_eclipse=d+t/2; total_eclipse=t; // if (total_eclipse>0) printout=printout+"
From "+convert_date_time_to_UTC_offet(d_to_date_and_time(start_eclipse))+" to "+convert_date_time_to_UTC_offet(d_to_date_and_time(end_eclipse))+" duration:"+d_to_hms(total_eclipse)+" SatMidnight:"+convert_date_time_to_UTC_offet(d_to_date_and_time(d)); //if (total_eclipse>0) printout=printout+""; if ((total_eclipse>0)&&(Math.floor(d)%2==0)) printout=printout+""; else if (total_eclipse>0) printout=printout+""; // if ((isNaN(total_eclipse))&&(last_total_eclipse>0)) printout=printout+""; if ((isNaN(total_eclipse))&&(last_total_eclipse>0)) { if ((d-d_new_year)>180) printout=printout+"" else printout=printout+""; } last_total_eclipse=total_eclipse; //alert(t); } printout=printout+"
Upcoming satellite earth shadow eclipses:
StartEndDurationSatMidnight
-----SPRING ECLIPSE FOLLOWS---
-----FALL ECLIPSE FOLLOWS---
"+convert_date_time_to_UTC_offet(d_to_date_and_time(start_eclipse))+""+convert_date_time_to_UTC_offet(d_to_date_and_time(end_eclipse))+""+d_to_hms(total_eclipse)+""+convert_date_time_to_UTC_offet(d_to_date_and_time(d))+"
"+convert_date_time_to_UTC_offet(d_to_date_and_time(start_eclipse))+""+convert_date_time_to_UTC_offet(d_to_date_and_time(end_eclipse))+""+d_to_hms(total_eclipse)+""+convert_date_time_to_UTC_offet(d_to_date_and_time(d))+"
-----SPRING ECLIPSE FOLLOWS---
-----FALL ECLIPSE FOLLOWS---
"+convert_date_time_to_UTC_offet(d_to_date_and_time(start_eclipse))+""+convert_date_time_to_UTC_offet(d_to_date_and_time(end_eclipse))+""+d_to_hms(total_eclipse)+""+convert_date_time_to_UTC_offet(d_to_date_and_time(d))+"
"+convert_date_time_to_UTC_offet(d_to_date_and_time(start_eclipse))+""+convert_date_time_to_UTC_offet(d_to_date_and_time(end_eclipse))+""+d_to_hms(total_eclipse)+""+convert_date_time_to_UTC_offet(d_to_date_and_time(d))+"
"+convert_date_time_to_UTC_offet(d_to_date_and_time(start_eclipse))+""+convert_date_time_to_UTC_offet(d_to_date_and_time(end_eclipse))+""+d_to_hms(total_eclipse)+""+convert_date_time_to_UTC_offet(d_to_date_and_time(d))+"
-----SPRING ECLIPSE FOLLOWS---
-----FALL ECLIPSE FOLLOWS---
"; //printout=printout+"

NOTE: Based on current Satellite Longitude - inclination not accounted for !"; return(printout ); } function CheckIfEclipseNow(SatLon,r_sat,SatLat) { var d,Day,Month,Year,Hour,Minute,Seconds var SunAltitude,ElevationDifference var beta,T_orbit_period,r_earth,r_sat,t,R var satellite_time,start_eclipse,end_eclipse,total_eclipse,west_position,d_now,Hour,Second,Minute var printout,last_total_eclipse,printlinebreak,eclipsenow,timeoffset,Eclipse_date,fraction_of_the_day eclipsenow=-1; r_earth=6378.14; //km //r_sat=42241; //km //r_sat=42164.57; //km today = new Date(); satellite_time=Rev(SatLon)*(24/360)/24; // ok in days /* Day=today.getDate(); Month=today.getMonth()+1; Year=today.getFullYear(); Hour= today.getHours() ; Minute=today.getMinutes() ; Second=today.getSeconds() ; */ Day=today.getUTCDate(); Month=today.getUTCMonth()+1; Year=today.getUTCFullYear(); Hour= today.getUTCHours() ; Hour= today.getUTCHours() ; Minute=today.getUTCMinutes() ; Second=today.getUTCSeconds() ; d_now=daynumber(Day,Month,Year,Hour,Minute,Second); d=daynumber(Day,Month,Year,00,00,00); // finn for lokal dag R=r_earth/r_sat; d=Math.floor(d); d=d+satellite_time; // d= midnight UTC maximum sun eclipse time for calculating sun declination beta=sun_decl(d); // sun declination beta=sun_decl(d)+Radians(SatLat); // compensate status now for satellite latitude t= Math.acos( Math.sqrt(1-R*R)/Math.cos(beta) ) * (orbital_period/Math.PI) ; // ok ,in days so far so good start_eclipse=d-t/2; end_eclipse=d+t/2; total_eclipse=t; if ((start_eclipsed_now)) { eclipsenow=1; //start_eclipse } // i UTC //alert("start_eclipse: "+d_to_date_and_time_utc(start_eclipse)+" startec:"+start_eclipse+"\r\nd_now: "+d_to_date_and_time_utc(d_now)+" d_now: "+d_now+"\r\nend_eclipse: "+d_to_date_and_time_utc(end_eclipse)+" endtec:"+end_eclipse+"\r\neclipse date:"+d_to_date_and_time_utc(d)+"\r\n Sat time:"+satellite_time+" "+d_to_hms(satellite_time)+"\r\n fraction_of_the_day:"+1*fraction_of_the_day); return(eclipsenow); } function GetSunBetaAngle(SatLon) { var d,Day,Month,Year,Hour,Minute,Seconds var SunAltitude,ElevationDifference var beta,T_orbit_period,r_earth,r_sat,t,R var satellite_time,start_eclipse,end_eclipse,total_eclipse,west_position,d_now,Hour,Second,Minute var printout,last_total_eclipse,printlinebreak,eclipsenow,sunbeta r_earth=6378.14; //km //r_sat=42241; //km r_sat=42164.57; //km today = new Date(); Day=today.getUTCDate(); Month=today.getUTCMonth()+1; Year=today.getUTCFullYear(); Hour= today.getUTCHours() ; Minute=today.getMinutes() ; Second=today.getSeconds() ; d_now=daynumber(Day,Month,Year,Hour,Minute,Second); d=daynumber(Day,Month,Year,0,0,0); R=r_earth/r_sat; // satellite_time = 0 deg. = 00:00 ,90 deg.=06:00, 180 deg. = 12:00, 270 deg. = 18:00 satellite_time=Rev(SatLon)*(24/360)/24; // ok in days west_position=SatLon; d=Math.floor(d); d=d+satellite_time; beta=sun_decl(d); // sun declination t= Math.acos( Math.sqrt(1-R*R)/Math.cos(beta) ) * (orbital_period/Math.PI) ; // ok ,in days so far so good sunbeta=Deg(beta); start_eclipse=d-t/2; end_eclipse=d+t/2; total_eclipse=t; //if ((start_eclipsed_now)) // { // eclipsenow=1; //start_eclipse // } return(formatnumber(sunbeta,3)); } function GetCorrectedBetaAngle(SatLon,SatLat) { var d,Day,Month,Year,Hour,Minute,Seconds var SunAltitude,ElevationDifference var beta,T_orbit_period,r_earth,r_sat,t,R var satellite_time,start_eclipse,end_eclipse,total_eclipse,west_position,d_now,Hour,Second,Minute var printout,last_total_eclipse,printlinebreak,eclipsenow,sunbeta r_earth=6378.14; //km //r_sat=42241; //km r_sat=42164.57; //km today = new Date(); Day=today.getUTCDate(); Month=today.getUTCMonth()+1; Year=today.getUTCFullYear(); Hour= today.getUTCHours() ; Minute=today.getMinutes() ; Second=today.getSeconds() ; d_now=daynumber(Day,Month,Year,Hour,Minute,Second); d=daynumber(Day,Month,Year,0,0,0); R=r_earth/r_sat; // satellite_time = 0 deg. = 00:00 ,90 deg.=06:00, 180 deg. = 12:00, 270 deg. = 18:00 satellite_time=Rev(SatLon)*(24/360)/24; // ok in days west_position=SatLon; d=Math.floor(d); d=d+satellite_time; beta=sun_decl(d)+Radians(SatLat); // sun declination t= Math.acos( Math.sqrt(1-R*R)/Math.cos(beta) ) * (orbital_period/Math.PI) ; // ok ,in days so far so good sunbeta=Deg(beta); start_eclipse=d-t/2; end_eclipse=d+t/2; total_eclipse=t; //if ((start_eclipsed_now)) // { // eclipsenow=1; //start_eclipse // } return(formatnumber(sunbeta,3)); } function printallpositionsforselecteddate(){ var d,Day,Month,Year,Hour,Minute,Seconds var SunAltitude,ElevationDifference var beta,T_orbit_period,r_earth,r_sat,t,R,NextDay var satellite_time,start_eclipse,end_eclipse,total_eclipse r_earth=6378.14; //km //r_sat=42241; //km r_sat=42164.57; //km Day=1*document.TimeAndDate.Day.value; Month=1*document.TimeAndDate.Month.value; Year=1*document.TimeAndDate.Year.value; d=daynumber(Day,Month,Year,0,0,0); R=r_earth/r_sat; NextDay=Day+1; // satellite_time = 0 deg. = 00:00 ,90 deg.=06:00, 180 deg. = 12:00, 270 deg. = 18:00 //alert(d_to_date_and_time(start_eclipse)); listing="" listing+="" listing+="" listing+="" listing+="Satellite Eclipse" listing+="" listing+="" listing+=""; listing+="

 

"; listing+="
Eclipse for "+Day+"&"+NextDay+" "+month_string[Month]+" "+Year+"
" listing+="
"; listing+="" listing+=""; listing+=""; listing+=""; listing+=""; listing+=""; listing+=""; listing+=""; for (i = 1; i <= 360; i++) { west_position=360-i; satellite_time=Rev(360-i)*(24/360)/24; // ok in days d=Math.floor(d); d=d+satellite_time; document.Angles.SunDeclination.value=Deg(sun_decl(d)); // i radianer beta=sun_decl(d); //alert(orbital_period); // in days t= Math.acos( Math.sqrt(1-R*R)/Math.cos(beta) ) * (orbital_period/Math.PI) ; // ok ,in days so far so good // two periodes from 1.September-15 Oktober and from 27. Februar -12 April start_eclipse=d-t/2; end_eclipse=d+t/2; total_eclipse=t; listing+=""; listing+=""; listing+=""; listing+=""; listing+=""; listing+=""; listing+=""; } listing+="
" listing+="
" listing+="
" listing+="
" listing+="
" listing+="
PositionStart timeEnd timeMiddle timeDuration
"+i+" East ("+west_position+" West)"+d_to_date_and_time(start_eclipse)+""+d_to_date_and_time(end_eclipse)+""+d_to_date_and_time(d)+""+d_to_hms(total_eclipse)+"
"; listing+="

©"+Year+" Jens T. Satre

"; listing+="" PrintWindow=window.open("","Print_window") //PrintWindow =window.open("","Print_window","menubar=yes,status=yes,toolbar=yes,scrollbars=yes"); //height=800,width=1000 PrintWindow.oldWindow = top //PrintWindow.document.write(document.Output.Satpos.value) PrintWindow.document.write(listing) PrintWindow.document.close() } function printyearforselectedsatellite(){ var d,Day,Month,Year,Hour,Minute,Seconds var SunAltitude,ElevationDifference var beta,T_orbit_period,r_earth,r_sat,t,R var satellite_time,start_eclipse,end_eclipse,total_eclipse,i,last_d r_earth=6378.14; //km //r_sat=42241; //km r_sat=42164.57; //km Day=1*document.TimeAndDate.Day.value; Month=1*document.TimeAndDate.Month.value; Year=1*document.TimeAndDate.Year.value; d=daynumber(1,1,Year,0,0,0); R=r_earth/r_sat; // satellite_time = 0 deg. = 00:00 ,90 deg.=06:00, 180 deg. = 12:00, 270 deg. = 18:00 //alert(d_to_date_and_time(start_eclipse)); listing="" listing+="" listing+="" listing+="" listing+="Satellite Eclipse" listing+="" listing+="" //listing+="" listing+=""; listing+="

 

"; listing+="
Eclipse for Satellite Position "+document.OrbitPosition.Degrees.value+" East ("+document.OrbitPosition.West_angle.value+" West)
" listing+="
"; listing+="" //listing+="
Start time: "+d_to_date_and_time(start_eclipse)+"
" //listing+="
End time: "+d_to_date_and_time(end_eclipse)+"
" //listing+="
Total eclipse period: "+d_to_hms(total_eclipse)+"
" listing+=""; listing+=""; listing+=""; listing+=""; listing+=""; listing+=""; for (i = 0; i <= 366; i++) { d=daynumber(1,1,Year,0,0,0); satellite_time=Rev(document.OrbitPosition.West_angle.value)*(24/360)/24; // ok in days d=Math.floor(d)+i; d=d+satellite_time; document.Angles.SunDeclination.value=Deg(sun_decl(d)); // i radianer beta=sun_decl(d); t= Math.acos( Math.sqrt(1-R*R)/Math.cos(beta) ) * (orbital_period/Math.PI) ; // ok ,in days so far so good //alert(t); // two periodes from 1.September-15 Oktober and from 27. Februar -12 April start_eclipse=d-t/2; end_eclipse=d+t/2; total_eclipse=t; // if (i==20) { // listing+=""; // listing+=""; // listing+=""; // listing+=""; // listing+=""; // listing+=""; // } if (i==180) { listing+=""; listing+=""; listing+=""; listing+=""; listing+=""; listing+=""; } if (total_eclipse>0) { listing+=""; listing+=""; listing+=""; listing+=""; listing+=""; listing+=""; } } last_d=d; listing+="
" listing+="
" //listing+="
Satellite Position:"+document.Angles.SatelliteLongitude.value+"
" listing+="
" //listing+="
Sun/Satellite Azimuth:"+document.Angles.SunAzimuth.value+" °
" //listing+="
Sun Elevation:"+document.Angles.SunElevation.value+" °
" listing+="
" //listing+="
Satellite Elevation:"+document.Angles.SatelliteElevation.value+" °
" listing+="
" //listing+="
|Satellite Elevation-Sun Elevation|:"+document.Angles.SunSatElDifference.value+" °
" listing+="
Start timeEnd timeMiddle timeDuration
-
-
-
-
"+d_to_date_and_time(start_eclipse)+""+d_to_date_and_time(end_eclipse)+""+d_to_date_and_time(d)+""+d_to_hms(total_eclipse)+"
"; listing+="

©"+Year+" Jens T. Satre

"; listing+=""; PrintWindow=window.open("","Print_window") //PrintWindow =window.open("","Print_window","menubar=yes,status=yes,toolbar=yes,scrollbars=yes,height=best-fit,width=best-fit"); PrintWindow.oldWindow = top //PrintWindow.document.write(document.Output.Satpos.value) PrintWindow.document.write(listing) PrintWindow.document.close() } function CalculateAngles(){ var d,Day,Month,Year,Hour,Minute,Seconds var SunAltitude,ElevationDifference var beta,T_orbit_period,r_earth,r_sat,t,R var satellite_time,start_eclipse,end_eclipse,total_eclipse r_earth=6378.14; //km //r_sat=42241; //km r_sat=42164.57; //km Day=1*document.TimeAndDate.Day.value; Month=1*document.TimeAndDate.Month.value; Year=1*document.TimeAndDate.Year.value; d=daynumber(Day,Month,Year,0,0,0); R=r_earth/r_sat; // satellite_time = 0 deg. = 00:00 ,90 deg.=06:00, 180 deg. = 12:00, 270 deg. = 18:00 satellite_time=Rev(document.OrbitPosition.West_angle.value)*(24/360)/24; // ok in days d=Math.floor(d); d=d+satellite_time; document.Angles.SunDeclination.value=Deg(sun_decl(d)); // i radianer /* beta=sun_decl(d); t= Math.acos(Math.sqrt(1-R*R)/Math.cos(beta) ) * (1/Math.PI) ; // ok ,in days so far so good //alert(t); // two periodes from 1.September-15 Oktober and from 27. Februar -12 April start_eclipse=d-t/2; end_eclipse=d+t/2; total_eclipse=t; //alert(d_to_date_and_time(start_eclipse)); listing="" listing+="" listing+="" listing+="" listing+="Satellite Eclipse" listing+="" listing+="" listing+="" listing+="
Start time:"+d_to_date_and_time(start_eclipse)+"
" listing+="
End time:"+d_to_date_and_time(end_eclipse)+"
" listing+="Middle time:"+d_to_date_and_time(d)+""; listing+="
Total period:"+d_to_hms(total_eclipse)+"
" listing+="
" listing+="
" //listing+="
Satellite Position:"+document.Angles.SatelliteLongitude.value+"
" listing+="
" //listing+="
Sun/Satellite Azimuth:"+document.Angles.SunAzimuth.value+" °
" //listing+="
Sun Elevation:"+document.Angles.SunElevation.value+" °
" listing+="
" //listing+="
Satellite Elevation:"+document.Angles.SatelliteElevation.value+" °
" listing+="
" //listing+="
|Satellite Elevation-Sun Elevation|:"+document.Angles.SunSatElDifference.value+" °
" listing+="" PrintWindow=window.open("","Print_window") //PrintWindow =window.open("","Print_window","menubar=yes,status=yes,toolbar=yes,scrollbars=yes"); //height=800,width=1000 PrintWindow.oldWindow = top //PrintWindow.document.write(document.Output.Satpos.value) PrintWindow.document.write(listing) PrintWindow.document.close() */ return(t); } function set_todays_date(){ var today,Day,Month,Year,Hour,Minute,Seconds today = new Date(); Month= today.getMonth()+1; Day= today.getDate() ; Year= today.getUTCFullYear(); Hour=today.getUTCHours(); Minute=today.getUTCMinutes(); Seconds=today.getUTCSeconds(); document.TimeAndDate.Day.value=Day; document.TimeAndDate.Month.value=Month; document.TimeAndDate.Year.value=Year; } function d_to_date_and_time(d) { var today,t var MinMilli = 1000 * 60; var HrMilli = MinMilli * 60; var DyMilli = HrMilli * 24; today = new Date(); // d+10956= Date() format //window.alert('d= '+d ); d=d+10956; d*DyMilli; today.setTime(d*DyMilli); //t=((today.getTime()/DyMilli)-10956); //window.alert('t= '+t ); time_offset=today.getTimezoneOffset() ; Hour= today.getUTCHours() ; Minute=today.getUTCMinutes() ; Second=today.getUTCSeconds() ; Month= today.getUTCMonth()+1; Day= today.getUTCDate() ; Year= today.getUTCFullYear(); return(today) } function d_to_date_and_time_utc(d) { var today,t var MinMilli = 1000 * 60; var HrMilli = MinMilli * 60; var DyMilli = HrMilli * 24; today = new Date(); // d+10956= Date() format //window.alert('d= '+d ); d=d+10956; d*DyMilli; today.setTime(d*DyMilli); //t=((today.getTime()/DyMilli)-10956); //window.alert('t= '+t ); time_offset=today.getTimezoneOffset() ; Hour= today.getUTCHours() ; Minute=today.getUTCMinutes() ; Second=today.getUTCSeconds() ; Month= today.getUTCMonth()+1; Day= today.getUTCDate() ; Year= today.getUTCFullYear(); return(Day+"."+Month+"."+Year+" "+Hour+":"+Minute+":"+Second) } function d_to_hms(d) { var today,t var MinMilli = 1000 * 60; var HrMilli = MinMilli * 60; var DyMilli = HrMilli * 24; var return_string today = new Date(); // d+10956= Date() format //window.alert('d= '+d ); d=d+10956; d*DyMilli; today.setTime(d*DyMilli); //t=((today.getTime()/DyMilli)-10956); //window.alert('t= '+t ); time_offset=today.getTimezoneOffset() ; Hour= today.getUTCHours() ; Minute=today.getUTCMinutes() ; Second=today.getUTCSeconds() ; Month= today.getUTCMonth()+1; Day= today.getUTCDate() ; Year= today.getUTCFullYear(); if (Hour<10) Hour='0'+Hour; if (Minute<10) Minute='0'+Minute; if (Second<10) Second='0'+Second; return_string=Hour+'h'+Minute+'m'+Second+'s'; return(return_string) } // get the time for more days, function sun_decl(d){ // adjust sat decl for latitude ? var SunSouth,HourAngle,SIDEREALTIME,SatAz,SunSat,Tst,SatelliteAzimuth,pi,NewRA var w,a,e,M,L,oblecl,E,x,y,r,v,sunlon,z,xequat,yequat,zequat,RA,Decl,GMST0,UT,SIDTIME,HA var SunElevation,xhor,yhor,zhor,SunSatElevationDifference,SatElevation,GeometricElevation pi=Math.PI; var angles= new Array(); //*********CALCULATE SUN DATA ********************* w=282.9404 + 4.70935E-5 * d ; //OK a=1; e= 0.016709 - 1.151E-9 *d ; M= 356.0470 + 0.9856002585 * d; oblecl=23.4393 -3.563E-7 * d ; L=w+Rev(M); L=Rev(L); E=M+ (180/pi)*e*Math.sin(Radians(M))*( 1+e * Math.cos(Radians(M)) ); E=Rev(E); // OK x= Math.cos(Radians(E)) -e ; y= Math.sin(Radians(Rev(E)))*Math.sqrt(1-e*e); r=Math.sqrt(x*x+y*y); v=Deg(Math.atan2(y,x)); sunlon=Rev(v+w); // trolig ok x=r*Math.cos(Radians(sunlon)); y=r*Math.sin(Radians(sunlon)); z=0; xequat=x; yequat=y*Math.cos(Radians(oblecl)) +z*Math.sin(Radians(oblecl)); zequat=y*Math.sin(Radians(oblecl)) +z*Math.cos(Radians(oblecl)); RA=Rev(Deg(Math.atan2(yequat,xequat))); // OK Decl=Math.atan2(zequat,Math.sqrt(xequat*xequat + yequat*yequat ) ); // trolig OK return(Decl); } //********WORKS OK function SetCookie() { var CookieValue var MyCookieVal var ValArray=new Array(); var SubArray=new Array(); SitePosCurrentIndex =1073 ; // Used only if there are not any cookie stored //SatNameCurrentIndex =40 ; MyCookieVal=document.cookie; //alert(MyCookieVal); if (MyCookieVal !== "") // If cookie has value then set users defaults { ValArray=MyCookieVal.split(":"); //' Reads 6 cookie values in to the array Lat=ValArray[0]; LatDir=ValArray[1]; Lon=ValArray[2]; LonDir=ValArray[3]; SitePosCurrentIndex=ValArray[4]; SatNameCurrentIndex=ValArray[5]; SetLocation= ValArray[6]; Calibrate_pulsevalue=ValArray[7]; Calibrate_pulse_per_ha_degree=ValArray[8]; calibrate_inc_direction=ValArray[9]; HA_for_calibrated_position=ValArray[10]; } SatNameCurrentIndex=document.Satellite.Position.selectedIndex; CookieValue=Lat+":"+LatDir+":"+Lon+":"+LonDir+":"+SitePosCurrentIndex+":"+SatNameCurrentIndex+":"+SetLocation+":"+Calibrate_pulsevalue+":"+Calibrate_pulse_per_ha_degree+":"+calibrate_inc_direction+":"+HA_for_calibrated_position+";expires=Tue, 10 Jul 2040 23:59:59 UTC;"; document.cookie =CookieValue ; // Store cookie } function ReadCookie() { var CookieValue,MyCookieVal var ValArray=new Array(); var SubArray=new Array(); SitePosCurrentIndex =1073 ; // Used only if there are not any cookie stored //SatNameCurrentIndex =40 ; MyCookieVal=document.cookie; //alert(MyCookieVal); if (MyCookieVal !== "") // If cookie has value then set users defaults { ValArray=MyCookieVal.split(":"); //' Reads 6 cookie values in to the array Lat=ValArray[0]; LatDir=ValArray[1]; Lon=ValArray[2]; LonDir=ValArray[3]; SitePosCurrentIndex=ValArray[4]; SatNameCurrentIndex=ValArray[5]; SetLocation= ValArray[6]; Calibrate_pulsevalue=ValArray[7]; Calibrate_pulse_per_ha_degree=ValArray[8]; calibrate_inc_direction=ValArray[9]; HA_for_calibrated_position=ValArray[10]; } document.Satellite.Position.selectedIndex=SatNameCurrentIndex; // ok } // end function function Rev(number) { var x x= number -Math.floor(number/360.0)*360 ; return(x) } function Radians(number) { var rad rad=number*Math.PI/180; return(rad) } function Deg(number) { var rad rad=number*180/Math.PI; return(rad) } function daynumber(Day,Month,Year,Hour,Minute,Second) { //window.alert(Day+" "+Month+" "+Year+" "+Hour+" "+Minute+" "+Second); d=367*Year - Div( (7*(Year+(Div((Month+9),12)))),4 ) + Div((275*Month),9) + Day - 730530 // d is correct //window.alert(d); d=d+ Hour/24 + Minute/(60*24) + Second/(24*60*60) // OK return(d) } function Div(a,b) { return((a-a%b)/b) //OK } function formatvalue(input, rsize) // Desimal avrunding { var invalid = "**************************"; var nines = "999999999999999999999999"; var strin = "" + input; var fltin = parseFloat(strin); if (strin.length <= rsize) return strin; if (strin.indexOf("e") != -1 || fltin > parseFloat(nines.substring(0,rsize)+".4")) return invalid.substring(0, rsize); var rounded = "" + (fltin + (fltin - parseFloat(strin.substring(0, rsize)))); return rounded.substring(0, rsize); }