// JavaScript Document

var activeBlock;

document.observe('dom:loaded', function() {
	$('contactInfoShell').hide();
	$('aboutShell').hide();
	
	$('aboutLink').observe('click', aboutClick);
	// $('workLink').observe('click', workClick);
	$('contactLink').observe('click', contactClick);
	
	var closeLinks = $$('a.close')
	for (var i = 0; i < closeLinks.length; i++) {
  		closeLinks[i].observe('click', closeClick);
	}

	
	
	function removeLinkHighlights() {
		$('aboutLink').removeClassName('active');
		// $('workLink').removeClassName('active');
		$('contactLink').removeClassName('active');
	}
	function doCommonLinkTasks(event, skipLinkHighlight) {
		var element = event.element();
		removeLinkHighlights();
		if (skipLinkHighlight != true) {
  			element.addClassName('active');
		}
		element.blur();
		if (activeBlock != null) {
			Effect.BlindUp(activeBlock, { duration: .1 });
		}
	}
	function aboutClick(event) {
		doCommonLinkTasks(event);
		Effect.BlindDown('aboutShell', { duration: .2, queue:'end' });
		activeBlock = $('aboutShell');
	}
	/*
	function workClick(event) {
  		doCommonLinkTasks(event);
		activeBlock = null;
	}
	*/
	function contactClick(event) {
  		doCommonLinkTasks(event);
		Effect.BlindDown('contactInfoShell', { duration: .2, queue:'end' });
		activeBlock = $('contactInfoShell');
	}
	function closeClick(event) {
		doCommonLinkTasks(event, true);
		activeBlock = null;
	}
	
});

