/////////////////////////////////////////////////////////////////////
// Site Search Form Validation
/////////////////////////////////////////////////////////////////////
function siteSearch(){

	// reset all required fields to normal status
	document.getElementById('search').className = "";

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

	// Validate form fields
	if (document.getElementById('search').value=="Search" || document.getElementById('search').value=="" )
	{
		errmsg += "What do you want to search for?\n";
		document.getElementById('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);
			//var parent = el.parentNode;
			//parent = $(parent);
			var parent = $(el.parentNode);

			if(parent.hasClassName('open'))
				parent.removeClassName('open');
			else
				parent.addClassName('open');
		});
	});

	// widgets moreLink
	$$('div#related p.moreLink').each(function(el){
		el.style.display = 'inline';
		if(el.previousSiblings().last() && el.previousSiblings().last().tagName.toLowerCase() == 'p')
			el.previousSiblings().last().style.display = 'inline';
	});
});

function display_items(index, array_of_ids)
{
	array_of_ids.each(function(el){
		if($(el))
			$(el).hide();
	});
	$(index).style.display = 'block';
}
