Event.observe (window, 'load', function () 
{	var main = $ ('main');
	main.init ();
	var center = [];
	center.x =  getWindowSize ().width / 2;
	center.y =  getWindowSize ().height / 2;
	main.addClassName ('init');
	$$ ('#main .content')[0].init ();
	$$ ('#main .content')[0].setOpacityTo (0);
	main.move (center.x - main.getHeight () / 2, center.y - main.getWidth () / 2);
	//.setStyle ({visibility:'visible'});
	function setup_main ()
	{	$$ ('#main .loading')[0].hide ();
		var left, top;
		if (getWindowSize ().width > 800)
		{	left = getWindowSize ().width / 2 - 400;
		}else
		{	left = 0;
		}
		if (getWindowSize ().height > 600)
		{	top = getWindowSize ().height / 2 - 300;
		}else
		{	top = 0;
		}
		$ ('email').innerHTML = getEmail ();
		
		main.slideTo (left, top, 40);
		main.scaleTo (800, 600, 40).removeClassName ('init');
		setTimeout (fadeIn, 1000);
		//
	}
	setTimeout (setup_main, 3000);
});
getWindowSize = function () {
	var w = window;
	this.width = w.innerWidth || (w.document.documentElement.clientWidth || w.document.body.clientWidth);
	this.height = w.innerHeight || (w.document.documentElement.clientHeight || w.document.body.clientHeight);
	return this;
}
getEmail = function () {
	var uname = 'cmsanche';
	var domain = 'CS.Princeton.EDU';
	return '<a href="mailto:' + uname + '@' + domain + '">' + uname + '@' + domain + '</a>';
}
fadeIn = function ()
{	$$ ('#main .content')[0].setOpacityTo (1, 100);
}
Event.observe (window, 'resize', function ()
{	setup_main ();	
});
