var Apollo = new Class({
	initialize: function() {
		window.addEvent('resize', this.initHeights.bind(this));
	}
	
	,initHeights:function() {
		var s = document.getSize();
		var ss = $('site').getSize();
		s.y = Math.max(s.y, ss.y);
		$('site').setStyle('height',s.y +"px");
		$$('.column').each(function(oEl){
			oEl.setStyle('height',s.y +"px");
		});
	}
});

var apollo;
window.addEvent('domready',function() {
	apollo = new Apollo();
	var image_layer = new mooImageLayer({
			resize:true
	});
});

window.addEvent('load', function() {
	var f = function() {
		if(apollo) {
			apollo.initHeights();
		}
		else {
			setTimeout(f, 100);
		}	
	}
	f();
});

var currentDate = new Date(); // Convert it to GMT 
currentDate.setTime(currentDate.getTime() + (currentDate.getTimezoneOffset()*60000)); // Get Date (GMT) for recent full moon // NOTE: months, hours, and minutes are 0 based 
var blueMoonDate = new Date(96, 1, 3, 16, 15, 0); // Compute length of lunar period -- source: World Almanac 
var lunarPeriod = 29*(24*3600*1000) + 12*(3600*1000) + 44.05*(60*1000) ;
var moonPhaseTime = (currentDate.getTime() - blueMoonDate.getTime()) % lunarPeriod;
// alert("Moon phase in days = "+moonPhaseTime/(24*3600*1000)) 
// Compute various percentages of lunar cycle 
var percentRaw = (moonPhaseTime / lunarPeriod); 
// alert("% = "+percentRaw) 
var percent = Math.round(100*percentRaw) / 100; 
//alert("% = "+percent); 
var percentBy2 = Math.round(200*percentRaw);

