function CheckNum(){
  txt=document.mychart.year.value;
  for (i=0; i<txt.length; i++)
    {c=txt.charAt(i);
    if("0123456789".indexOf(c,0)<0)
      {alert("Invalid Year");
    document.mychart.year.focus();
    return(false);
      }   
   }
    txt=document.mychart.month.value;
  for (i=0; i<txt.length; i++)
    {c=txt.charAt(i);
    if("0123456789".indexOf(c,0)<0)
      {alert("Invalid Month");
    document.mychart.month.focus();
    return(false);
      }
   }
    txt=document.mychart.day.value;
  for (i=0; i<txt.length; i++)
    {c=txt.charAt(i);
    if("0123456789".indexOf(c,0)<0)
      {alert("Invalid Day");
    document.mychart.day.focus();
    return(false);
      }
   }
  txt=document.mychart.hour.value;
  for (i=0; i<txt.length; i++)
    {c=txt.charAt(i);
    if("0123456789".indexOf(c,0)<0)
      {alert("Invalid Hour");
    document.mychart.hour.focus();
    return(false);
      }
   }
  txt=document.mychart.min.value;
  for (i=0; i<txt.length; i++)
    {c=txt.charAt(i);
    if("0123456789".indexOf(c,0)<0)
      {alert("Invalid Minute");
    document.mychart.min.focus();
    return(false);
      }
   }
      return(true);
   }
   
function subWinsettinghelp_e(){	
window.open	
("settinghelp_e.html","settinghelp");}	

function subWinsettinghelp_j(){	
window.open	
("settinghelp_j.html","settinghelp");}	


function DateEtTime(){
	dt=new Date();
	y=dt.getFullYear();
	m=dt.getMonth()+1;
	d=dt.getDate();
	h=dt.getHours();
	min=dt.getMinutes();

	document.mychart.year.value=y;
	document.mychart.month.value=m;
	document.mychart.day.value=d;
	document.mychart.hour.value=h;
	document.mychart.min.value=min;
	
	document.mychart.dif.selectedIndex=difIndex();
}
function DateEtTime2(){
	dt=new Date();
	y=dt.getFullYear();
	m=dt.getMonth()+1;
	d=dt.getDate();
	h=dt.getHours();
	min=dt.getMinutes();

	document.mychart.year2.value=y;
	document.mychart.month2.value=m;
	document.mychart.day2.value=d;
	document.mychart.hour2.value=h;
	document.mychart.min2.value=min;

        document.mychart.dif2.selectedIndex=difIndex();
}

function difIndex(){
var difstr="H-12M-720=0;H-11M-660=1;H-10.5M-630=2;H-10M-600=3;H-9.5M-570=4;H-9M-540=5;H-8M-480=6;H-7M-420=7;H-6M-360=8;H-5M-300=9;H-4M-240=10;H-3.5M-210=11;H-3M-180=12;H-2.5M-150=13;H-2M-120=14;H-1M-60=15;H0M0=16;HLMTMLMT=17;H1M60=18;H2M120=19;H3M180=20;H3.5M210=21;H4M240=22;H4.5M270=23;H5M300=24;H5.5M330=25;H5.75M345=26;H6M360=27;H6.5M390=28;H7M420=29;H7.5M450=30;H8M480=31;H8.5M510=32;H9M540=33;H9.5M570=34;H10M600=35;H10.5M630=36;H11M660=37;H11.5M690=38;H12M720=39;H12.5M750=40;H13M780=41;";

var timedif= new Date();
c_name="M"+(-1*timedif.getTimezoneOffset());
c_start=difstr.indexOf(c_name+"=");
  if (c_start!=-1)
    { 
          c_start=c_start + c_name.length+1; 
          c_end=difstr.indexOf(";",c_start);
          return  difstr.substring(c_start,c_end);
    }else{
          return 33;
    }
}

function SetCookie(){
         myadbc   = window.document.mychart.adbc.selectedIndex;
         myyear   = window.document.mychart.year.value;
         mymonth  = window.document.mychart.month.value;
         myday    = window.document.mychart.day.value;
         myhour   = window.document.mychart.hour.value;
         mymin    = window.document.mychart.min.value;
         mycalen  = window.document.mychart.calendar.selectedIndex;
         mydif    = window.document.mychart.dif.selectedIndex;
         myhouse  = window.document.mychart.house.selectedIndex;
         mydeglong= window.document.mychart.deglong.selectedIndex;
         myminlong= window.document.mychart.minlong.selectedIndex;
         myEW     = window.document.mychart.EW.selectedIndex;
         mydeglat = window.document.mychart.deglat.selectedIndex;
         myminlat = window.document.mychart.minlat.selectedIndex;
         myNS     = window.document.mychart.NS.selectedIndex;
         var save=myadbc+"="+myyear+"="+mymonth+"="+myday+"="+myhour+"="+mymin+"="+mycalen+"="+mydif
               +"="+myhouse+"="+mydeglong+"="+myminlong+"="+myEW+"="+mydeglat+"="+myminlat+"="+myNS;
         var escsave=escape(save);
         document.cookie="myastrochart="+escsave+";expires=Tue,31-Dec-2030 23:59:59; ";
}
function GetCookie(){
         if (document.cookie.length>0){
             c_start=document.cookie.indexOf("myastrochart=");
             if (c_start!=-1){
                 c_start=c_start+"myastrochart".length+1;
                 c_end=document.cookie.indexOf(";",c_start);
                 if (c_end==-1) c_end=document.cookie.length;
                 getval=unescape(document.cookie.substring(c_start,c_end));
//                 alert(getval);
                 var v=getval.split("=");
                 if (v[0]){document.mychart.adbc.selectedIndex=v[0];}
                 if (v[1]){document.mychart.year.value=v[1];}
                 if (v[2]){document.mychart.month.value=v[2];}
                 if (v[3]){document.mychart.day.value=v[3];}
                 if (v[4]){document.mychart.hour.value=v[4];}
                 if (v[5]){document.mychart.min.value=v[5];}
                 if (v[6]){document.mychart.calendar.selectedIndex=v[6];}
                 if (v[7]){document.mychart.dif.selectedIndex=v[7];}
                 if (v[8]){document.mychart.house.selectedIndex=v[8];}
                 if (v[9]){document.mychart.deglong.selectedIndex=v[9];}
                 if (v[10]){document.mychart.minlong.selectedIndex=v[10];}
                 if (v[11]){document.mychart.EW.selectedIndex=v[11];}
                 if (v[12]){document.mychart.deglat.selectedIndex=v[12];}
                 if (v[13]){document.mychart.minlat.selectedIndex=v[13];}
                 if (v[14]){document.mychart.NS.selectedIndex=v[14];}
             }
          }
}
function GetCookie2(){
         if (document.cookie.length>0){
             c_start=document.cookie.indexOf("myastrochart=");
             if (c_start!=-1){
                 c_start=c_start+"myastrochart".length+1;
                 c_end=document.cookie.indexOf(";",c_start);
                 if (c_end==-1) c_end=document.cookie.length;
                 getval=unescape(document.cookie.substring(c_start,c_end));
//                 alert(getval);
                 var v=getval.split("=");
                 if (v[0]){document.mychart.adbc2.selectedIndex=v[0];}
                 if (v[1]){document.mychart.year2.value=v[1];}
                 if (v[2]){document.mychart.month2.value=v[2];}
                 if (v[3]){document.mychart.day2.value=v[3];}
                 if (v[4]){document.mychart.hour2.value=v[4];}
                 if (v[5]){document.mychart.min2.value=v[5];}
                 if (v[6]){document.mychart.calendar2.selectedIndex=v[6];}
                 if (v[7]){document.mychart.dif2.selectedIndex=v[7];}
                 if (v[8]){document.mychart.house2.selectedIndex=v[8];}
                 if (v[9]){document.mychart.deglong2.selectedIndex=v[9];}
                 if (v[10]){document.mychart.minlong2.selectedIndex=v[10];}
                 if (v[11]){document.mychart.EW2.selectedIndex=v[11];}
                 if (v[12]){document.mychart.deglat2.selectedIndex=v[12];}
                 if (v[13]){document.mychart.minlat2.selectedIndex=v[13];}
                 if (v[14]){document.mychart.NS2.selectedIndex=v[14];}
             }
          }
}

function DoubleSet(){
         DateEtTime();
         GetCookie();
}

function changeImage_save_j(){
    document.save_j.src="imgforhtml/cookie_save_j.gif";
}
function changeImage_save_j1(){
    document.save_j.src="imgforhtml/cookie_save_j1.gif";
}
function changeImage_save_e(){
    document.save_e.src="imgforhtml/cookie_save_e.gif";
}
function changeImage_save_e1(){
    document.save_e.src="imgforhtml/cookie_save_e1.gif";
}
function changeImage_load_j(){
    document.load_j.src="imgforhtml/cookie_load_j.gif";
}
function changeImage_load_j1(){
    document.load_j.src="imgforhtml/cookie_load_j1.gif";
}
function changeImage_load_e(){
    document.load_e.src="imgforhtml/cookie_load_e.gif";
}
function changeImage_load_e1(){
    document.load_e.src="imgforhtml/cookie_load_e1.gif";
}
function changeImage_now_j(){
    document.now_j.src="imgforhtml/now_j.gif";
}
function changeImage_now_j1(){
    document.now_j.src="imgforhtml/now_j1.gif";
}
function changeImage_now_e(){
    document.now_e.src="imgforhtml/now_e.gif";
}
function changeImage_now_e1(){
    document.now_e.src="imgforhtml/now_e1.gif";
}
function changeImage_load_j2(){
    document.load_j2.src="imgforhtml/cookie_load_j.gif";
}
function changeImage_load_j3(){
    document.load_j2.src="imgforhtml/cookie_load_j1.gif";
}
function changeImage_load_e2(){
    document.load_e2.src="imgforhtml/cookie_load_e.gif";
}
function changeImage_load_e3(){
    document.load_e2.src="imgforhtml/cookie_load_e1.gif";
}
function changeImage_now_j2(){
    document.now_j2.src="imgforhtml/now_j.gif";
}
function changeImage_now_j3(){
    document.now_j2.src="imgforhtml/now_j1.gif";
}
function changeImage_now_e2(){
    document.now_e2.src="imgforhtml/now_e.gif";
}
function changeImage_now_e3(){
    document.now_e2.src="imgforhtml/now_e1.gif";
}
function changeImage_livingmoon_j(){
    document.livingmoon_j.src="pages/imgforhtml/livingmoon_j.gif";
}
function changeImage_livingmoon_j1(){
    document.livingmoon_j.src="pages/imgforhtml/livingmoon_j1.gif";
}
function changeImage_livingmoon_e(){
    document.livingmoon_e.src="pages/imgforhtml/livingmoon_e.gif";
}
function changeImage_livingmoon_e1(){
    document.livingmoon_e.src="pages/imgforhtml/livingmoon_e1.gif";
}
function changeImage_moon_calendar(){
    document.moon_calendar.src="pages/imgforhtml/moon_calendar.gif";
}
function changeImage_moon_calendar1(){
    document.moon_calendar.src="pages/imgforhtml/moon_calendar1.gif";
}

//for Living with the Moon

function initialset(){
      dt=new Date();
      y=dt.getFullYear();
      document.calendar.year.selectedIndex=y-1900;
      document.calendar.month.selectedIndex=dt.getMonth();
      document.calendar.timezone.selectedIndex=timezoneIndex();
}

function timezoneIndex(){
var difstr="H-12M-720=0;H-11M-660=1;H-10.5M-630=2;H-10M-600=3;H-9.5M-570=4;H-9M-540=5;H-8M-480=6;H-7M-420=7;H-6M-360=8;H-5M-300=9;H-4M-240=10;H-3.5M-210=11;H-3M-180=12;H-2.5M-150=13;H-2M-120=14;H-1M-60=15;H0M0=16;H1M60=17;H2M120=18;H3M180=19;H3.5M210=20;H4M240=21;H4.5M270=22;H5M300=23;H5.5M330=24;H5.75M345=25;H6M360=26;H6.5M390=27;H7M420=28;H7.5M450=29;H8M480=30;H8.5M510=31;H9M540=32;H9.5M570=33;H10M600=34;H10.5M630=35;H11M660=36;H11.5M690=37;H12M720=38;H12.5M750=39;H13M780=40;";

var timedif= new Date();
c_name="M"+(-1*timedif.getTimezoneOffset());
c_start=difstr.indexOf(c_name+"=");
  if (c_start!=-1)
    { 
          c_start=c_start + c_name.length+1; 
          c_end=difstr.indexOf(";",c_start);
          return  difstr.substring(c_start,c_end);
    }else{
          return 16;
    }
}

function subWinmoonhelp_e(){	
window.open	
("moonhelp_e.html","moonhelp");}	

function subWinmoonhelp_j(){	
window.open	
("moonhelp_j.html","smoonhelp");}	


//for lunation map

function initialsetforlunation(){
      dt=new Date();
      y=dt.getFullYear();
      document.mychart.moonyear.selectedIndex=y-2000;
      document.mychart.timezone.selectedIndex=timezoneIndex();
}
