// JavaScript Document

function OA_init()
{
	$$('a.expand').each( function(expand)
	{
		expand.onclick = function()
		{
			$(this.rel).toggle();
			this.ancestors()[0].toggleClassName('expanded');
			return false;
		}
	});
	
	function moveMenus(btn)
	{
		if( btn.parentNode.className == 'inactive' )
		{
			for( j in menubtns )
			{
				if(menubtns[j].parentNode && menubtns[j].id)
				{
					if( btn == menubtns[j] )
					{
						btn.parentNode.className = 'active';
						var id = "menubtns_"+btn.id.split("_")[1];
						Effect.BlindDown(id,{ duration: .2 });
					}
					else
					{
						menubtns[j].parentNode.className = 'inactive';
						var id = "menubtns_"+menubtns[j].id.split("_")[1];
						Effect.BlindUp(id,{ duration: .2 });
					}
				}
			}
		}
	}
}

function css_validation()
{
	form = document.forms[0];
	var submit_it = true;
	for( i=0;i<form.length;i++ )
	{
		if( form[i].className && form[i].className.indexOf('REQUIRED') > -1 )
		{
			form[i].oldclass = form[i].parentNode.parentNode.className;
			if( form[i].value == '' )
			{
				form[i].parentNode.parentNode.className = form[i].oldclass+" formerror";
				submit_it = false;
			}
			else
			{
				form[i].parentNode.parentNode.className = form[i].oldclass;
			}
		}
	}
	if( !submit_it ) document.getElementById('errormsg').innerHTML = '<strong>Please review the highlighted fields and resubmit.</strong>';
	return submit_it;
}

Event.observe( window, 'load', OA_init );