
function toggleHeaderSection(section_header){
	var about = $('about');
	var about_content = getSectionContent(about);
	var things = $('things_we_do');
	var things_content = getSectionContent(things);
	var picture = $('picture_this');
	var picture_content = getSectionContent(picture);

	var clicked = $(section_header);
	var clicked_content = getSectionContent(clicked);

	var currentlyDown = null;

	// check if any section is up
	if (Element.visible(about_content)) {
		currentlyDown = 'about';
	} else if (Element.visible(things_content)) {
		currentlyDown = 'things_we_do';
	} else if (Element.visible(picture_content)) {
		currentlyDown = 'picture_this';
	}

	if (currentlyDown != null && currentlyDown != clicked_content) {
		toggleSection(currentlyDown);
		pausecomp(500);
	}

	toggleSection(section_header);
/*
		if (section_header == 'about') {
			setTimeout("toggleSection('about')", 500);
		} if (section_header == 'things_we_do') {
			setTimeout("toggleSection('things_we_do')", 500);
		} else if (section_header == 'picture_this') {
			setTimeout("toggleSection('picture_this')", 500);
		}
	*/

}

function pausecomp(millis)
{
date = new Date();
var curDate = null;

do { var curDate = new Date(); }
while(curDate-date < millis);
} 

function toggleSection(section_header) {
	var sh = $(section_header);
	var content = getSectionContent(sh);
	if (Element.visible(content)) {
		blindFade(content, 'up', 0.5);
	} else {
		blindFade(content, 'down', 0.5);
	}
}

function getSectionContent(section_header) {
	return $(section_header.id + '_content');
}

function blindFade(node, dir, dur) {
	if (dir == 'up') {
		new Effect.BlindUp(node, { duration: dur, queue: 'parallel' });
		//new Effect.Fade(node, { duration: dur, queue: 'parallel' });
	} else {
		new Effect.BlindDown(node, { duration: dur, queue: 'parallel' });
		//new Effect.Appear(node, { duration: dur, queue: 'parallel' });
	}
}

/** Open New Window **/
function open_window(url,id,w,h) {
    if(url != ""){
	newWin=window.open(url,id,'height='+h+',width='+w+',scrollbars=yes,resizable=yes,location=no,menubar=no,status=no,toolbar=no');
	newWin.focus();
    }
}

function ToggleSlide(id) {
	if ($(id).style.display == 'none') new Effect.SlideDown(id, {duration: .3});
	else new Effect.SlideUp(id, {duration: .3});
}