// without beginning special symbol = mainmenu
// % submenu separator
// * subsubmenu separator

//var root="/astro/";
var root="/";
var hroot="http://jareksastro.org/";

var tbbb=2;
var bgActiveC="#FFCB6A";
var bgTopandSide="#6699FF";
var bgMiddle="#66CCFF";
var pgActive;
var dirprefix="";

if(navigator.appName=="Netscape")tbbb=0;
var menutable= new Array(

"Home|index.htm|1"+
"%What's new|news.htm|1",

"Observatory|observatory.htm|1"+
"%Building the observatory|obs_build.htm|1",

"Equipment|equipment.htm|1"+
"%Telescopes|telescopes.htm|1"+
"*Celestron CGE1400|telescopesCGE1400.htm|1"+
"*Celestron C80ED|telescopesC80ED.htm|1"+
"*Orion SkyQuest 4.5|telescopesO45.htm|1"+
"*Coronado PST|telescopesPST.htm|1"+
"*Obsession 18\"|telescopesObs18.htm|1"+
"*Orion 10\"|telescopesOrion10.htm|1"+
"*|javascript:void(0);|1"+
"*|javascript:void(0);|1"+
"*<i>Antares XT10</i>|telescopesAXT10.htm|1"+
"*<i>Celestron C9.25-SGT</i>|telescopesC925.htm|1"+
"%Eyepieces|eyepieces.htm|1"+
"%Accessories|othereq.htm|1",

"Astrophotography|astrophoto.htm|1"+
"%Solar system|PLo.htm|1"+
"*All pictures|PL.htm|1"+
"%Moon, high resolution|Moon.htm|1"+
"%|javascript:void(0);|1"+
"%|javascript:void(0);|1"+
"%Bright Nebulae|BNo.htm|1"+
"*All pictures|BN.htm|1"+
"%Galaxies|GXo.htm|1"+
"*All pictures|GX.htm|1"+
"%Globular Clusters|GCo.htm|1"+
"*All pictures|GC.htm|1"+
"%Open Clusters|OCo.htm|1"+
"*All pictures|OC.htm|1"+
"%Planetary nebulae|PNo.htm|1"+
"*All pictures|PN.htm|1"+
"%Wide field|galleryw.htm|1"+
"%Narrowband|gallerynb.htm|1"+
"%|javascript:void(0);|1"+
"%|javascript:void(0);|1"+
"%Messier objects|gallerym.htm|1"+
"%NGC objects|galleryn.htm|1"+
"%|javascript:void(0);|1"+
"%|javascript:void(0);|1"+
"%All objects|galleryo.htm|1"+
"%All pictures|gallery.htm|1",
//"%More Details|details.htm|1",

"Video|video.htm|1",

"Resources|resources.htm|1" +
"%Light Pollution|lpmap/IthacaLP.html|1"+
"%|javascript:void(0);|1"+
"%|javascript:void(0);|1"+
"%Books & Magazines|resources_books.htm|1"+
"*General & observing|resources_books1.htm|1"+
"*Science & popular science|resources_books2.htm|1"+
"*Sky atlases|resources_books3.htm|1"+
"*Technical & optics|resources_books4.htm|1"+
"*Astrophotography|resources_books5.htm|1"+
"%Internet|resources_web.htm|1",

"Moon Calendar|cal.htm|1",

"Cloud Cover|astro/weather_s.htm|1",

"Various|various.htm|1");


var status=0;
var i1_pos=0, i2_pos=0, popupHandle;

function make_stat(key){
if(key=="")
{
status=-1;
return;
}
for(i=0; i<menutable.length; i++){
  if(menutable[i].split("%")[0].split("*")[0].split("|")[1]==key){
   status=10000*i;
   return;
   }
  for(j=1; j<menutable[i].split("%").length; j++){
   if(menutable[i].split("%")[j].split("*")[0].split("|")[1]==key){
    status=10000*i+100*j;
    return;
    }
   for(k=1; k<menutable[i].split("%")[j].split("*").length; k++){
    if(menutable[i].split("%")[j].split("*")[k].split("|")[1]==key){
     status=10000*i+100*j+k;
     return;
     }
    }
   } 
  }
status=0;
alert("ERROR in index "+key); 
}

function load_page(stat,act){
stat1=(stat-stat%10000)/10000;
stat2=stat-stat1*10000;
stat2=(stat2-stat2%100)/100;
stat3=stat-stat2*100-stat1*10000;
tmph=root+menutable[stat1].split("%")[stat2].split("*")[stat3].split("|")[1];
//tmph="/"+menutable[stat1].split("%")[stat2].split("*")[stat3].split("|")[1];
window.location=tmph;
}

function make_menu_bottom(){
 document.write("<p><hr><font size='2'>\n");
 document.write("<p align=\"center\">\n");
 for(i=0; i<menutable.length; i++){
  document.write("<a href='"+hroot+menutable[i].split("%")[0].split("*")[0].split("|")[1]+
   "'>"+menutable[i].split("%")[0].split("*")[0].split("|")[0]+"</a> | ");
  }
 document.write("<a href=\"javascript:open_contact_us('Contact',event)\">Contact me</a></font><p align='right'><font size='1'><b>© J. Pillardy 2004,2008</b>");
}

function make_menu_html(stat,func){
if(stat==-1)
{
stat1=-1;
stat2=-1;
stat3=-1;
}
else
{
stat1=(stat-stat%10000)/10000;
stat2=stat-stat1*10000;
stat2=(stat2-stat2%100)/100;
stat3=stat-stat2*100-stat1*10000;
}
//alert("stat="+stat+" "+stat1+" "+stat2+" "+stat3);
tempmenu='<table border="'+tbbb+'" borderColor="#66CCFF" borderColorDark="#66CCFF" borderColorLight="#66CCFF" width="100%" bgcolor="#66CCFF">';
for(i=0; i<menutable.length; i++){
 if(stat1!=i){
  tempmenu += 
        '<tr><td style="border: 1px solid blue" borderColor="blue" id="menu'+i*10000+'" width="100%" height="24"'+
        ' onmouseover="switchBackOn(this)" onmouseout="switchBackOff(this)"'+
        ' onclick="'+func+'('+i*10000+',1)">'+
        '<p align="center"><b><font size="4">'+menutable[i].split("%")[0].split("*")[0].split("|")[0]+
        '</font></b></p></td></tr>\n';
  }
 if(stat1==i){
  tempmenu += 
        '<tr><td bgColor="#66CCFF" bordercolor="blue" style="border: 1px solid blue" >'+
        '<table border="'+tbbb+'" bgColor="#66CCFF" borderColor="#66CCFF" borderColorDark="#66CCFF" borderColorLight="#66CCFF" width="100%">' +
	'<tr><td bordercolor="yellow" style="border: 1px solid yellow"'+  
        ' id="menu'+i*10000+'" width="100%" height="24"'+
        ' onmouseover="switchBackOn(this)" onmouseout="switchBackOffs(this)"'+
        ' bgColor='+bgActiveC+' '+
        ' onclick="'+func+'('+i*10000+',1)">'+
        '<p align="center"><b><font size="4">'+menutable[i].split("%")[0].split("*")[0].split("|")[0]+
        '</font></b></p></td></tr>\n';
  for(j=1; j<menutable[i].split("%").length; j++){
   if(stat2!=j){
    if(menutable[i].split("%")[j].split("*")[0].split("|")[0] == ""){
      tempmenu += 
      '<tr><td bgColor="#66CCFF" bordercolor="black" style="border: 0px solid black" id="menu'+(i*10000+j*100)+'" width="100%" ></td></tr>\n'
    }
    else{
    tempmenu += 
      '<tr><td bgColor="#66CCFF" bordercolor="black" style="border: 1px solid black" id="menu'+(i*10000+j*100)+'" width="100%"'+
      ' onmouseover="switchBackOn(this)" onmouseout="switchBackOff(this)"'+
      ' onclick="'+func+'('+(i*10000+j*100)+',1)">'+
      '<p align="center"><font size="3">'+menutable[i].split("%")[j].split("*")[0].split("|")[0]+
      '</font></p></td></tr>\n'   
     }
    }
   if(stat2==j){ 
    tempmenu += 
      '<tr><td border=1 bgColor="#66CCFF" bordercolor="black" style="border: 1px solid black" >'+
      '<table bgColor="#66CCFF" border="'+tbbb+'" bordercolor="#66CCFF" width="100%"><tr><td bordercolor="orange" style="border: 1px solid orange"'+
      ' id="menu'+(i*10000+j*100)+'" width="100%"'+
      ' onmouseover="switchBackOn(this)" onmouseout="switchBackOffs(this)"'+
      ' bgColor='+bgActiveC+' '+
      ' onclick="'+func+'('+(i*10000+j*100)+',1)">'+
      '<p align="center"><font size="3">'+menutable[i].split("%")[j].split("*")[0].split("|")[0]+
      '</font></p></td></tr>\n'  
    for(k=1; k<menutable[i].split("%")[j].split("*").length; k++){
     if(stat3!=k){
      if(menutable[i].split("%")[j].split("*")[k].split("|")[0] == ""){
      tempmenu += 
       '<tr><td bgColor="#66CCFF" bordercolor=royalblue style="border: 0px solid royalblue" id="menu'+(i*10000+j*100+k)+'" width="100%" ></td></tr>\n'    
      }
      else{
      tempmenu += 
       '<tr><td bgColor="#66CCFF" bordercolor=royalblue style="border: 1px solid royalblue" id="menu'+(i*10000+j*100+k)+'" width="100%"'+
       ' onmouseover="switchBackOn(this)" onmouseout="switchBackOff(this)"'+
       ' onclick="'+func+'('+(i*10000+j*100+k)+',1)">'+
       '<p align="right"><font color=royalblue size="2">'+menutable[i].split("%")[j].split("*")[k].split("|")[0]+
       '</font></p></td></tr>\n'    
       }
      }
     else{
      tempmenu += 
       '<tr><td bgColor="#66CCFF" bordercolor=royalblue>'+
       '<table width="100%" bgColor="#66CCFF" border="'+tbbb+'" bordercolor="#66CCFF" style="border: 1px solid #66CCFF" width="100%"><tr>'+
       '<td bordercolor="orange" '+
       ' onmouseover="switchBackOn(this)" onmouseout="switchBackOffs(this)" '+
       ' id="menu'+(i*10000+j*100+k)+'" bgColor='+bgActiveC+' '+
       ' onclick="'+func+'('+(i*10000+j*100+k)+',1)">'+
       '<p align="right"><font color=royalblue size="2">'+menutable[i].split("%")[j].split("*")[k].split("|")[0]+
       '</font></p></td></tr></table></td></tr>\n'
      }
     }
    tempmenu += '</td></tr></table>';
    }
   }
  tempmenu += '</td></tr></table>';
  }                       
 }
tempmenu += '</table>';
return tempmenu;
}

function draw_menu(stat){
status=stat;
stat1=(stat-stat%10000)/10000;
stat2=stat-stat1*10000;
stat2=(stat2-stat2%100)/100;
stat3=stat-stat2*100-stat1*10000;
tttmp=top.document.getElementById("menu_main");
tttmp.innerHTML=make_menu_html(stat,"load_page");
if(stat==-1)return;
pgActive=menutable[stat1].split("%")[stat2].split("*")[stat3].split("|")[2];
if(pgActive=="0"){
 tttmp=top.document.getElementById("textcell");
 ttitle=menutable[stat1].split("%")[0].split("*")[0].split("|")[0];
 if(stat2!=0){
  ttitle+=" : "+menutable[stat1].split("%")[stat2].split("*")[0].split("|")[0];
  }
 if(stat3!=0){
  ttitle+=" : "+menutable[stat1].split("%")[stat2].split("*")[stat3].split("|")[0];
  }
 txt="<b><center><font size=6>"+ttitle+"</b></font><p>";
 txt+="This page is currently under construction. Please come here again shortly. We apologize for any inconvenience. <p>Currently available pages on the my web site are<p>"; 
 txt+=print_all_active_pages();
 tttmp.innerHTML=txt+tttmp.innerHTML;
 }

//tttmp.innerHTML=make_menu_html(stat,"draw_menu");
}

function draw_menu_restore(stat){
status=stat;
stat1=(stat-stat%10000)/10000;
stat2=stat-stat1*10000;
stat2=(stat2-stat2%100)/100;
stat3=stat-stat2*100-stat1*10000;
tttmp=top.document.getElementById("menu_main");
tttmp.innerHTML=make_menu_html(stat,"load_page");
pgActive=menutable[stat1].split("%")[stat2].split("*")[stat3].split("|")[2];

//tttmp.innerHTML=make_menu_html(stat,"draw_menu");
}

function print_all_active_pages(){
 txt="";

 for(i=0; i<menutable.length; i++){
  if(menutable[i].split("%")[0].split("*")[0].split("|")[2]=="1"){
   txt += "<a href='javascript:load_page("+(i*10000)+")'>"+menutable[i].split("%")[0].split("*")[0].split("|")[0]+"</a><br>";
   }
  for(j=1; j<menutable[i].split("%").length; j++){
   if(menutable[i].split("%")[j].split("*")[0].split("|")[2]=="1"){
    txt += "<a href='javascript:load_page("+(i*10000+j*100)+")'>"+
           menutable[i].split("%")[0].split("*")[0].split("|")[0]+" : "+
           menutable[i].split("%")[j].split("*")[0].split("|")[0]+
           "</a><br>";
    }
   for(k=1; k<menutable[i].split("%")[j].split("*").length; k++){
    if(menutable[i].split("%")[j].split("*")[k].split("|")[2]=="1"){
     txt += "<a href='javascript:load_page("+(i*10000+j*100+k)+")'>"+
            menutable[i].split("%")[0].split("*")[0].split("|")[0]+" : "+
            menutable[i].split("%")[j].split("*")[0].split("|")[0]+" : "+
            menutable[i].split("%")[j].split("*")[k].split("|")[0]+
            "</a><br>";
     }
    }
   }
  }
 return txt;
 }

function redraw_menu(stat){
status=stat;
stat1=(stat-stat%10000)/10000;
stat2=stat-stat1*10000;
stat2=(stat2-stat2%100)/100;
stat3=stat-stat2*100-stat1*10000;
top.frames[1].window.name=stat;
tttmp=top.document.getElementById("menu_main");
tttmp.innerHTML=make_menu_html(stat,"load_page");
//tttmp.innerHTML=make_menu_html(stat,"draw_menu");
}

function draw_menu_all(stat){
status=stat;
stat1=(stat-stat%10000)/10000;
stat2=stat-stat1*10000;
stat2=(stat2-stat2%100)/100;
stat3=stat-stat2*100-stat1*10000;
//alert("stat="+stat+" "+stat1+" "+stat2+" "+stat3);
tempmenu='<table border="'+tbbb+'" borderColor="#66CCFF" borderColorDark="#66CCFF" borderColorLight="#66CCFF" width="100%" bgcolor="#66CCFF">';
for(i=0; i<menutable.length; i++){
 if(stat1!=i){
  tempmenu += 
        '<tr><td bordercolor="blue" style="border: 1px solid blue">'+
        '<table border="'+tbbb+'" bordercolor="#66CCFF" borderColorDark="#66CCFF" borderColorLight="#66CCFF" width="100%"><tr><td bordercolor="#66CCFF" id="menu'+i*10000+'" width="100%" height="24"'+
        ' onmouseover="switchBackOn(this)" onmouseout="switchBackOff(this)"'+
        ' onclick="load_page('+i*10000+')">'+
        '<p align="center"><b><font size="4">'+menutable[i].split("%")[0].split("*")[0].split("|")[0]+
        '</font></b></p></td></tr>\n';
  }
 if(stat1==i){
  tempmenu += 
        '<tr><td bordercolor="blue" style="border: 1px solid blue">'+
        '<table border="'+tbbb+'" bordercolor="#66CCFF" width="100%"><tr><td bordercolor="yellow" style="border: 1px solid yellow" id="menu'+i*10000+'" width="100%" height="24"'+
        ' onmouseover="switchBackOn(this)" onmouseout="switchBackOffs(this)"'+
        ' bgColor='+bgActiveC+' '+
        ' onclick="load_page('+i*10000+')">'+
        '<p align="center"><b><font size="4">'+menutable[i].split("%")[0].split("*")[0].split("|")[0]+
        '</font></b></p></td></tr>\n';
   }
  for(j=1; j<menutable[i].split("%").length; j++){
   if(stat2!=j || stat1!=i){
    tempmenu += 
      '<tr><td bordercolor="black" style="border: 1px solid black">'+
      '<table border="'+tbbb+'" bordercolor="#66CCFF" width="100%"><tr><td bordercolor="#66CCFF" id="menu'+(i*10000+j*100)+'" width="100%"'+
      ' onmouseover="switchBackOn(this)" onmouseout="switchBackOff(this)"'+
      ' onclick="load_page('+(i*10000+j*100)+')">'+
      '<p align="center"><font size="3">'+menutable[i].split("%")[j].split("*")[0].split("|")[0]+
      '</font></p></td></tr>\n'
    }
   if(stat2==j && stat1==i){ 
    tempmenu += 
      '<tr><td bordercolor="black" style="border: 1px solid black">'+
      '<table border="'+tbbb+'" bordercolor="#66CCFF" width="100%"><tr><td bordercolor="orange" style="border: 1px solid orange" id="menu'+(i*10000+j*100)+'" width="100%"'+
      ' onmouseover="switchBackOn(this)" onmouseout="switchBackOffs(this)"'+
      ' bgColor='+bgActiveC+' '+
      ' onclick="load_page('+(i*10000+j*100)+')">'+
      '<p align="center"><font size="3">'+menutable[i].split("%")[j].split("*")[0].split("|")[0]+
      '</font></p></td></tr>\n'
     }  
    for(k=1; k<menutable[i].split("%")[j].split("*").length; k++){
     if(stat3!=k || stat2!=j || stat1!=i){
      tempmenu += 
       '<tr><td bordercolor=royalblue style="border: 1px solid royalblue" id="menu'+(i*10000+j*100+k)+'" width="100%"'+
       ' onmouseover="switchBackOn(this)" onmouseout="switchBackOff(this)"'+
       ' onclick="load_page('+(i*10000+j*100+k)+')">'+
       '<p align="right"><font color=blue size="2">'+menutable[i].split("%")[j].split("*")[k].split("|")[0]+
       '</font></p></td></tr>\n'    
      }
     if(stat3==k && stat2==j && stat1==i){
      tempmenu += 
       '<tr><td bordercolor=royalblue style="border: 1px solid royalblue" id="menu'+(i*10000+j*100+k)+'" width="100%"'+
       ' onmouseover="switchBackOn(this)" onmouseout="switchBackOffs(this)"'+
       ' bgColor='+bgActiveC+' '+
       ' onclick="load_page('+(i*10000+j*100+k)+')">'+
       '<p align="right"><font color=blue size="2">'+menutable[i].split("%")[j].split("*")[k].split("|")[0]+
       '</font></p></td></tr>\n'    
      }
     }
    tempmenu += '</td></tr></table>';
   }
  tempmenu += '</td></tr></table>';                    
 }
tempmenu += '</table>';

tttmp=top.document.getElementById("menu_main");
tttmp.innerHTML=tempmenu;
} 

function open_contact_us(nm,evnt){
 var  properties="toolbar=0,location=0,menubar=no";
 properties = properties+",height=650,width=650";
 if(evnt != null){
  if(navigator.appName == "Microsoft Internet Explorer") {
  properties = properties+",left="+(evnt.screenX + 10);
  properties = properties+",top="+(evnt.screenY + 10);
  }
 else{ // Navigator coordinates must be adjusted for scrolling
  properties = properties+",left="+(evnt.screenX - pageXOffset + 10);
  properties = properties+",top="+(evnt.screenY - pageYOffset + 10);
  }
 properties = properties+",scrollbars=auto,resizable=yes";
 }
 popupHandle = window.open(hroot+"contactme.htm",nm,properties);
}

function open_mailinglist(nm,evnt){
 var  properties="toolbar=0,location=0,menubar=no";
 properties = properties+",height=350,width=500";
 if(evnt != null){
  if(navigator.appName == "Microsoft Internet Explorer") {
  properties = properties+",left="+(evnt.screenX + 10);
  properties = properties+",top="+(evnt.screenY + 10);
  }
 else{ // Navigator coordinates must be adjusted for scrolling
  properties = properties+",left="+(evnt.screenX - pageXOffset + 10);
  properties = properties+",top="+(evnt.screenY - pageYOffset + 10);
  }
 properties = properties+",scrollbars=auto,resizable=yes";
 }
 popupHandle = window.open(hroot+"email_subscription.htm",nm,properties);
}

function draw_menu_rest(){
tmph="<table border="+tbbb+" borderColor=\"#66CCFF\" borderColorDark=\"#66CCFF\" borderColorLight=\"#66CCFF\" width=\"100%\" height=\"35\" bgcolor=\"#66CCFF\">";
tmph+="<tr> <td style=\"border: 1px solid blue\" bordercolor=\"blue\" id=\"contactus\" align=\"Center\" onmouseover=\"switchBackOn(this)\" onmouseout=\"switchBackOff(this)\" onclick=\"open_contact_us('Contact',event)\"><font size=\"3\"><B>Contact me</B></font></td> </tr> <tr>";
//tmph+="<td bordercolor=\"blue\" id=\"mailinglist\" align=\"Center\" onmouseover=\"switchBackOn(this)\" onmouseout=\"switchBackOff(this)\" onclick=\"open_mailinglist('mailinglist',event)\"><font size=\"3\"><B>Mailing list</B></font></td> </tr> </table>";

tmph+="<p align=\"right\"><table bordercolor=\"#66CCFF\" border=\""+tbbb+"\">";
tmph+="<tr> <td style=\"border: 1px solid blue\" bordercolor=\"blue\" id=\"expandall\" align=\"right\" onmouseover=\"switchBackOn(this)\" onmouseout=\"switchBackOff(this)\" onclick=\"draw_menu_all(status)\"><font size=\"2\">Expand all</font></td> </tr><tr>";
tmph+="<td style=\"border: 1px solid blue\" bordercolor=\"blue\" id=\"expandallr\" align=\"right\" onmouseover=\"switchBackOn(this)\" onmouseout=\"switchBackOff(this)\" onclick=\"draw_menu_restore(status)\"><font size=\"2\">Restore all</font></td> </tr> </table>";
tmph+="<p align=\"right\"><p align=\"right\"><font face=\"Arial\" size=\"1\">Welcome to<br><i>Jarek's Amateur Astronomy page</i><br>";
tmph += "<p align=\"right\">Please send comments or questions about this site to <A href=\"mailto:jp86@cornell.edu\">Jarek</A></font>";
tmph += "<p align=\"right\"><font face=\"Arial\" size=\"1\" style=\"BORDER-LEFT-COLOR: black; BORDER-BOTTOM-WIDTH: thin; BORDER-BOTTOM-COLOR: black; BORDER-TOP-COLOR: black; BORDER-RIGHT-COLOR: black\">This site is best viewed with Internet Explorer, but Netscape, FireFox and Safari will work too :-).</font></p>";
tttmp=top.document.getElementById("menu_main_rest");
tttmp.innerHTML=tmph;
}

function draw_logo(){
//document.leftmargin="2";
//document.topmargin="2";
document.bgColor="#66CCFF";
tttmp=top.document.getElementById("maintb");
tttmp.border="0";
tttmp.cellpadding="2";
tttmp.bordercolor="#66CCFF";
tttmp.bgColor="#66CCFF";
tttmp.height="100%";

tttmp=top.document.getElementById("logocell");
tttmp.bgColor="#66CCFF";

tttmp=top.document.getElementById("menucell");
tttmp.bgColor="#66CCFF";
tttmp.width="170pt";
tttmp.vAlign="top";
tttmp.height="100%";

tttmp=top.document.getElementById("textcell");
tttmp.bgColor="#66CCFF";
tttmp.vAlign="top";
tttmp.height="100%";

i1=1;
i2=2;
totpic=pictinfo.length-1;
i1=Math.floor(totpic*Math.random()+1);
i2=Math.floor(totpic*Math.random()+1);
if(i1==i2){
 i2++;
 if(i2>totpic)i2=1;
 }
tmph = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-width: 0\" bordercolor=\"#111111\" width=\"100%\">";
tmph += "<tr>";
tmph += "    <td width=\"37%\" style=\"border-style: none; border-width: medium\" align=\"left\">";
tmph += "<table><tr><td>";
tmph += "<a href=\"javascript:display_album("+i1+",event)\"><img border=\"0\" src=\""+dirprefix+root+"album/" + i1 + ".jpg\" height=\"100\" onclick=\"display_album("+i1+",event)\"></a></td><td>&nbsp;&nbsp;&nbsp;</td><td>";
tmph += "Local Mean Sideral Time<br> in Ithaca, NY:<br> <input type=\"text\" name=\"gst\" id=\"gst\" value=\"0\" size=10> time<br><input type=\"text\" name=\"deg\" id=\"deg\" value=\"0\" size=10> hour angle</td></tr></table>";
tmph += "    </td>";
tmph += "    <td width=\"38%\" style=\"border-style: none; border-width: medium\" >";
tmph += "    <p align=\"center\">";
tmph += "    <img border=\"0\" src=\""+dirprefix+root+"JarekAstroLogo.jpg\"  height=\"80\">";
tmph += "    </td>";
tmph += "    <td width=\"25%\" style=\"border-style: none; border-width: medium\"align=\"right\">";
tmph += "<a href=\"javascript:display_album("+i2+",event)\"><img border=\"0\" src=\""+dirprefix+root+"album/" + i2 + ".jpg\" height=\"100\" onclick=\"display_album("+i2+",event)\"></a>";
tmph += "    </td>";
tmph += "  </tr>";
tmph += "  <tr>";
tmph += "    <td width=\"100%\" style=\"border-style: none; border-width: medium\" colspan=\"3\">";
tmph += "  </tr>";
tmph += "</table>";
tttmp=top.document.getElementById("menu_main_logo");
tttmp.innerHTML=tmph;
getTimeA();
}

function switchBackOn(obj){
obj.bgColor="orange";
}
function switchBackOff(obj){
obj.bgColor="#66CCFF";
}
function switchBackOffs(obj){
//obj.bgColor="LightYellow";
obj.bgColor=bgActiveC;
}

function relink(nww)
{
if(document.title=="Jarek's Amateur Astronomy Site Picture Window")
{
	opener.location=nww;
}
else
{
	document.location=nww;
}
}

function getTimeA(box2, box1, ds, boxx3, lon) 
{
    var boxx1 = "deg";
    if(box1 != null)boxx1=box1;
    var boxx2 = "gst";
    if(box2 != null)boxx2=box2;
    var lonn = -76.47;
    if(lon != null)lonn=1.0*lon;

    var now = new Date();                                   // from computer clock
    if(ds != null)
    {
	now.setTime(Date.parse(ds));
    }

    var hour   = now.getUTCHours();
    var minute = now.getUTCMinutes();
    var second = now.getUTCSeconds();

    var beg = new Date( now.getUTCFullYear() - 1, 11, 31 ); // last day of previous year
    var day = Math.floor( ( now - beg ) / 86400000 );
 
    //document.calc.day.value = day;
    //document.calc.utc.value = d2( hour ) + " : " + d2( minute ) + " : " + d2( second );

    var mst = getMST( now, lonn );                           // in degrees 
    var ras = mst;                                          // right ascension
    var ras0 = mst;
    mst  = mst / 15.0;                                      // time units

    // right ascension of vernal equinox
    var deg = Math.floor( ras );

    ras = ras - deg;
    ras = ras * 60;
    var min = Math.floor( ras );

    ras = ras - min;
    ras = ras * 60;
    var sec = Math.floor( ras ); 

    // sidereal time
    hour = Math.floor( mst );
        
    mst  = mst - hour;
    mst  = mst * 60;
    minute = Math.floor( mst );
        
    mst  = mst - minute;
    mst  = mst * 60;
    second = Math.floor( mst );     
    
    tttmp=top.document.getElementById(boxx1);
    tttmp.value = d2( deg ) + "° " + d2( min ) + "\' " + d2( sec ) + "\"";
    tttmp=top.document.getElementById(boxx2);
    tttmp.value = d2( hour ) + " : " + d2( minute ) + " : " + d2( second );
    if(boxx3 != null)
    {
	tttmp=top.document.getElementById(boxx3);
	tttmp.value = ras0;
    }

    newtime = window.setTimeout("getTimeA();", 1000);
}

function d2( n )
{
    if( n < 10 )
        return "0" + n;

    return n;
}

/*
** "getMST" computes Mean Sidereal Time in units of degrees. Use lon = 0 to
** get the Greenwich MST.
**
** returns: time in degrees
*/
function getMST( now, lon )
{
    var year   = now.getUTCFullYear();
    var month  = now.getUTCMonth() + 1;
    var day    = now.getUTCDate();
    var hour   = now.getUTCHours();
    var minute = now.getUTCMinutes();
    var second = now.getUTCSeconds();

    // 1994 June 16th at 18h UT
    // days since J2000: -2024.75
    // GMST: 174.77111347427126
    //       11h 39m 5.0672s 
    // year   = 1994;
    // month  = 6;
    // day    = 16;
    // hour   = 18;
    // minute = 0; 
    // second = 0; 

    if( month == 1 || month == 2 )
    {
	year = year - 1;
	month = month + 12;
    }

    var a = Math.floor( year/100 );
    var b = 2 - a + Math.floor( a/4 );

    var c = Math.floor(365.25 * year);
    var d = Math.floor(30.6001 * (month + 1));

    // days since J2000.0   
    var jd = b + c + d - 730550.5 + day + (hour + minute/60.0 + second/3600.0)/24.0;
    
    var jt   = jd/36525.0;                   // julian centuries since J2000.0         
    var GMST = 280.46061837 + 360.98564736629*jd + 0.000387933*jt*jt - jt*jt*jt/38710000 + lon;           
    if( GMST > 0.0 )
    {
        while( GMST > 360.0 )
            GMST -= 360.0;
    }
    else
    {
        while( GMST < 0.0 )
            GMST += 360.0;
    }
        
    return GMST;
}

