
<!--

function compute(form) {

var gon = Array("-Water [Gui]", "+Wood [Jia]", "-Wood [Yi]", "+Fire [Bing]", "-Fire [Ding]", "+Earth [Wu]", "-Earth [Ji]",
"+Metal [Geng]", "-Metal [Xin]", "+Water [Ren]", "-Water [Gui]");
var ji = Array( "Pig [Hai]", "Rat [Zi]", "Ox [Chou]", "Tiger [Yin]", "Rabbit [Mao]", "Dragon [Chen]", "Snake [Si]",
"Horse [Wu]", "Goat [Wei]", "Monkey [Shen]", "Rooster [You]", "Dog [Xu]", "Pig [Hai]", "Rat [Zi]");
TZ=form.ITZ.options[form.ITZ.selectedIndex].value
MM=form.nyuet.selectedIndex +1
DD=form.nyat.selectedIndex +1
YY=form.nnin.selectedIndex + 1900
HR=form.nsee.selectedIndex
MN=form.nfen.selectedIndex
GEN=form.BBB.options[form.BBB.selectedIndex].value
LON=eval(form.longi.value)
with (Math){
HR = HR + (MN / 60);
if ((LON>-181) & (LON<181)) HR = HR + (LON/15 - TZ);
AAA = 1;
if (YY <= 1585) AAA = 0;
JD = -1 * floor(7 * (floor((MM + 9) / 12) + YY) / 4);
S = 1;
if ((MM - 9)<0) S=-1;
A = abs(MM - 9);
J1 = floor(YY + S * floor(A / 7));
J1 = -1 * floor((floor(J1 / 100) + 1) * 3 / 4);
JD = JD + floor(275 * MM / 9) + DD + (AAA * J1);
JD = JD + 1721027 + 2 * AAA + 367 * YY - 0.5;
JZJD =  JD + (HR / 24);
JD = JD + (HR/24) - (TZ/24);
T = (JD - 2451545.0 ) / 36525;
d = 2*PI/360;
M = 357.52910 + 35999.05030*T - 0.0001559*T*T - 0.00000048*T*T*T;
L0 = 280.46645 + 36000.76983*T + 0.0003032*T*T;
DL = (1.914600 - 0.004817*T - 0.000014*T*T)*sin(d*M);
DL = DL+ (0.019993 - 0.000101*T)*sin(d*2*M) + 0.000290*sin(d*3*M);
L = L0 + DL;
for(var i=0;L>360;i++){
L=L-360;
}
for(var i=0;L<0;i++){
L=L+360;
}
if ((L<315) && (MM==1 || MM==2)){
ys0=YY-4;
yb0=YY-4;
}
else {
ys0=YY-3;
yb0=YY-3;
}
for(var i=0;ys0>10;i++){
ys0=ys0-10;
}
ys=gon[ys0];
for(var i=0;yb0>12;i++){
yb0=yb0-12;
}
if(ys0 % 2 ==0){
FW=-1*GEN;
}
else{
FW=1*GEN;
}
yb=ji[yb0];
ms0 = 1;
for (var i=0;i<6;i++){
if ((ys0==i) || (ys0==i+5)) {
ms0=ms0+ (i * 2);
if (ms0>10) {
ms0=ms0-10;
}
}
}
form.comment1.value = "";
form.comment2.value = "";
str00 = "Your given date and time is close to the Jie, ";
str01 = "Please consult Feng Shui Research Center for accurate charting.";
str1 = "";
str2 = "";
if (L>314.95 && L<315.05){
str1 = str00 + "Spring Beginning.";
str2 = str01;
}
if (L>344.95 && L<345.05){
str1 = str00 + "Insects Awakening.";
str2 = str01;
}
if (L>14.95 && L<15.05){
str1 = str00 + "Clear Bright.";
str2 = str01;
}
if (L>44.95 && L<45.05){
str1 = str00 + "Summer Beginning.";
str2 = str01;
}
if (L>74.95 && L<75.05){
str1 = str00 + "Planting Crops.";
str2 = str01;
}
if (L>104.95 && L<105.05){
str1 = str00 + "Lesser Heat.";
str2 = str01;
}
if (L>134.95 && L<135.05){
str1 = str00 + "Autumn Beginning.";
str2 = str01;
}
if (L>164.95 && L<165.05){
str1 = str00 + "White Dew.";
str2 = str01;
}
if (L>194.95 && L<195.05){
str1 = str00 + "Cold Dew.";
str2 = str01;
}
if (L>224.95 && L<225.05){
str1 = str00 + "Winter Beginning.";
str2 = str01;
}
if (L>254.95 && L<255.05){
str1 = str00 + "Greater Snow.";
str2 = str01;
}
if (L>284.95 && L<285.05){
str1 = str00 + "Lesser Cold.";
str2 = str01;
}
if ((L==315 || L>315) && (L<345)){
mb = ji[3];
lpb0 = 3;
if( FW==1){
LP = ((345 - L)/3);
}
else{
LP = ((L - 315)/3);
}
}
if ((L==345 || L>345) || (L<15)){
mb = ji[4];
lpb0 = 4;
ms0=ms0+ 1;
if( FW==1){
LP = ((375 - L)/3);
}
else{
LP =((L - 345)/3);
}
if (LP>11){
LP = LP - 120;
}
if (LP<0){
LP = LP + 120;
}
}
if ((L==15 || L>15) && (L<45)){
mb = ji[5];
lpb0 = 5;
ms0=ms0+ 2;
if( FW==1){
LP = ((45 - L)/3);
}
else{
LP = ((L - 15)/3);
}
}
if ((L==45 || L>45) && (L<75)){
mb = ji[6];
lpb0 = 6;
ms0=ms0+ 3;
if( FW==1){
LP = ((75 - L)/3);
}
else{
LP = ((L - 45)/3);
}
}
if ((L==75 || L>75) && (L<105)){
mb = ji[7];
lpb0 = 7;
ms0=ms0+ 4;
if( FW==1){
LP = ((105 - L)/3);
}
else{
LP = ((L - 75)/3);
}
}
if ((L==105 || L>105) && (L<135)){
mb = ji[8];
lpb0 = 8;
ms0=ms0+ 5;
if( FW==1){
LP = ((135 - L)/3);
}
else{
LP = ((L - 105)/3);
}
}
if ((L==135 || L>135) && (L<165)){
mb = ji[9];
lpb0 = 9;
ms0=ms0+ 6;
if( FW==1){
LP = ((165 - L)/3);
}
else{
LP = ((L - 135)/3);
}
}
if ((L==165 || L>165) && (L<195)){
mb = ji[10];
lpb0 = 10;
ms0=ms0+ 7;
if( FW==1){
LP = ((195 - L)/3);
}
else{
LP = ((L - 165)/3);
}
}
if ((L==195 || L>195) && (L<225)){
mb = ji[11];
lpb0 = 11;
ms0=ms0+ 8;
if( FW==1){
LP = ((225 - L)/3);
}
else{
LP = ((L - 195)/3);
}
}
if ((L==225 || L>225) && (L<255)){
mb = ji[12];
lpb0 = 12;
ms0=ms0+ 9;
if( FW==1){
LP = ((255 - L)/3);
}
else{
LP = ((L - 225)/3);
}
}
if ((L==255 || L>255) && (L<285)){
mb = ji[1];
lpb0 = 1;
ms0=ms0+ 10;
if( FW==1){
LP = ((285 - L)/3);
}
else{
LP = ((L - 255)/3);
}
}
if ((L==285 || L>285) && (L<315)){
mb = ji[2];
lpb0 = 2;
ms0=ms0+ 11;
if( FW==1){
LP = ((315 - L)/3);
}
else{
LP = ((L - 285)/3);
}
}
if (ms0>10) {
ms0=ms0-10;
}
ms = gon[ms0];
lps0 = ms0;
ds0="" + floor(JZJD+0.5);
ds=gon[ds0.substring(6,7)];
db0=floor(JZJD - 12*floor((JZJD+0.5)/12)+0.5)+2;
db = ji[db0];
hs0=1;
hs1=0;
for (var i=1;i<5;i++){
if ((eval(ds0.substring(6,7))==i) || (eval(ds0.substring(6,7))==i+5)) {
hs1=hs0;
}
hs0=hs0+2;
}
if ((eval(ds0.substring(6,7))==0) || (eval(ds0.substring(6,7))==5)) {
hs1=9;
}
if ((HR==23) || (HR>23 && HR<24)) {
hs1=hs1+2;
}
if (((HR==23) || (HR>23 && HR<24)) || ((HR==00) || (HR>0 && HR<1) || (HR==24))) {
hb=ji[1];
}
hb0=2;
for (var i=1;i<23;i++){
if ((HR==i) || (HR>i && HR<i+2)) {
hb=ji[hb0];
hs1=hs1+hb0-1;
}
i=i+1;
hb0=hb0+1;
}
if (hs1>10) {
hs1=hs1-10;
}
hs=gon[hs1];
}
LP = Math.floor(LP*100)/100;
if (hb=="Pig [Hai]"){
his1=gon[9];
his2=gon[1];
his3="";
}
if (hb=="Rat [Zi]"){
his1=gon[0];
his2="";
his3="";
}
if (hb=="Ox [Chou]"){
his1=gon[6];
his2=gon[0];
his3=gon[8];
}
if (hb=="Tiger [Yin]"){
his1=gon[1];
his2=gon[3];
his3=gon[5];
}
if (hb=="Rabbit [Mao]"){
his1=gon[2];
his2="";
his3="";
}
if (hb=="Dragon [Chen]"){
his1=gon[5];
his2=gon[2];
his3=gon[0];
}
if (hb=="Snake [Si]"){
his1=gon[3];
his2=gon[5];
his3=gon[7];
}
if (hb=="Horse [Wu]"){
his1=gon[4];
his2=gon[6];
his3="";
}
if (hb=="Goat [Wei]"){
his1=gon[6];
his2=gon[4];
his3=gon[2];
}
if (hb=="Monkey [Shen]"){
his1=gon[7];
his2=gon[9];
his3=gon[5];
}
if (hb=="Rooster [You]"){
his1=gon[8];
his2="";
his3="";
}
if (hb=="Dog [Xu]"){
his1=gon[5];
his2=gon[8];
his3=gon[4];
}
if (db=="Pig [Hai]"){
dis1=gon[9];
dis2=gon[1];
dis3="";
}
if (db=="Rat [Zi]"){
dis1=gon[0];
dis2="";
dis3="";
}
if (db=="Ox [Chou]"){
dis1=gon[6];
dis2=gon[0];
dis3=gon[8];
}
if (db=="Tiger [Yin]"){
dis1=gon[1];
dis2=gon[3];
dis3=gon[5];
}
if (db=="Rabbit [Mao]"){
dis1=gon[2];
dis2="";
dis3="";
}
if (db=="Dragon [Chen]"){
dis1=gon[5];
dis2=gon[2];
dis3=gon[0];
}
if (db=="Snake [Si]"){
dis1=gon[3];
dis2=gon[5];
dis3=gon[7];
}
if (db=="Horse [Wu]"){
dis1=gon[4];
dis2=gon[6];
dis3="";
}
if (db=="Goat [Wei]"){
dis1=gon[6];
dis2=gon[4];
dis3=gon[2];
}
if (db=="Monkey [Shen]"){
dis1=gon[7];
dis2=gon[9];
dis3=gon[5];
}
if (db=="Rooster [You]"){
dis1=gon[8];
dis2="";
dis3="";
}
if (db=="Dog [Xu]"){
dis1=gon[5];
dis2=gon[8];
dis3=gon[4];
}
if (mb=="Pig [Hai]"){
mis1=gon[9];
mis2=gon[1];
mis3="";
}
if (mb=="Rat [Zi]"){
mis1=gon[0];
mis2="";
mis3="";
}
if (mb=="Ox [Chou]"){
mis1=gon[6];
mis2=gon[0];
mis3=gon[8];
}
if (mb=="Tiger [Yin]"){
mis1=gon[1];
mis2=gon[3];
mis3=gon[5];
}
if (mb=="Rabbit [Mao]"){
mis1=gon[2];
mis2="";
mis3="";
}
if (mb=="Dragon [Chen]"){
mis1=gon[5];
mis2=gon[2];
mis3=gon[0];
}
if (mb=="Snake [Si]"){
mis1=gon[3];
mis2=gon[5];
mis3=gon[7];
}
if (mb=="Horse [Wu]"){
mis1=gon[4];
mis2=gon[6];
mis3="";
}
if (mb=="Goat [Wei]"){
mis1=gon[6];
mis2=gon[4];
mis3=gon[2];
}
if (mb=="Monkey [Shen]"){
mis1=gon[7];
mis2=gon[9];
mis3=gon[5];
}
if (mb=="Rooster [You]"){
mis1=gon[8];
mis2="";
mis3="";
}
if (mb=="Dog [Xu]"){
mis1=gon[5];
mis2=gon[8];
mis3=gon[4];
}
if (yb=="Pig [Hai]"){
yis1=gon[9];
yis2=gon[1];
yis3="";
}
if (yb=="Rat [Zi]"){
yis1=gon[0];
yis2="";
yis3="";
}
if (yb=="Ox [Chou]"){
yis1=gon[6];
yis2=gon[0];
yis3=gon[8];
}
if (yb=="Tiger [Yin]"){
yis1=gon[1];
yis2=gon[3];
yis3=gon[5];
}
if (yb=="Rabbit [Mao]"){
yis1=gon[2];
yis2="";
yis3="";
}
if (yb=="Dragon [Chen]"){
yis1=gon[5];
yis2=gon[2];
yis3=gon[0];
}
if (yb=="Snake [Si]"){
yis1=gon[3];
yis2=gon[5];
yis3=gon[7];
}
if (yb=="Horse [Wu]"){
yis1=gon[4];
yis2=gon[6];
yis3="";
}
if (yb=="Goat [Wei]"){
yis1=gon[6];
yis2=gon[4];
yis3=gon[2];
}
if (yb=="Monkey [Shen]"){
yis1=gon[7];
yis2=gon[9];
yis3=gon[5];
}
if (yb=="Rooster [You]"){
yis1=gon[8];
yis2="";
yis3="";
}
if (yb=="Dog [Xu]"){
yis1=gon[5];
yis2=gon[8];
yis3=gon[4];
}
lpb0 = lpb0 + FW;
if ((lpb0>12) || (lpb0<0)){
lpb0 = lpb0 - 12*FW;
}
lpb1 = ji[lpb0];
lpb0 = lpb0 + FW;
if ((lpb0>12) || (lpb0<0)){
lpb0 = lpb0 - 12*FW;
}
lpb2 = ji[lpb0];
lpb0 = lpb0 + FW;
if ((lpb0>12) || (lpb0<0)){
lpb0 = lpb0 - 12*FW;
}
lpb3 = ji[lpb0];
lpb0 = lpb0 + FW;
if ((lpb0>12) || (lpb0<0)){
lpb0 = lpb0 - 12*FW;
}
lpb4 = ji[lpb0];
lpb0 = lpb0 + FW;
if ((lpb0>12) || (lpb0<0)){
lpb0 = lpb0 - 12*FW;
}
lpb5 = ji[lpb0];
lpb0 = lpb0 + FW;
if ((lpb0>12) || (lpb0<0)){
lpb0 = lpb0 - 12*FW;
}
lpb6 = ji[lpb0];
lpb0 = lpb0 + FW;
if ((lpb0>12) || (lpb0<0)){
lpb0 = lpb0 - 12*FW;
}
lpb7 = ji[lpb0];
lpb0 = lpb0 + FW;
if ((lpb0>12) || (lpb0<0)){
lpb0 = lpb0 - 12*FW;
}
lpb8 = ji[lpb0];
lps0 = lps0 + FW;
if ((lps0>10) || (lps0<0)){
lps0 = lps0 - 10*FW;
}
lps1 = gon[lps0];
lps0 = lps0 + FW;
if ((lps0>10) || (lps0<0)){
lps0 = lps0 - 10*FW;
}
lps2 = gon[lps0];
lps0 = lps0 + FW;
if ((lps0>10) || (lps0<0)){
lps0 = lps0 - 10*FW;
}
lps3 = gon[lps0];
lps0 = lps0 + FW;
if ((lps0>10) || (lps0<0)){
lps0 = lps0 - 10*FW;
}
lps4 = gon[lps0];
lps0 = lps0 + FW;
if ((lps0>10) || (lps0<0)){
lps0 = lps0 - 10*FW;
}
lps5 = gon[lps0];
lps0 = lps0 + FW;
if ((lps0>10) || (lps0<0)){
lps0 = lps0 - 10*FW;
}
lps6 = gon[lps0];
lps0 = lps0 + FW;
if ((lps0>10) || (lps0<0)){
lps0 = lps0 - 10*FW;
}
lps7 = gon[lps0];
lps0 = lps0 + FW;
if ((lps0>10) || (lps0<0)){
lps0 = lps0 - 10*FW;
}
lps8 = gon[lps0];


form.ys.value = ys ;
form.ms.value= ms ;
form.ds.value = ds ;
form.hs.value = hs ;

form.yb.value = yb;
form.mb.value= mb;
form.db.value = db;
form.hb.value = hb;

form.comment1.value = str1;
form.comment2.value = str2;

form.hs1.value = his1;
form.hs2.value = his2;
form.hs3.value = his3;
form.ds1.value = dis1;
form.ds2.value = dis2;
form.ds3.value = dis3;
form.ms1.value = mis1;
form.ms2.value = mis2;
form.ms3.value = mis3;
form.ys1.value = yis1;
form.ys2.value = yis2;
form.ys3.value = yis3;
form.lp1.value = LP;
form.lp2.value = LP + 10;
form.lp3.value = LP + 20;
form.lp4.value = LP + 30;
form.lp5.value = LP + 40;
form.lp6.value = LP + 50;
form.lp7.value = LP + 60;
form.lp8.value = LP + 70;
form.lps1.value = lps1;
form.lps2.value = lps2;
form.lps3.value = lps3;
form.lps4.value = lps4;
form.lps5.value = lps5;
form.lps6.value = lps6;
form.lps7.value = lps7;
form.lps8.value = lps8;
form.lpb1.value = lpb1;
form.lpb2.value = lpb2;
form.lpb3.value = lpb3;
form.lpb4.value = lpb4;
form.lpb5.value = lpb5;
form.lpb6.value = lpb6;
form.lpb7.value = lpb7;
form.lpb8.value = lpb8;

}
// End hiding -->

