var shown = false;

// AFTER DOM IS LOADED
window.addEvent('domready', function() {
	document.getElementById('nav').style.visibility = 'hidden';

	var navFx = new Fx.Morph('nav', {
		duration: 1000,
		wait: false,
		transition: Fx.Transitions.Sine.easeOut
		});
	
	// Function loadContent in header.php (to support php tags)
	if(shown)
		showContent();
	var headerFx = new Fx.Morph('header', {
		duration: 1000,
		wait: false,
		transition: Fx.Transitions.Sine.easeOut
		}).start({
			'height' : [document.window.getSize().y, 100]
		}).chain(function () {
			navFx.start({
				'height' : [0, 25],
				'opacity' : [0, 1]
			}).chain(function () {
				// Function loadSidebar in header.php (to support php tags)
				document.getElementById('sidebar').style.visibility = 'visible';
				document.getElementById('sidebar').style.height = '400px';
				document.getElementById('flash').style.visibility = 'visible';
				document.getElementById('flash').style.height = '400px';
				var so = new SWFObject("swf/sidebar.swf", "sidebar", "250", "400", "8", "#ffffff");
				so.addParam("quality", "high");
				so.addParam("loop","false");
				so.write("flash");
				if(document.getElementById('flash').innerHTML.indexOf('img') != -1)
					// FLASH NOT ENABLED
					showContent();
				else
				{
					// FLASH ENABLED
					document.getElementById('flash').firstChild.style.visibility = 'visible';
					document.getElementById('flash').firstChild.style.height = '400px';
				}
			});
		});
});


// SHOWS CONTENT
function showContent()
{
	// PROTECTS FROM FLICKERING ISSUES
	if(!shown)
	{
		shown = true;
		document.getElementById('content').style.paddingTop = '60px';
		document.getElementById('book').src = 'images/nav/nav_over_01.png';
		document.getElementById('book').onmouseout = '';
		var contentFx = new Fx.Morph('content', {
			duration: 1000,
			wait: false,
			transition: Fx.Transitions.Sine.easeOut
		}).start({
			'opacity' : [0, 1]
		});
		document.getElementById('content').style.height = 'auto';
	}
}
// TEMPORARY BLOG CONTENT
function blogWindow()
{
	alert('MatterFarm, the Do You Matter? Blog is coming soon...');
}