﻿function rollTime() {
	var rootOfAll = new Date();
	var getHour = rootOfAll.get('hours');
	var getMinute = rootOfAll.get('minutes');
	var getSeconds = rootOfAll.get('seconds');
	var getDaysArray = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
	var getMonthsArray = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
	var getDate = rootOfAll.get('date');
	var getYear = rootOfAll.get('fullyear');
	var getOrdinal = rootOfAll.get('ordinal');
	var getItAll = getDaysArray[rootOfAll.get('day')] + ", " + getMonthsArray[rootOfAll.get('month')] + " " + getDate + "" + getOrdinal + ", " + getYear;
	$('dateandall').set('html', getItAll);
	 if (getMinute <= 9) {
      getMinute = "0" + getMinute;
      $('minute').set('html', getMinute);
    }
     if (getMinute > 9) {
      $('minute').set('html', getMinute);
    }
    if (getSeconds <= 9) {
      getSeconds = "0" + getSeconds;
       $('seconds').set('html', getSeconds);
    }
    if (getSeconds > 9) {
       $('seconds').set('html', getSeconds);
    }
    if (getHour > 12) {
      getHour = getHour - 12;
      $('hour').set('html', getHour);
	  $('ampm').set('html', 'PM');
    } 
    else {
      getHour = getHour;
       $('hour').set('html', getHour);
	  $('ampm').set('html', 'AM');
    }
    if (getHour == 12) {
      $('ampm').set('html', 'PM');
    }
    if (getHour == 00) {
     getHour = "12";
    }
	rollTime.delay(1000);
}
window.addEvent('domready', function(){
var tips1 = new FancyTips($$('.tips'), {className:'zindexing',fixed:false, offsets: {'x': 0, 'y': 19}});
var tips2 = new FancyTips($$('.tips2'), {className:'zindexing4',fixed:false, offsets: {'x': -170, 'y': 19}});
var tips3 = new FancyTips($$('.tips3'), {className:'zindexing2',fixed:true, offsets: {'x': 5, 'y': 16}, showDelay: 500});
var tips4 = new FancyTips($$('.tips4'), {className:'zindexing3',fixed:true, offsets: {'x': -150, 'y': 16}, showDelay: 500});
var tips4 = new FancyTips($$('.tips5'), {className:'zindexing2',fixed:true, offsets: {'x': 10, 'y': 19}, showDelay: 500});
var ttt = $('ttt');
var tttfx = new Fx.Morph(ttt, {duration: 1000, 'transition': Fx.Transitions.Back.easeInOut});
new Drag.Move(ttt, {
	onStart: function(el) {
		el.setStyle('cursor', 'move');
	},
	onComplete: function(el){
		tttfx.start({'top': 0, 'left': 0});
		el.setStyle('cursor', 'pointer');
	}
});
var sun = $('sun');
var sunfx = new Fx.Morph(sun, {duration: 1000, 'transition': Fx.Transitions.Back.easeInOut});
new Drag.Move(sun, {
	onStart: function(el) {
		el.setStyle('cursor', 'move');
	},
	onComplete: function(el){
		sunfx.start({'top': 0, 'left': 0});
		el.setStyle('cursor', 'pointer');
	}
});	

rollTime();
});