View file servis/moon/index.php

File size: 3.17Kb
<?php
include $_SERVER['DOCUMENT_ROOT']."/template/head.php";
?>
<head>


</head>

<body>

<SCRIPT LANGUAGE="JavaScript">
<!-- Original: James Thiele (mailto:[email protected]) -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin

// Save the two necessary images from our example page at:
// http://messages.javascriptsource.com/moon-phases.html

var black = "black.gif";
var white = "white.gif";

var height=1;
var size = 50;
var i;
var currentDate = new Date();
var x = currentDate;
currentDate.setTime(currentDate.getTime() + (currentDate.getTimezoneOffset()*60000));
var blueMoonDate = new Date(96, 1, 3, 16, 15, 0);
var lunarPeriod = 29*(24*3600*1000) + 12*(3600*1000) + 44.05*(60*1000);
var moonPhaseTime = (currentDate.getTime() - blueMoonDate.getTime()) % lunarPeriod;
var percentRaw = (moonPhaseTime / lunarPeriod);
var percent = Math.round(100*percentRaw) / 100;
var percentBy2 = Math.round(200*percentRaw);
var left = (percentRaw >= 0.5) ? black : white;
var right = (percentRaw >= 0.5) ? white : black;
var time = Math.round((lunarPeriod-moonPhaseTime)/(24*3600*1000));

document.write("<center>");

if (percentBy2 > 100) {
percentBy2 = percentBy2 - 100;
}
for (i = -(size-1); i < size; ++i) {
var wid=2*parseFloat(Math.sqrt((size*size)-(i*i)));
if (percentBy2 != 100)
document.write ("<img src="+left +" height=1 width="+(wid*((100-percentBy2)/100))+">");
if (percentBy2 != 0)
document.write("<img src="+right+" height=1 width="+(wid*((percentBy2)/100))+">");
document.write("<br>");
}
document.write("<BR><FONT SIZE=4>Следующее полнолуние через ",time," ");
if (time == 1) document.write("день");
if (time == 2) document.write("дня");
if (time == 3) document.write("дня");
if (time == 4) document.write("дня");
if (time == 5) document.write("дней");
if (time == 6) document.write("дней");
if (time == 7) document.write("дней");
if (time == 8) document.write("дней");
if (time == 9) document.write("дней");
if (time == 10) document.write("дней");
if (time == 11) document.write("дней");
if (time == 12) document.write("дней");
if (time == 13) document.write("дней");
if (time == 14) document.write("дней");
if (time == 15) document.write("дней");
if (time == 16) document.write("дней");
if (time == 17) document.write("дней");
if (time == 18) document.write("дней");
if (time == 19) document.write("дней");
if (time == 20) document.write("дней");
if (time == 21) document.write("день");
if (time == 22) document.write("дня");
if (time == 23) document.write("дня");
if (time == 24) document.write("дня");
if (time == 25) document.write("дней");
if (time == 26) document.write("дней");
if (time == 27) document.write("дней");
if (time == 28) document.write("дней");
if (time == 29) document.write("дней");
if (time == 30) document.write("дней");
if (time == 31) document.write("день");
document.write("</font>");
// End -->
</script> 



</body>
<?php
include $_SERVER['DOCUMENT_ROOT']."/template/foot.php";
?>