function getTime() 
{
    var now = new Date();                                   

    var hour   = now.getHours();
    var minute = now.getMinutes();
    var second = now.getSeconds();

    var beg = new Date( now.getFullYear() - 1, 11, 31 ); 
    var day = Math.floor( ( now - beg ) / 86400000 );
 
    document.calc.jd01.value = jd;

    var mst = getMST( now, 0.0 );                          
    var ras = mst;                                          
    mst  = mst / 15.0;                                     
   
    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 ); 

    
    hour = Math.floor( mst );
        
    mst  = mst - hour;
    mst  = mst * 60;
    minute = Math.floor( mst );
        
    mst  = mst - minute;
    mst  = mst * 60;
    second = Math.floor( mst );     
    
    document.calc.gst.value = d2( hour ) + " : " + d2( minute ) + " : " + d2( second );
   

    newtime = window.setTimeout("getTime();", 1000);
}

function d2( n )
{
    if( n < 10 )
        return "0" + n;

    return n;
}


function getMST( now, lon )
{
    var year   = now.getFullYear();
    var month  = now.getMonth() + 1;
    var day    = now.getDate();
    var hour   = now.getHours();
    var minute = now.getMinutes();
    var second = now.getSeconds();

    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));
  
    var jd = b + c + d - 730550.5 + day + (hour + minute/60.0 + second/3600.0)/24.0;
    
    var jt   = jd/36525.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;
}

//  End -->