function toggle_display(block,link) {
	block = document.getElementById(block);
	block.blur();
	if (block.style.display == 'block')
		block.style.display = 'none';
	else
		block.style.display = 'block';

	var classSplit = link.className.split(" ");
	link.className = '';
	
	for(i = 0; i < classSplit.length; i++){
		if (classSplit[i] == 'hidden')
			classSplit[i] = 'visable';
		else if (classSplit[i] == 'visable')
			classSplit[i] = 'hidden';
		link.className = link.className + ' ' + classSplit[i]; 
	}
}

function toggle_text(block,text1,text2) {
	block.blur();
	var current_text = block.innerHTML;
	if (block.innerHTML == text1)
		block.innerHTML = text2;
	else if (block.innerHTML == text2)
		block.innerHTML = text1;
}

function printer_friendly(url,width) {
	window.open(url, "Printer_Friendly_Version", "width=" + width + ",height=600,scrollbars=yes");
	return false;
}

function submitPersonForm(form,error_container) {
	var errors = [];
	document.getElementById(error_container).innerHTML =  '';
	if(form.name.value == '')
		errors[0] = 'Please include your name.';
	if(form.email.value == '')
		errors[1] = 'Please include your email address.';
	if(form.email_confirm.value != form.email.value)
		errors[2] = 'Please make sure your email addresses match.';
	if(form.message.value == '')
		errors[3] = 'Please include a brief message.';
		
	if (errors.length > 0){
		document.getElementById(error_container).innerHTML = '<b>Sorry.  Please correct the following errors:</b><br>';
		for (i=0;i<errors.length;i++)
			if (errors[i]) document.getElementById(error_container).innerHTML += errors[i] + '<br>';
		return false;
	}

	return true;
}

