/**
* This method is the core portion
*/
function valid(fld)
{
return true;
/*
if(fld.value != null){
if(fld.value == "snow"){
displaySnow();
} else if(fld.value == "credits"){
displayCredits();
} else if(fld.value == "leopard"){
displayLeopard(fld);
} else if(fld.value == "rain"){
displayRain();
} else if(fld.value == "fireworks"){
displayFireworks();
} else if(fld.value == "clock") {
clock.start();
}
}
*/
}
/**
* This initializes the snow and then starts running it.
*/
function displaySnow(){
initSnowFlakes(5,"../images/snow.gif");
moveSnowFlakes(100);
}
/**
* This displays the credits
*/
function displayCredits(){
credits=window.open("../flash/credits.swf", "credits", "toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,scrollbars=0,width="+(screen.width-10)+",height="+(screen.height-55)+",top=0,left=0");
credits.focus();
}
/**
* This sents the css value appropriately
*/
function displayLeopard(fld){
fld.form.css.value = "leopard";
}
/**
* This initializes the rain and then starts running it.
*/
function displayRain(){
initRain();
raindropIE();
}
/**
* This initializes the snow and then starts running it.
*/
function displayFireworks(){
initFireworks();
Fireworks();
}
// **********************Snow Flakes************************
var snowFlakeArray = new Array();
function snowFlake(){
this.dx = 0; // set coordinate variables
this.xPosition = Math.random()*(document.body.clientWidth-50); // set position variables
this.yPosition = Math.random()*document.body.clientHeight;
this.amplitude = Math.random()*20; // set amplitude variables
this.stepX = 0.02 + Math.random()/10; // set step variables
this.stepY = 0.7 + Math.random(); // set step variables
}
function initSnowFlakes(numSnowFlakes,imageLocation){
var snowFlakeDivs = "";
for (var i = 1; i < numSnowFlakes; i++) {
snowFlakeArray[i] = new snowFlake();
snowFlakeDivs += "
";
snowFlakeDivs += "

";
snowFlakeDivs += "
";
}
document.body.innerHTML = document.body.innerHTML.toString() + snowFlakeDivs;
}
function moveSnowFlakes(speed) {
var doc_width = document.body.clientWidth;
var doc_height = document.body.clientHeight;
for (i = 1; i < snowFlakeArray.length; i++) { // iterate for every snow flake
snowFlakeArray[i].yPosition += snowFlakeArray[i].stepY;
if (snowFlakeArray[i].yPosition > doc_height-50) {
snowFlakeArray[i].xPosition = Math.random()*(doc_width-snowFlakeArray[i].amplitude-30);
snowFlakeArray[i].yPosition = 0;
snowFlakeArray[i].stepX = 0.02 + Math.random()/10;
snowFlakeArray[i].stepY = 0.7 + Math.random();
}
snowFlakeArray[i].dx += snowFlakeArray[i].stepX;
document.all["snowFlake"+i].style.pixelTop = snowFlakeArray[i].yPosition;
document.all["snowFlake"+i].style.pixelLeft = snowFlakeArray[i].xPosition + snowFlakeArray[i].amplitude*Math.sin(snowFlakeArray[i].dx);
}
setTimeout("moveSnowFlakes("+speed+")", speed);
}
// ****************** End Snow Flakes************************
// ******************* Rain ********************************
var no = 10;
var speed = 100;
var s, x, y, sn, cs;
var a, r, cx, cy;
var i, doc_width = 800, doc_height = 600;
function initRain(){
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
x = new Array();
y = new Array();
r = new Array();
cx = new Array();
cy = new Array();
s = 8;
var rainDivs = "";
for (i = 0; i < no; ++ i) {
rain();
if (i == 0) {
rainDivs += "";
rainDivs += ",
";
} else {
rainDivs += "";
rainDivs += ",
";
}
}
document.body.innerHTML = document.body.innerHTML.toString() + rainDivs;
}
function rain() {
a = 6;
r[i] = 1;
sn = Math.sin(a);
cs = Math.cos(a);
cx[i] = Math.random() * doc_width + 1;
cy[i] = Math.random() * doc_height + 1;
x[i] = r[i] * sn + cx[i];
y[i] = cy[i];
}
function makeRain() {
r[i] = 1;
cx[i] = Math.random() * doc_width + 1;
cy[i] = 1;
x[i] = r[i] * sn + cx[i];
y[i] = r[i] * cs + cy[i];
}
function updateRain() {
r[i] += s;
x[i] = r[i] * sn + cx[i];
y[i] = r[i] * cs + cy[i];
}
function raindropIE() {
for (i = 0; i < no; ++ i) {
updateRain();
if ((x[i] <= 1) || (x[i] >= (doc_width - 20)) || (y[i] >=(doc_height - 20))) {
makeRain();
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
}
document.all["dot"+i].style.pixelTop = y[i];
document.all["dot"+i].style.pixelLeft = x[i];
}
setTimeout("raindropIE()", speed);
}
// ******************* End Rain *****************************
// ******************* Fireworks ********************************
function initFireworks(){
var fireworkDivs = "";
fireworkDivs += '';
fireworkDivs += '
';
fireworkDivs += '
';
fireworkDivs += '
';
fireworkDivs += '
';
fireworkDivs += '
';
fireworkDivs += '
';
fireworkDivs += '
';
fireworkDivs += '
';
fireworkDivs += '
';
fireworkDivs += '
';
fireworkDivs += '
';
fireworkDivs += '
';
fireworkDivs += '
';
fireworkDivs += '
';
fireworkDivs += '
';
document.body.innerHTML = document.body.innerHTML.toString() + fireworkDivs;
}
var Clrs = new Array(9);
Clrs[0] = 'ff0000';
Clrs[1] = '00ff00';
Clrs[2] = '000aff';
Clrs[3] = 'ff00ff';
Clrs[4] = 'ffa500';
Clrs[5] = 'ffff00';
Clrs[6] = '00ff00';
Clrs[7] = 'ffffff';
Clrs[8] = 'fffff0';
var sClrs = new Array(5);
sClrs[0] = 'ffa500';
sClrs[1] = '55ff66';
sClrs[2] = 'AC9DFC';
sClrs[3] = 'fff000';
sClrs[4] = 'fffff0';
var yBase;
var xBase;
var step;
var currStep = 0;
var Xpos = 1;
var Ypos = 1;
var initialStarColor = 'ffa000';
var Mtop = 250;
var Mleft = 250;
function Fireworks() {
yBase = window.document.body.offsetHeight / 3;
xBase = window.document.body.offsetWidth / 8;
step = 5;
for ( i = 0 ; i < starsDiv.all.length ; i++ ) {
for (ai = 0; ai < Clrs.length; ai++) {
var c = Math.round(Math.random()*[ai]);
}
if (currStep < 90)
starsDiv.all[i].style.background=initialStarColor;
if (currStep > 90)
starsDiv.all[i].style.background=Clrs[c];
starsDiv.all[i].style.top = Mtop + yBase*Math.sin((currStep+i*5)/3)*Math.sin(550+currStep/100);
starsDiv.all[i].style.left = Mleft + yBase*Math.cos((currStep+i*5)/3)*Math.sin(550+currStep/100); }
currStep+= step;
T=setTimeout("Fireworks()",5);
if (currStep == 220) {
currStep = -10;
for (n = 0; n < sClrs.length; n++) {
var k = Math.round(Math.random()*n);
}
initialStarColor = sClrs[k];
Dtop = window.document.body.clientHeight - 250;
Dleft = xBase * 3.5;
Mtop = Math.round(Math.random()*Dtop);
Mleft = Math.round(Math.random()*Dleft);
document.all.starsDiv.style.top = Mtop+document.body.scrollTop;
document.all.starsDiv.style.left = Mleft+document.body.scrollLeft;
if (Mtop < 20 || Mleft < 20) {
Mtop += 90;
Mleft += 90;
}
}
}
// ******************* End Fireworks *****************************
// *************** START CLOCK **************************
var ns = (document.layers);
var ie = (document.all);
var scrollBarOffset = 0;
var currentMouseYPosition = 0;
var currentMouseXPosition = 0;
var step = 0.06;
var currStep = 0;
var clock = new Clock();
function Calendar(){
this.day = new Array( "SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY");
this.month = new Array( "JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER");
}
function Clock(){
var calendar = new Calendar();
this.hourArrayeight = 40;
this.width = 40;
this.fromMouseY = 0;
this.fromMouseX = 100;
this.dateColor = '0000FF';
this.faceColor = '000000';
this.secondColor = '000000';
this.minuteColor = '000000';
this.hourColor = '000000';
var date = new Date();
var day = date.getDate();
var year = date.getYear();
if (year < 2000) {
year = year + 1900;
}
this.dateArray = (" " + calendar.day[date.getDay()] + " " + day + " " + calendar.month[date.getMonth()] + " " + year).split('');
this.hourArray = '...'.split('');
this.minuteArray = '....'.split('');
this.secondArray = '.....'.split('');
this.faceArray = '1 2 3 4 5 6 7 8 9 10 11 12'.split(' ');
this.y = new Array();
this.x = new Array();
this.Y = new Array();
this.X = new Array();
for (var i = 0; i < this.faceArray.length; i++){
this.y[i] = 0;
this.x[i] = 0;
this.Y[i] = 0;
this.X[i] = 0;
}
this.dateyArray = new Array();
this.datexArray = new Array();
this.dateYArray = new Array();
this.dateXArray = new Array();
for (var i = 0; i < this.dateArray.length; i++){
this.dateyArray[i] = 0;
this.datexArray[i] = 0;
this.dateYArray[i] = 0;
this.dateXArray[i] = 0;
}
this.start = start;
}
function start(){
var newHtml = createDiv(ie, 'd', 'Date', clock.dateArray, clock.dateColor);
newHtml += createDiv(ie, 'f', 'Face', clock.faceArray, clock.faceColor);
newHtml += createDiv(ie, 'h', 'Hours', clock.hourArray, clock.hourColor);
newHtml += createDiv(ie, 'm', 'Minutes', clock.minuteArray, clock.minuteColor);
newHtml += createDiv(ie, 's', 'Seconds', clock.secondArray, clock.secondArrayecondColor);
document.body.innerHTML = "" + document.body.innerHTML + newHtml;
(ns)?window.onMouseMove=Mouse:document.onmousemove=Mouse;
delay();
}
function createDiv(isIE, outerName, innerName, myArray, fontColor){
var font = 'Arial';
var size = 1;
var divHeightAndWidth = size*10;
var newHTML = "";
if(isIE){
var fontInfo = "";
newHTML += '';
for (var i = 0; i < myArray.length; i++) {
newHTML += '
'+fontInfo+myArray[i]+'
';
}
newHTML += '
';
} else {
for (i=0; i < myArray.length; i++) {
newHTML += ''+myArray[i]+'';
}
}
return newHTML;
}
function Mouse(evnt){
currentMouseYPosition = (ns)?evnt.pageY + clock.fromMouseY - (window.pageYOffset):event.y + clock.fromMouseY;
currentMouseXPosition = (ns)?evnt.pageX + clock.fromMouseX:event.x + clock.fromMouseX;
}
function updateDisplay(){
var time = new Date ();
var sec = -1.57 + Math.PI * time.getSeconds()/30;
var min = -1.57 + Math.PI * time.getMinutes()/30;
var hrs = -1.575 + Math.PI * time.getHours()/6 + Math.PI*parseInt(time.getMinutes())/360;
if (ie){
Od.style.top = window.document.body.scrollTop;
Of.style.top = window.document.body.scrollTop;
Oh.style.top = window.document.body.scrollTop;
Om.style.top = window.document.body.scrollTop;
Os.style.top = window.document.body.scrollTop;
}
var sliceSize = 360/clock.faceArray.length;
for ( var i = 0; i < clock.faceArray.length; i++){
var faceLayer=(ns)?document.layers['nsFace' + i]:ieFace[i].style;
faceLayer.top = clock.y[i] + clock.hourArrayeight * Math.sin(-1.0471 + i * sliceSize * Math.PI/180) + scrollBarOffset;
faceLayer.left = clock.x[i] + clock.width * Math.cos(-1.0471 + i * sliceSize * Math.PI/180);
}
var handHeight = clock.hourArrayeight/4.5
var handWidth = clock.width/4.5
var handY = -7;
var handX = -2.5;
for ( var i = 0; i < clock.hourArray.length; i++){
var hourLayer = (ns)?document.layers['nsHours' + i]:ieHours[i].style;
hourLayer.top = clock.y[i] + handY + (i * handHeight) * Math.sin(hrs) + scrollBarOffset;
hourLayer.left = clock.x[i] + handX + (i * handWidth) * Math.cos(hrs);
}
for ( var i = 0; i < clock.minuteArray.length; i++){
var minuteLayer = (ns)?document.layers['nsMinutes' + i]:ieMinutes[i].style;
minuteLayer.top = clock.y[i] + handY + (i * handHeight) * Math.sin(min) + scrollBarOffset;
minuteLayer.left = clock.x[i] + handX + (i * handWidth) * Math.cos(min);
}
for ( var i = 0; i < clock.secondArray.length; i++){
var secondLayer = (ns)?document.layers['nsSeconds' + i]:ieSeconds[i].style;
secondLayer.top = clock.y[i] + handY + (i * handHeight) * Math.sin(sec) + scrollBarOffset;
secondLayer.left = clock.x[i] + handX + (i * handWidth) * Math.cos(sec);
}
dateSliceSize = 360/clock.dateArray.length;
for ( var i = 0; i < clock.dateArray.length; i++){
var dateLayer = (ns)?document.layers['nsDate' + i]:ieDate[i].style;
dateLayer.top = clock.dateyArray[i] + clock.hourArrayeight * 1.5 * Math.sin( currStep + i * dateSliceSize * Math.PI / 180) + scrollBarOffset;
dateLayer.left = clock.datexArray[i] + clock.width * 1.5 * Math.cos( currStep + i * dateSliceSize * Math.PI / 180);
}
currStep -= step;
}
function delay(){
var speed = 0.5;
scrollBarOffset = (ns)?window.pageYOffset:0;
clock.dateyArray[0] = Math.round( clock.dateYArray[0] += ( (currentMouseYPosition) - clock.dateYArray[0]) * speed);
clock.datexArray[0] = Math.round( clock.dateXArray[0] += ( (currentMouseXPosition) - clock.dateXArray[0]) * speed);
for (var i = 1; i < clock.dateArray.length; i++){
clock.dateyArray[i] = Math.round( clock.dateYArray[i] += (clock.dateyArray[i-1] - clock.dateYArray[i]) * speed);
clock.datexArray[i] = Math.round( clock.dateXArray[i] += (clock.datexArray[i-1] - clock.dateXArray[i]) * speed);
}
clock.y[0] = Math.round( clock.Y[0] += ( (currentMouseYPosition) - clock.Y[0] ) * speed);
clock.x[0] = Math.round( clock.X[0] += ( (currentMouseXPosition) - clock.X[0] ) * speed);
for (var i = 1; i < clock.faceArray.length; i++){
clock.y[i] = Math.round(clock.Y[i] += (clock.y[i-1] - clock.Y[i]) * speed);
clock.x[i] = Math.round(clock.X[i] += (clock.x[i-1] - clock.X[i]) * speed);
}
updateDisplay();
setTimeout('delay()',40);
}
// *************** END CLOCK **************************