/////////////////////////////////////////////////////////////////////
// Site Search Form Validation
/////////////////////////////////////////////////////////////////////

function headerSearch(section){
	var field_id = 'site';
	var field_value = 'site search';

	if(section == 'cases')
	{
		field_id = 'case';
		field_value = 'case search';
	}
	// reset all required fields to normal status
	document.getElementById(field_id+'Search').className = "";

	// Set the default error message
	errmsg = "";

	// Validate form fields
	if (document.getElementById(field_id+'Search').value==field_value || document.getElementById(field_id+'Search').value=="")
	{
		errmsg += "What do you want to search for?\n";
		document.getElementById(field_id+'Search').className = "error";
	}

	//Check to see if we added anything to the default error message
	if (errmsg != "")
	{
		alert(errmsg);
		return false;
	}

	return true;
}



/////////////////////////////////////////////////////////////////////
// Widgets Sidebar Expand/Contract
/////////////////////////////////////////////////////////////////////

document.observe('dom:loaded',function(){
	// more arrow drop downs
	$$('a.view_more').each(function(el){
		el.observe('click',function(event){
			Event.stop(event);
			$(el.parentNode).toggleClassName('open');
		});
	});

	$('navPractice').onmouseover=function() { $('navPractice').addClassName('hover'); };
	$('navPractice').onmouseout=function() { $('navPractice').removeClassName('hover'); };

	['recNews','featCases'].each(function(el){
		if($(el))
		{
			$$('#'+el+' h3 a').first().observe('click',function(event){
				Event.stop(event);
				if($(el).hasClassName('open'))
					$(el).removeClassName('open');
				else
					$(el).addClassName('open');
			});
		}
	});
});

function display_items(index, array_of_ids)
{
	array_of_ids.each(Element.hide);
	$(array_of_ids[index]).style.display = 'block';
}
